Note: This tutorial assumes that you have completed the previous tutorials: Setup and Install. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Run first simulation
Description: On this tutorial we'll take you through the steps of running the first simulations of the self-balancing platformTutorial Level: BEGINNER
Launching Gazebo
Now that we've set up our workspace, we can launch our worlds on Gazebo and spawn a self-balance platform robot.
On the rsv_balance_gazebo package we have available 3 worlds:
empty.world - Empty world with only the robot.
roslaunch rsv_balance_gazebo simulation_empty.launch
ramp.world - Robot on inclined, flat terrain.
roslaunch rsv_balance_gazebo simulation_ramp.launch
terrain.world - Robot on bumpy terrain.
roslaunch rsv_balance_gazebo simulation_terrain.launch
As you can understand from the spawned robot, the demo model includes a dummy, spherical, 5kg load at about 1m height from the center of the platform.
Control the simulated robot using RQT
Nothing too exciting happens yet on the simulation. The robot just moves backward and forward to balance itself upon starting. You can reset the simulation by pressing Ctrl + R.
Let's publish some velocity commands on the default topic /cmd_vel.
Launch RQT and add two plugins, Robot Steering and Operation Mode widget.
rqt
Navigate through the menus:
Plugins > Robot Tools > Robot Steering
Plugins > RoboSavvy balance > Operation Mode widget
You can now move the robot around the world. You can also choose its operation mode.
- Park - Turns off electric motors.
- Tractor - Platform operates in tractor mode, moving with the commanded velocities.
- Balance - Self-balance mode. The robot starts on this mode.
Test any of the modes and verify that the robot will fall in 'Park' and 'Tractor' modes.
When the robot falls down it will switch to 'Park' mode for safety. When down, the robot can't be set to 'Balance' mode. You must reset model poses to get the robot upright (press Ctrl + Shift + R)
Visualize the robot using RVIZ
The simulation can be visualized using RVIZ. For this purpose we have prepared a launch file with RVIZ configured to display the robot and other useful information.
roslaunch rsv_balance_gazebo view.launch