- Use
rosdep
to install all the dependencies, or you can do it manually:
sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserial
or
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-upload
If you are using catkin tools, run this instead:
catkin build --no-deps arduino_node --make-args arduino_node_firmware_oneForAll-upload
All 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::Vector3Stamped
x
field contains the angle in xy plainy
filed contains angular velocity (but no one use that)z
field 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
,Ki
andKd
- 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 thePORT
part infirmware/CMakeList.txt
AND change theport
value inlaunch/ros_serial.launch
to/dev/ttyACM0
- Unplug the USB, plug it back and try again.
- First check that the port name is