Only released in EOL distros:  

Package Summary

Trep: Mechanical Simulation and Optimal Control Software

Package Summary

Trep: Mechanical Simulation and Optimal Control Software

Package Summary

Trep: Mechanical Simulation and Optimal Control Software


Trep is a Python module for modeling articulated rigid body mechanical systems in generalized coordinates. Trep supports basic simulation but it is primarily designed to serve as a calculation engine for analysis and optimal control algorithms that require 1st and 2nd derivatives of the system’s dynamics.

Full documentation is available at

ROS Tools

Trep currently provides two features for usage in ROS packages - A URDF import tool and an extended MidpointVI class.

URDF Import Tool

Trep can create a system model using certain tags from the URDF XML specification. The following tags are supported:

  • Link - name
    • Inertial
      • origin
      • mass
      • inertia (only ixx,iyy,izz supported, off-axes should be zero)
  • Joint - name, type: fixed, continuous, prismatic (no joint limits)
    • origin
    • parent
    • child
    • dynamics (damping only)

Additionally, one extra tag is supported on the Joint tag. Specifying kinematic='True' creates a kinematic configuration variable in trep for that joint.

An example of a system created from a URDF on the parameter server is:

   1 import rospy
   2 import trep.ros as rostrep
   4 system = rostrep.import_urdf(rospy.get_param('robot_description'))

Additionally, import_urdf can import the URDF onto an existing system definition and can add a prefix to all of the frames and joints created from the URDF using the following syntax:

   1 system = rostrep.import_urdf(rospy.get_param('robot_description'), 
   2          system=prev_system, prefix='new-prefix')

ROSMidpointVI Integrator

The ROSMidpointVI class extends the MidpointVI class available in trep. This class automatically publishes all frames imported from the URDF to the /tf topic every time ROSMidpointVI.step() is called.

Example Package

An example package called trep_urdf_demo is available at This package has two demos which can be called from launch files. After cloning the package to your ROS workspace, run the following command:

  • RRbot simulator:

     roslaunch trep_urdf_demo rrbot.launch
  • Interactive marionette simulator:

     roslaunch trep_urdf_demo puppet.launch

Wiki: python_trep (last edited 2015-05-24 21:36:06 by AndyWilson)