Autonomous Systems

Design, develop, and test autonomous systems with MATLAB

Enabling Off-Road Simulation with MATLAB and MSU Autonomous Vehicle Simulator (MAVS)

Autonomous vehicle technology is now venturing beyond the structured confines of urban landscapes into unpredictable terrains such as mining or construction sites. Offroad autonomy promises to revolutionize industries from agriculture to defense, solving complex challenges of navigation and control in unstructured environments. Enabling such advancements, MATLAB® and Simulink® connect with external simulators to provide an integrated environment for simulating and testing off-road scenarios.

Guest blogger Chris Goodin introduces integration between Navigation Toolbox™ for MATLAB and MSU Autonomous Vehicle Simulator (MAVS). Chris is a faculty and researcher at Center for Advanced Vehicular Systems (CAVS) at Mississippi State University.

What Is MAVS?

The MSU Autonomous Vehicle Simulator (MAVS) is a software library for autonomous ground vehicles (AGV) that features realistic physics-based simulations of the vehicle, sensors, and terrain that comprise an AGV and its operating environment. Written in C++, until now MAVS lacked an easy way to integrate with the MATLAB development environment.

MAVS simulator showing a simulated vehicle driving in a virtual offroad environment with different weather conditions

Figure. 1 – Simulated offroad environment in MSU Autonomous Vehicle Simulator (MAVS)

MAVS-MATLAB Interface

Recently, researchers at CAVS have released a MATLAB interface to MAVS (https://github.com/CGoodin/mavs-matlab) that allows MATLAB users to directly integrate the MAVS simulations of sensors, vehicles, terrain, and environmental effects directly into MATLAB applications. This interface is open source and available on Github. The examples show a simulated MAVS vehicle navigating autonomously using Navigation Toolbox functions such as plannerHybridAStar and controllerPurePursuit.

Learn more: Motion Planning with MATLAB (eBook).

How Does It Work?

MAVS-MATLAB uses the clib function of MATLAB to automatically generate MATLAB interfaces to C-compliant MAVS function calls. The clib function automatically generates a DLL file that can later be imported into MATLAB. In addition, the MAVS-MATLAB library obscures the clib interfaces from the user by wrapping all the interface calls for creating, editing, and deleting MAVS objects in MATLAB classes. For example, the “MavsLidar” class in the MAVS-MATLAB package provides a “pure” MATLAB object that does not require a user to interface with the clib features directly. The following command creates a simulated Ouster OS1 lidar using the MAVS-MATLAB interface:

lidar = Mavslidar(‘OS1’);

Similar commands can be used to create MAVS scenes, environments, and vehicles. In addition to the programmatic interface, MAVS-MATLAB provides an example MATLAB GUI to allow users to get up and running quickly.

A Graphical User Interface (GUI) built in MATLAB for MAVS interface

Figure 2. MAVS GUI startup window

The GUI lets users see the available features of MAVS like weather, scenes, sensors, and vehicles. Sensors can be added to the vehicle at different locations, and it’s possible to save video recordings of the simulation. The main purpose of the GUI is to familiarize users with the features of MAVS and provide a quick and intuitive experience for MAVS-MATLAB users to use as a starting point for digging deeper into the MATLAB API.

When a simulation is launched from the GUI, a simulation window like the one shown in Figure 3 is created. In the simulation, a point cloud is generated by a simulated lidar sensor in MAVS. The points are segmented using the MATLAB segmentGroundFromLidarScan function, and the non-ground points are added to a MATLAB binaryOccupancyMap using the pc2scan and insertRay functions.

The binaryOccupancyMap is passed the the MATLAB plannerHybridAStar function to generate a desired path, which is then passed to the MATLAB controllerPurePursuit function generate driving commands.

MAVS GUI simulation window

Figure 3. MAVS GUI simulation window

The driving commands are then sent back to the MAVS vehicle simulation to update the state of the vehicle and sensor. In this way, the vehicle autonomously navigates from the user-defined start and goal points while avoiding obstacles.

Future Work

Planned future work on the MAVS-MATLAB interface includes tighter integration with MATLAB-ROS capabilities so that sensor data types (PointCloud2, Image) can be published directly from MATLAB nodes that implement MAVS features. MAVS-MATLAB is available on Github: https://github.com/CGoodin/mavs-matlab

Long-Term Goals for MAVS-MATLAB

MAVS-MATLAB was developed using funds appropriated through the Strengthening Mississippi Academic Research Through (SMART) Business Act, which is intended to “stimulate private investment in research and development.” Therefore, our goals for MAVS-MATLAB are twofold.

  • First, improve the ease of installation and use for MAVS, making it accessible to a wider range of users, not just C++ programmers.
  • Second, by integrating it directly with the MATLAB environment, to make the research and development for autonomous ground vehicle (AGV) technologies more accessible to student researchers.

Who’s Using MAVS-MATLAB?

Pie chart showing MAVS user breakdown with most users in Academic and some in Government and Industry

Figure 4. MAVS user breakdown

Currently, the core MAVS libraries have a user breakdown shown in Figure 4. MAVS currently has hundreds of users, of which about 25% work for federal or state governments in the US and abroad, 65% work in academia, and the remaining 10% in industry. In contrast to the core MAVS repository, MAVS-MATLAB does not require a license request. Rather, the MAVS dynamic link library (DLL) is distributed with the repo, allowing MAVS-MATLAB users to access MAVS functionality without access to the source code. Our goal is to increase the total number of MAVS users in both industry and academia, with academic users being seen as potential future industry users.

Learn More

 

 

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.