ROS2, diff. drive robot, libgazebo_ros_diff_drive, 4 wheels

libgazebo_ros_diff_drive.so: 4 wheels

It is possible to control more than one pair of wheels using diff. drive plugin. Let's design a four-wheeled robot.

The code for this section is located in fwd_bot part of an archive. Note that archive includes some additional folders, like maps and worlds, that are used by all projects and therefore are located outside of them.

There are surprisingly few changes.

gazebo_control.xacro

gazebo_control.xacro now refers not one but two pairs of wheels:

                    
                

robot.urdf.xacro

robot.urdf.xacro refers to fwd_bot, rather than diff_drive_bot, as the name of a package changed.

robot_core.xacro

robot_core.xacro uses box-shaped robot, as for 4-wheeled robot we do not need cylindrical body anymore, so we don't use meshes.

                        
                

Launch files

Launch files are identical to the previous example, except for the name of a package.

Starting the simulation

Starting the simulation is also identical (except for package name):

                    # Terminal 1:
                    $ ros2 run teleop_twist_keyboard teleop_twist_keyboard
                
                    # Terminal 2:
                    $ cd ~/SnowCron/ros_projects/harsh/
                    $ colcon build --packages-select fwd_bot
                    $ source install/setup.bash
                    $ ros2 launch fwd_bot launch_sim.launch world:=src/worlds/shapes.sdf 
                

(C) snowcron.com, all rights reserved

Please read the disclaimer