- Use
rosdepto install all the dependencies, or you can do it manually:
sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserialor
sudo apt-get install ros-indigo-rosserial-arduino
sudo apt-get install ros-indigo-rosserial- Fetch the git submodules (libraries):
git submodule update --init --recursive
- Install the Arduino IDE for Linux
Note: you CANNOT build it using Arduino IDE. Instead, use catkin to manage the firmware just as other nodes. Run the following command to compile and upload the firmware.
catkin_make arduino_node_firmware_oneForAll-uploadIf you are using catkin tools, run this instead:
catkin build --no-deps arduino_node --make-args arduino_node_firmware_oneForAll-uploadAll the sensors implement the abstract class SensorReader, which offers a uniform interface for all the sensors.
The Timer functionality is implement using polling because of the stupid incapability between Timer library and ros_serial. In the future consider using Timer1 library.
- Run this first to forward Arduino message:
roslaunch arduino_node ros_serial.launch- You may need to change the serial port name (The name can be seen in Arduino IDE)
- Published:
/encoder: the speed information of motor, usingarduino_msg::Motor/imu: absolute pose information, usinggeometry_msg::Vector3Stampedxfield contains the angle in xy plainyfiled contains angular velocity (but no one use that)zfield is always 0
- Subscribed:
/cmd_vel: set the motor desired speed.- You can publish in terminal like this:
rostopic pub /cmd_vel geometry_msgs/Twist '[0.2, 0, 0]' '[0, 0, 0]' -l
- You can publish in terminal like this:
/tunePID: setKp,KiandKd- You can publish in terminal like this:
rostopic pub /tunePID_L geometry_msgs/Vector3 '{x: 10, y: 5, z: 10}' -1
- You can publish in terminal like this:
- It builds successfully but won't upload
- First check that the port name is
/dev/ttyACM0, if not, edit thePORTpart infirmware/CMakeList.txtAND change theportvalue inlaunch/ros_serial.launchto/dev/ttyACM0 - Unplug the USB, plug it back and try again.
- First check that the port name is