Motion planning

WARNING: Since V-REP release 3.3.0, a plugin wrapping the OMPL library is available. It is highly recommended to use the path planning API functions offered by that plugin, instead of using this old built-in path/motion planning functionality, since the plugin/OMPL approach is much more flexible and scalable. The following documentation is deprecated.

V-REP's motion planning module allows handling motion planning tasks for kinematic chains. It does not include path planning for loose objects in space, which is handled by the path planning module. Following figures illustrate a motion planning example in V-REP:

[Motion planning task from Start to Goal while avoiding obstacles and joint limits]


A motion planning task allows to compute a trajectory (usually in the configuration space of the manipulator) from a start configuration to a goal configuration, by taking into account following main items:

  • the manipulator kinematics
  • the manipulator joint limits
  • the manipulator self-collisions
  • the collisions between manipulator and obstacles (or the environment)
  • When the goal configuration is not directly known, it needs to be computed from a goal pose (i.e. the position and orientation in Cartesian space of the end-effector). The motion planning task can then be divided into two distinct operations:

  • Finding a goal configuration that matches a goal pose
  • Finding a collision-free path from a start configuration to a goal configuration
  • [Two step motion planning: (a) finding a goal configuration, (b) finding a path in the configuration space]


    When the goal configuration is not directly known, one can also simply try to generate a straight line path in the Cartesian space, effectively generating a trajectory via inverse kinematics. This is not considered as a motion planning task per se (a path around obstacles will not be found), but since a robot is often moved in both, configuration and Cartesian space, this case is also mentioned here:

  • Generating a path via IK in the Cartesian space
  • [Finding a path in the Cartesian space, via inverse kinematics calculations]



    Finding a goal configuration

    When the goal configuration is not known, but only a goal pose is known (i.e. a position and orientation of the end-effector) then an appropriate manipulator configuration that satisfies the goal pose constraint has to be found. There can be multiple (or even an infinitie number of) solutions:

    [Searching for a manipulator configuration corresponding to a given end-effector pose]


    Finding an appropriate manipulator configuration that satisfies a given pose is computed in V-REP based on precalculated configuration nodes and inverse kinematics calculation. Imagine following 2 DoF manipulator:

    [Simple 2 DoF manipulator (2 joints, each with specific joint limits)]


    V-REP will generate a large amount of precalculated configuration nodes, where each node consists of a manipulator configuration (i.e. joint values) associated with a corresponding end-effector pose (i.e. a position and orientation in Cartesian space). This is visualized in following figure that shows 12 precalculated configuration nodes (i.e. 3x4, where the joint 1 range is subdivided in 3 joint values, and the joint 2 range is subdivided in 4 joint values):

    [Precalculated configuration nodes (pairs of manipulator configuration and end-effector pose)]


    Depending on the number of joints of the manipulator (i.e. its DoF) and the individual joint subdivisions, computation of above nodes could take up to a few seconds. This is however a one-time computation, usually performed the first time a motion planning API function is called.

    The precalculated nodes are used, together with the inverse kinematics of the manipulator, to find manipulator configurations that match a given end-effector pose. The search algorithm will select all nodes that contain poses in proximity (i.e. close enough according to a specified Cartesian space metric) of a desired pose:

    [2 precalculated configuration nodes close enough to a desired pose]


    The inverse kinematics will then try to move the selected poses so that they overlap the desired pose:

    [IK calculations in order to find valid configurations for a desired pose]


    The API function allowing to perform above calculations (i.e. finding a manipulator configuration that matches a desired end-effector pose) is simGetConfigForTipPose.


    Finding a collision-free path

    When searching for a collision-free path from a start configuration to a goal configuration, depending on the manipulator type, there can be multiple (or even an infinitie number of) solutions, mainly also because the search algorithm is based on a randomized resolution method:

    [Searching for a collision-free path from one to another manipulator configuration]


    Finding an appropriate path is an iterative process that involves two steps:

  • Finding a path
  • Simplifying a found path
  • Finding a path involves trying to link the start configuration to the goal configuration via randomly generated configurations. The found trajectory is usually a succession of straight lines in the configuration space, and the output of the operation is a succession of path nodes (or path configurations) that are distant to each other by a maximum of D, which is a configuration space distance:

    [Finding a raw path from start to goal via random configurations]


    The API function allowing to perform above calculations (i.e. finding a raw collision-free path from a start to a goal configuration) is simFindMpPath.

    A raw path is often not optimized and can rarely be used as-is. A simplification pass is usually required and involves trying to successively link path nodes via straight lines in the configuration space:

    [Simplification procedure of a raw path]


    You should be aware that, depending on the selected parameters, the simplification procedure can be more lengthy than the path search in itself. For that reason a common practice to find an optimal path is to calculate several raw paths, then select the shortest path that will finally be simplified.

    The API function allowing to perform above simplification is simSimplifyMpPath.


    Generating a linear path via IK in the Cartesian space

    In some situations, it is required to move along a straight line in Cartesian space, i.e. using the manipulator's inverse kinematics. In that case, V-REP can generate a straight trajectory, given that the robot does not collide along that trajectory:

    [Generating a path via IK]


    The generated path does not need to be simplified, since it is already the shortest possible path in Cartesian space.

    The API function allowing to generate above path is simGenerateIkPath. Have also a look at simCheckIkGroup, and read also following section:


    Following a path in the Cartesian space

    Following a path or trajectory in the Cartesian space can be very tricky.

    When using only IK, we take the risk to move into a configuration that does not allow us to further follow the path (e.g. because of some joint limitations, or because of some obstacles in the way):

    [Following a path via IK]


    When only searching for appropriate configurations located at various position on the path, we will effectively be able to avoid obstacles - however only discretely: how do we link all the potentially very different neighbouring configurations?

    [Finding discret solutions on a path]


    For above two scenarios, there are several different approaches that allow to overcome the mentioned problems.

    In case of the first scenario, you have for instance following possibility: when reaching a difficult portion of the path, or when close to a configuration where IK alone doesn't work anymore, you can look a little bit ahead, and find a new configuration that is legal. Then, interpolate between both configurations and have the IK bring the end-effector back on track:

    [Interpolation between configurations, followed by an IK step]


    The API function allowing to do the interpolation in the configuration space, followed by an IK step is simGetMpConfigTransition.


    Setting up a manipulator for motion planning is a one-time task, and once set-up, you will be able to perform as many motion planning calculations as needed. For the set-up, make sure to follow instructions described in the using the motion planning functionality section.


    Recommended topics

  • Related API functions
  • Using the motion planning functionality
  • Motion planning dialog