-
Notifications
You must be signed in to change notification settings - Fork 8
Pioneer
You can find the pioneer robot datasheet in the resources folder
There are Open source C++ development libraries (ARIA) provided by the manufacturer to control the robot via serial port. These libraries are ROS independent, however there is also a ROS wrapper available here : rosaria ROS wrapper
To install ARIA on your system (from mobile robots ARIA wiki) do:
cd $HOME/autonomous_systems/resources
sudo dpkg -i libaria_2.9.4+ubuntu16_amd64.deb
To install the ros wrapper:
source ~/.bashrc
cd $ROS_WORKSPACE
git clone https://github.com/amor-ros-pkg/rosaria.git
catkin build rosaria
source ~/.bashrc
Install udev rules on your system:
Udev rules have 2 purposes: a) they create a simlink to the physical device b) they provide with adecuate admin rights to write to the serial port
cd $HOME/autonomous_systems/resources/scripts/udev_rules/
./install_udev_rules.sh
Ensure that your rules have been properly installed:
Disconnect and connect the robot USB to serial converter cable
ls /dev/pioneer/usb_to_serial_port
The file should exist! (is a simlink to the port with write permissions)
NOTE: If the above udev rules did not work, you could always do:
sudo chmod a+rw /dev/ttyUSB0
Keep in mind this last one has the disadvantage that you need to do it every time you unplug-plug the usb to serial adaptor.
Should be one of this two:
/dev/ttyUSB0
/dev/pioneer/usb_to_serial_port
Depending on which branch of the tutorial you have decided (or managed) to follow.
Keep in mind that will need several terminals to complete this steps:
roscore
rosparam set RosAria/port /dev/pioneer/usb_to_serial_port
rosrun rosaria RosAria
Move the robot:
rostopic pub -r 10 /RosAria/cmd_vel geometry_msgs/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.1}}"
Open rviz and visualize sonar data:
rosrun rviz rviz
For this exercise you will need two laptops connected to the same network, one connected to the robot via usb cable (robot laptop) and another one
from which the teleoperation node will be running (command laptop).
Get the ip adress of the robot laptop:
ifconfig
Look the value in front of "inet addr", you are going to use it in the next step.
Make sure you can ping the robot laptop from the command laptop. (replace IP_ADDRESS_OF_ROBOT_LAPTOP with the value obtained from previous step):
ping IP_ADDRESS_OF_ROBOT_LAPTOP
In both laptops type the following command to define your ROS ip. Replace IP_ADDRESS by the ip of your laptop when executing it in your laptop and the ip of the robot's laptop when running in the robot's laptop.
export ROS_IP=IP_ADDRESS
Tell the command laptop that the roscore is running on another PC (replace IP_ADDRESS_OF_ROBOT_LAPTOP with the value obtained from previous step):
export ROS_MASTER_URI=http://IP_ADDRESS_OF_ROBOT_LAPTOP:11311
Run the robot driver on the robot laptop (needs two terminals):
roscore
rosparam set RosAria/port /dev/pioneer/usb_to_serial_port && rosrun rosaria RosAria
Test moving the robot from the command laptop:
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.1}}"
If the robot moves then stop it: do ctrl + c on the "rostopic pub terminal" (to kill the process) and run the teleoperation with keyboard:
Make sure the teleoperation node is installed:
sudo apt-get install ros-kinetic-teleop-twist-keyboard
Run the teleoperation:
rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=/RosAria/cmd_vel
Move the robot by pressing the following keys on your keyboard:
u i o
j k l
m , .