Skip to content

Latest commit

 

History

History
 
 

arduino

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Arduino connections

Arduino Nano

Arduino Nano

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
___ ## ROS communication test To ensure that ROS master can communicate with the arduino node, run the following commands in separate terminal windows ``` roscore rosrun rosserial_python serial_node.py ``` Your terminal should output connection information similar to the following. If you see any error messages, then something is wrong with the connection, try reflashing the arduino

(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]


Notes

  • 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) and writemicroSeconds(us) member functions of a Servo object. Refer to this article for more clarification on these functions