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.

Prerequisites/Dependencies

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 (http://wiki.ros.org/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.)

This should bring up Gazebo with the geonav_cavr.world 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: https://github.com/bsb808/nre_gazebo/tree/master/matlab

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

The results should look something like this...

Get Adobe Flash player

Two Robots

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

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...

Get Adobe Flash player

Extending to More Robots

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

 

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...

Get Adobe Flash player

 

  • No labels