Difference between revisions of "RemoteControl"

From Elcano Project Wiki
Jump to navigation Jump to search
(Created page with " = Elcano Remote Control = The Elcano system can run autonomously or by remote control. There have been four systems built for manual or remote control. == Joystick == The...")
 
(Events)
 
(43 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
=  RC controller =
 +
DumboRC X6FG 6 channel Radio Control Unit 2.4 GHz 4.8-10V. Installed summer 2024
  
 +
Pulse width 1000-2000 milliseconds
  
= Elcano Remote Control =
+
* CH1 Steering
 +
* CH2 Throttle / Brake
 +
* CH3 2 way switch: Forward or reverse
 +
* CH4 3 way slider switch: Manual or Automatic or Operator mode
 +
* CH5 Rotary switch: Request to raise gate to undock.
 +
* CH6 Rotary switch: Reserved
  
The Elcano system can run autonomously or by remote control. There have been four systems built for manual or remote control.
+
The system comes up in Manual (Controlled from RC) mode. The RC can switch the mode to Automatic or Operator. If no data comes from the RC, mode will transition to Operator.
  
== Joystick ==
+
[https://www.amazon.com/dp/B09MS4HBC8/ref=sspa_dk_detail_2?psc=1&pd_rd_i=B09MS4HBC8&pd_rd_w=LeIXy&content-id=amzn1.sym.36d4fe03-2814-4a0b-86e2-d1e3d3071509&pf_rd_p=36d4fe03-2814-4a0b-86e2-d1e3d3071509&pf_rd_r=SF0RW81Y2X0PB3BGXJZP&pd_rd_wg=fWdsi&pd_rd_r=6c04f252-61f9-40a5-ac07-847c559b0e41&s=toys-and-games&sp_csd=d2lkZ2V0TmFtZT1zcF9kZXRhaWxfdGhlbWF0aWM Amazon]
The first system used an APEM 9000 joystick. The part has five wires: 5V power, ground, and three analog lines. The joystick has two axes. The vertical axis is used for throttle (up) and brakes (down). The third analog signal is the voltage of the joystick when centered. The joystick was used in 2014 and is described in http://www.elcanoproject.org/tutorial/lab2.php. The Low-level code may still contain inputs and processing for an analog joystick.
 
  
== Bluetooth ==
+
[[File:DUMBORC.jpg|300px|]]
In 2015 students built a control system using a Bluetooth receiver to the Arduino. The transmitter was a TI Sitara running Android.  
 
  
== 5- and 6-channel RC Controller ==
+
= Operator Control  =
The system has been run from either a Hitec Optics 5 2.4 five channel unit or a Spektrum DX6i six channel controller. The Low level circuit board has a3x7 pin socket in the corner to accommodate the receiver. Each channel needs to be on its own interrupt. Since the Arduino Mega has only 6 interrupts and the Arduino Micro has 5, this can be a problem, especially since we want another one or two interrupts to handle the speed. Low level code may still have software to handle these interrupts. The RC controllers send a 1.0 to 2.0 ms pulse on each channel at 30 Hz. Some controllers send these signals in turn. We have built a six-input OR circuit to combine all signals, which would allow processing with just one interrupt. Unfortunately, there is no good way to predict whether the RC unit will send pulses in turn or all at once. In fact, the behavior seems to be determined by the receive unit, not the transmitter. Thus a separate interrupt is required for each channel used. Interrupt processing consists of interrupting on a rising edge, then switching to a falling edge interrupt and logging the pulse width. A width of 1.0 ms typically means one extreme, 1.5 ms is centered, and 2.0 ms is the other extreme., This system can get confusing about which channel is assigned which behavior, and the two controllers assign their channels differently. To go beyond the Arduino interrupt limit, the V2 Low Level board has all RC inputs assigned to Analog Input 8 to 13 of the Arduino. These pins are used digitally. Pins A8-A15 on Arduino Mega, all go to the same port. Thus we can use the pin change interrupt, which is activated whenever any bit of the 8-bit port changes.
 
  
== Amplitude Shift Keying (ASK) RC Controller ==
+
If a person is riding the vehicle, they can use a joystick and switches for the same functionality as the RC controller
  
Elcano currently uses a custom-built radio control system with two arduinos, one in the remote control that collects manual inputs and transmits them with a 433MHz ASK radio transmitter, and one on the Elcano vehicle which receives the information sent over radio and converts it into an ElcanoSerial drive packet which is transmitted to C2 over ElcanoSerial. This information is used to manually drive the trike, begin an autonomous routine, or activate the emergency brake and stop the trike.  
+
* Joystick Left-Right: Steering
 +
* Joystick up/down: Throttle / Brake
 +
* Switch: Forward or reverse
 +
* Switch: Manual or Automatic mode
 +
* Switch: Request to raise gate to undock.
 +
^ There is an Emergency Stop button on the vehicle.
  
=== RC Inputs from the user ===
+
= Automatic Control  =
The transmitter turn and throttle controls are wired to the transmitter arduino's analog pins, so inputs are initially 10 bits. These are lossily compressed down to 8 bits with a rightward bit shift.
 
  
<pre>
+
In Automatic mode, the Nav computer sends driving commands over CAN. Automatic mode is selected by the RC or Operator switch. There are separate Auto modes, depending on whether Auto was selected from the RC or Operator, since the response to E-stop differs.
uint16_t turn = analogRead(A1) >> 2;
 
uint16_t throttle = analogRead(A0) >> 2;
 
</pre>
 
  
The autonomous and e-brake controls are also wired to analog pins but these values are collected using digitalRead() to directly convert these inputs to a 1 or 0.
+
The system can go into Emergency Stop from various situations.
 +
* If Auto Mode was initiated from RC, the RC switch will be in Auto mode. Estop is cleared by returning the RC switch to Manual Mode.
 +
* If Auto Mode was initiated by the operator, the Operator switch will be in Auto mode. Estop is cleared by setting the Operator switch to Manual Mode.
 +
* If the operator pushes the E-Stop button, E-stop is cleared by the button being reset.
  
<pre>
+
= Modes  =
uint8_t autoMode = digitalRead(A2);
 
uint8_t eBrake = digitalRead(A3);
 
</pre>
 
  
=== Payload ===
+
Trike behavior depends on the mode. In RC control, pulling the trigger in puts on the brakes. In Operator or Automatic mode, the RC unit is disabled, except that pulling the trigger in is an E-Stop. State transitions are shown in the diagram. An LED on the vehicle is set to a color in the diagram to indicate the mode.
The transmitter composes these inputs into a 3-byte array:
 
<pre>
 
uint8_t msg[3];
 
msg[0] = turn & 0xFF;
 
msg[1] = throttle & 0xFF;
 
{| cellpadding="5" cellspacing="0" border="1"
 
|-
 
|msg[2] = (autoMode || (eBrake << 1)) ; // B000000EA
 
|}
 
  
</pre>
+
[[File:State transitions2A.png]]
  
The RC receiver expects to receive a 3-bytes of data. A valid message contains the autonomous control mode, emergency brake, turn, and throttle data:
+
== Events ==
<pre>
 
inputs[0] = buf[0] ;
 
inputs[1] = buf[1] ;
 
inputs[2] = bitRead(buf[2], 0); // auto-mode
 
inputs[3] = bitRead(buf[2], 1); // ebrake
 
</pre>
 
  
Later in the code, these values are converted from bytes and Booleans to an ElcanoSerial drive packet. The drive packet has three fields for throttle in cm/s, turn angle in millidegrees, and autonomous and ebrake status transmitted as two consecutive bits, giving a value from 0 (B00) to 3 (B11) but accessible at the bit level using functions such as bitRead().
+
* RC_DATA: Valid data from RC
 
+
* NO_RC: No data from RC
== External Links ==
+
* RC_MAN: RC mode switch set to manual
[[http://www.airspayce.com/mikem/arduino/RadioHead/classRH__ASK.html]] Details on RH_ASK.h serial frames (the output from the Arduino "transmit" pin)
+
* RC_OP: RC mode switch set to operator
 
+
* RC_AUTO: RC mode switch set to auto
-- Main.JosephBreithaupt - 2017-10-11
+
* RC_BRAKE: RC applies brake
 
+
* NO_CAN: No recent data from CAN
 
+
* NO_OP: No operator action for too long
 
+
* OP_AUTO: Operator switch set for auto
* RC_Tx_elcano_revised.png: <br />
+
* OP_MAN: Operator switch set for manual
<img src="%PUBURLPATH%/%WEB%/%TOPIC%/RC_Tx_elcano_revised.png" alt="RC_Tx_elcano_revised.png" width="878" height="821" />
+
* OP_BRAKE: Operator applies brake
 
+
* OP_ESTP: Operator pushes E-stop button
* rh-ask-frame.png: <br />
+
* OP_RTN: Operator resets E-stop button
<img src="%PUBURLPATH%/%WEB%/%TOPIC%/rh-ask-frame.png" alt="rh-ask-frame.png" width="1425" height="246" />
+
* CAN_MAN: Auto mode requests manual takeover
 +
* AUTO_ESTP: Auto mode requests E-stop

Latest revision as of 18:41, 19 June 2026

RC controller

DumboRC X6FG 6 channel Radio Control Unit 2.4 GHz 4.8-10V. Installed summer 2024

Pulse width 1000-2000 milliseconds

  • CH1 Steering
  • CH2 Throttle / Brake
  • CH3 2 way switch: Forward or reverse
  • CH4 3 way slider switch: Manual or Automatic or Operator mode
  • CH5 Rotary switch: Request to raise gate to undock.
  • CH6 Rotary switch: Reserved

The system comes up in Manual (Controlled from RC) mode. The RC can switch the mode to Automatic or Operator. If no data comes from the RC, mode will transition to Operator.

Amazon

DUMBORC.jpg

Operator Control

If a person is riding the vehicle, they can use a joystick and switches for the same functionality as the RC controller

  • Joystick Left-Right: Steering
  • Joystick up/down: Throttle / Brake
  • Switch: Forward or reverse
  • Switch: Manual or Automatic mode
  • Switch: Request to raise gate to undock.

^ There is an Emergency Stop button on the vehicle.

Automatic Control

In Automatic mode, the Nav computer sends driving commands over CAN. Automatic mode is selected by the RC or Operator switch. There are separate Auto modes, depending on whether Auto was selected from the RC or Operator, since the response to E-stop differs.

The system can go into Emergency Stop from various situations.

  • If Auto Mode was initiated from RC, the RC switch will be in Auto mode. Estop is cleared by returning the RC switch to Manual Mode.
  • If Auto Mode was initiated by the operator, the Operator switch will be in Auto mode. Estop is cleared by setting the Operator switch to Manual Mode.
  • If the operator pushes the E-Stop button, E-stop is cleared by the button being reset.

Modes

Trike behavior depends on the mode. In RC control, pulling the trigger in puts on the brakes. In Operator or Automatic mode, the RC unit is disabled, except that pulling the trigger in is an E-Stop. State transitions are shown in the diagram. An LED on the vehicle is set to a color in the diagram to indicate the mode.

State transitions2A.png

Events

  • RC_DATA: Valid data from RC
  • NO_RC: No data from RC
  • RC_MAN: RC mode switch set to manual
  • RC_OP: RC mode switch set to operator
  • RC_AUTO: RC mode switch set to auto
  • RC_BRAKE: RC applies brake
  • NO_CAN: No recent data from CAN
  • NO_OP: No operator action for too long
  • OP_AUTO: Operator switch set for auto
  • OP_MAN: Operator switch set for manual
  • OP_BRAKE: Operator applies brake
  • OP_ESTP: Operator pushes E-stop button
  • OP_RTN: Operator resets E-stop button
  • CAN_MAN: Auto mode requests manual takeover
  • AUTO_ESTP: Auto mode requests E-stop