Arduino connections
Image from arduino.cc and blog.huntgang
Component | Pin |
---|---|
Front Left Encoder | D2 |
Front Right Encoder | D3 |
Back Left Encoder | D5 |
Back Right Encoder | D6 |
Throttle (from RC receiver channel 2) | D7 |
Steering (from RC receiver channel 1) | D8 |
Electronic Speed Control (for 3-phase Motor) | D10 |
Servo | D11 |
Front Ultrasound | D14 = A0 |
Back Ultrasound | D15 = A1 |
Right Ultrasound | D16 = A2 |
Left Ultrasound | D17 = A3 |
(barc)odroid@odroid:~$ rosrun rosserial_python serial_node.py
[INFO] [WallTime: 1469676336.827668] ROS Serial Python Node
[INFO] [WallTime: 1469676336.843514] Connecting to /dev/ttyUSB0 at 57600 baud
[INFO] [WallTime: 1469676339.335939] Note: publish buffer size is 280 bytes
[INFO] [WallTime: 1469676339.338132] Setup publisher on encoder [barc/Encoder]
[INFO] [WallTime: 1469676339.346496] Setup publisher on rc_inputs [barc/ECU]
[INFO] [WallTime: 1469676339.358420] Setup publisher on ultrasound [barc/Ultrasound]
[INFO] [WallTime: 1469676339.374436] Note: subscribe buffer size is 280 bytes
[INFO] [WallTime: 1469676339.376341] Setup subscriber on ecu_pwm [barc/ECU]
- The ultrasound sensor code is commented out. Uncomment it when the sensors have been connected, otherwise serial communication may not work properly
- Encoders now use software interrupts (formerly hardware interrupts. Install the necessary library by running
source ~/barc/scripts/install_enable_interrupt.sh
- The arduino sends commands to the servo and motor using pulse width modulation. These commands are sent using the
write(pwm_angle)
andwritemicroSeconds(us)
member functions of aServo
object. Refer to this article for more clarification on these functions