Simulate
Once the simulator has been installed, you can launch the simulation.
Launching the simulator
Launch files for the simulation can be found in the clearpath_gz
package, which is installed as part of the clearpath_simulator
metapackage. The default launch file for launching the simulation environment and spawning your robot is
simulation.launch.py.
It can be called like this:
ros2 launch clearpath_gz simulation.launch.py
The launch file will run all of the necessary generators to generate launch and parameter
files for the simulation before launching Gazebo and spawning the robot. These will be placed under the setup path
(defaults to $HOME/clearpath/
).
Launch arguments
If you are using a different setup path, use the setup_path
launch argument to change it:
ros2 launch clearpath_gz simulation.launch.py setup_path:=$HOME/setup/path/
The Gazebo world (defaults to warehouse
) can be changed using the world
launch argument:
ros2 launch clearpath_gz simulation.launch.py world:=my_world
The launch file will look for the world .sdf
file inside the
worldsfolder of the clearpath_gz
package.
The position and orientation of where the robot is spawned can be changed:
ros2 launch clearpath_gz simulation.launch.py x:=1.5 y:=2.7 yaw:=1.5707
To launch Rviz along with the simulation, use the rviz
launch argument:
ros2 launch clearpath_gz simulation.launch.py rviz:=true
Driving the robot
The simulated robot can be driven in the same ways as the physical robot. Take a look at the Teleop
guide for details. In addition, the Gazebo Teleop GUI plugin can be used. The plugin will be visible by default when
Gazebo is launched. If your robot has a namespace, change the topic to <namespace>/cmd_vel
. Set the maximum forward
and yaw velocities, then select the method of driving.