Posts tonen met het label Turtlebot. Alle posts tonen
Posts tonen met het label Turtlebot. Alle posts tonen

dinsdag 9 juni 2015

Simulate your turtlebot in Gazebo

Getting Gazebo up-and-running is described well on the ROS wiki. Here is a short summary.


Step 1: install turtlebot simulator
sudo apt-get install ros-indigo-turtlebot-simulator

Step 2: start gazebo
roslaunch turtlebot_gazebo turtlebot_world.launch


Step 3: start rviz
roslaunch turtlebot_rviz_launchers view_robot.launch


Step 4: launch your other nodes 
For example you can launch the teleop to control your turtlebot and drive it around in the simulator using:
roslaunch turtlebot_teleop keyboard_teleop.launch

Note on world files:
Gazebo can be launched with the world file as parameter.
they can be relative to the existing path, an absolute path or be located in /usr/share/gazebo-<version>/
a subfolder /worlds actually contains a few interesting ones

Stability
Gazebo is not the most stable product. ROS indigo comes with version 2. ROS jade comes with version 5. While ROS jade is available at the time of writing this post, the Turtlebot packages are not. I am axiously looking out for the Turtlebot packages for ROS jade so that I can see if Gazebo indeed deliveres the expected stability improvement.

Gazebo started ok on my machine but gave segmentation faults (exit code 139) later on. I found that this could be due to URDF parsing problems. The following line solved that for me:
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH"

Extra models in Gazebo
You can add extra elements to the Gazebo world. Gazebo has an option to import models from an online repository. You can also download this repository locally using :

hg clone https://bitbucket.org/osrf/gazebo_models

dinsdag 7 april 2015

Use XBox controller with Turtlebot on ROS

Remote control (teleoperation) of the Turtlebot robot is very helpful. It is possible to use an XBox 360 controller for this purpose. This page will get you started. 

Software:
I used ROS Indigo.

Hardware:
Microsoft XBox 360 controller for Windows
(contains a Microsoft XBox 360 wireless receiver for Windows and a wireless controller)

Step 1: install hardware

  • Connect the USB adapter and switch on the XBox controller
  • Press the button on the adapter (light starts flashing)
  • Press, and keep pressed the connect button on the back of the XBox controller : it looks like O)))
  • Now the adapter and XBox controller are connected. Note that the lights on the XBox controller continue blinking.

to see all joystick devices connected run:
ls /dev/input/js* 

test which joystick it is connected to: in my case js0
sudo jstest /dev/input/js0

Make sure it is read/writeable for all:
sudo chmod a+rw /dev/input/js0


Step 2: basics on ROS
make sure ROS is running or start it via roscore

rosparam set joy_node/dev "/dev/input/js1"
rosrun joy joy_node

to see the response when you use the controller execute this statement in another terminal window
rostopic echo joy

Step 3: testing with turtlebot teleop
First bringup the turtlebot (on the turtlebot)
roslaunch turtlebot_bringup minimal.launch

Launch the joy node (on your workstation if you connected the adapter there)
rosparam set joy_node/dev "/dev/input/js0"
rosrun joy joy_node

Now start the teleop controls (on your workstation if you connected the adapter there)

rosparam set /joystick/dev "/dev/input/js0"
roslaunch turtlebot_teleop xbox360_teleop.launch

Important note: You need to press and hold the LB button on the XBox controller to use the joystick!

Note: I was expecting to need to install xboxdrv and joy but on my standard Indigo installation this was not needed.