Page tree
Skip to end of metadata
Go to start of metadata

Using MATLAB objects for ROS callbacks provides some advantages to other methods.  For example, it becomes easier to scale implementations from one to many robots as illustrated below.  It is also slightly easier to debug than using globals.


You will need updated versions of the following ROS packages in your catkin workspace

Make sure and do a catkin_make as the geonav_transform package includes compiled C++ code.

Gazebo Simulation - One Robot

We simulated a Pioneer P3AT including plugins for GPS, IMU and groundtruth.  We add a node to emulate the output from the Microstrain 3DM-GX5-45 ( and a geonav_transform node to convert the lat/lon position to a local x/y coordinate frame (where the local origin is set at 36.596 latitude, -121.878 longitude.)

roslaunch nre_gazebo p3at_gazebo_one.launch initX:=90 initY:=20 initYaw:=0

This should bring up Gazebo with the SDF file.

The raised, flat area is the operational area determined by running the robot along the perimeter, which generated this figure...

This imaged was used to generate a heightmap to visually simulate the terrain.

MATLAB Waypoint Guidance - Object Oriented Implementation

The MATLAB examples are in the nre_gazebo/matlab folder:

We will first run the pioneer_wpt_oop.m script which uses the pioneerwaypointclass.m Class definition.

The results should look something like this...

Two Robots

To add a second follower robot, we can create a new launch file that spawns a robot in another namespace

roslaunch nre_gazebo p3at_gazebo_two.launch

We can reuse the pioneerwaypointclass.m Class definition and instantiate two of the controllers without adding much code.  This is illustrated in the pioneer_wpt_leader_followers_oop.m script in nre_gazebo/matlab.  

We can run that script and should see something like...

Extending to More Robots

With objects, scaling is pretty straightforward.  For Gazebo, we need a launch file that spawns three robots in three namespaces...

 roslaunch nre_gazebo p3at_gazebo_three.launch 


And in MATLAB, we need to change the value of n in the n the pioneer_wpt_leader_followers_oop.m script to create a leader, a follower, and a follower of the follower...


  • No labels