So launching gazebo is actually a major mess and a total pain in the
What's crucial is these steps:
- Create a .yaml document with all the mappings you care about between gazebo topics and ros topics.
- Launch the ros-gz bridge first using:
ros2 launch ros_gz_sim ros_gz_sim.launch.py world_sdf_file:=blue_world.sdf bridge_name:=ros_gz_bridge config_file:=gz_config.yaml use_composition:=True create_own_container:=True - Launch Gazebo using
gz sim blue_world.sdf
You can then get it moving around by
- Unpausing the simulation in gazebo (press the resume button)
- Running
ros2 topic pub /cmd_vel_ros geometry_msgs/msg/Twist "{linear: {x: 5.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: -0.1}}"to publish to the ros node.
The bridge will then send the messages from the ros topic to the gazebo topic and badamim badaboom the car is moving around.
If you'd like to launch P&C build, install, and run them.
Also use rqt_graph to see all the nodes.
- There is a weird bug where the sim will quickly pause and unpause for no reason.
- We need to change the way gazebo pulls in info to not use a twist. See Plugins header below.
- The entire car model needs to be updated. See "banana_to_scale.png" image. And it's also 3 wheeled and the weight is off and it's terrible and totally cooked and directly from the tutorial bc whenever I try to build a model it blows up. It'd be best if this task gets split up into a couple parts, this being one of them.
Also as an aside, it may be wise to consider not using gazebo in the future. Not making a case for it just putting this here as food for thought. I think for P&C we'll definitely be putting considerably more time and energy into our hand-written test cases over use gazebo from now on until it's clearer how it'll be used.
Plugins (which are the absolute worst btw) only allow for like 11 different operations on the car.
I tried pretty extensively to build my own plugin but to no avail - I can't find the package with the headers needed.
Maybe check here: "https://gazebosim.org/docs/harmonic/ros2_gz_vendor_pkgs/"? Honestly idk.
Currently I'm using the gz-sim-diff-drive-system plugin which only takes in a twist (why on earth...). It would be best if we could publish turn
commands and torque commands seperately in two different topics. We should look into this.