Examples demonstrating how to use ROS2 in Python together with AGX Dynamics

The ROS2 examples are located in <agxDir>/data/python/ROS2. These examples are split into two scripts each; a simulation script and a controller script. The controller script must be started using the 'python' command.

For more information about the ROS2 functionality in AGX Dynamics, please read the ROS2 chapter in the User Manual.

Inverted pendulum

Demonstrates how to write a controller that communicates over the ROS2 protocol.

Notice that there are two scripts, the controller (should be started first) and the simulation.

The controller can be started from an "AGX Dynamics Command Line" with the command:

cmd> python data/python/ROS2/inverted_pendulum_ros2_controller.py
              

Then, from another "AGX Dynamics Command Line" starting the simulation script:

cmd> agxviewer inverted_pendulum_ros2.agxPy
              
inverted_pendulum

URDF Robot with ROS2 controller

This example demonstrates the use of the URDF reader for loading a robotic model from a .urdf file.

Together with a controller running in pyton, communicating over ROS2 it demonstrates the capability of robotic simulations in AGX Dynamics.

There are two scripts, the simulation (should be started first in this example) and the the controller.

The simulation can be started from an "AGX Dynamics Command Line" with the command:

cmd> agxViewer urdf_panda_ros2.agxPy
              

Then, from another "AGX Dynamics Command Line" starting the controller script:

cmd> python data/python/ROS2/urdf_panda_ros2_controller.agxPy
              
urdf_panda_ros2

Controlled Excavator

This example show a simulation of an excavator on a deformable terrain that is controlled using a python script over the ROS2 communication protocol

Notice that there are two scripts, the simulation (should be started first) and the controller.

The simulation can be started from an "AGX Dynamics Command Line" with the command:

cmd> agxViewer excavator_terrain_ros2.agxPy
              

Then, from another "AGX Dynamics Command Line" starting the controller script:

cmd> python data/python/ROS2/excavator_terrain_ros2_controller.py
              
excavator_terrain_ros2_controller

Control Excavator E85 using ROS2ControlInterface

This example show a simulation of an excavator on a deformable terrain that is controlled using a python script over the ROS2 communication protocol

The excavator exposes its actuators using the ROS2ControlInterface StepEventListener.

Notice that there are two scripts, the simulation (should be started first) and the controller.

The simulation can be started from an "AGX Dynamics Command Line" with the command:

cmd> agxViewer excavator_E85_terrain_ros2.agxPy
              

Then, from another "AGX Dynamics Command Line" starting the controller script:

cmd> python data/python/ROS2/excavator_E85_terrain_ros2_controller.py
              
excavator_E85_terrain_ros2_controller