Plots of trajectory within the viewer

Discussion in 'Feature Requests' started by Michael J Mathew, Jul 25, 2016.

  1. Dear Emo,

    It would be quite useful to see selected joints' trajectory within the viewer.


  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    The viewer does not have a GUI that is elaborate enough to show a list of joints and allow the user to select them, but if you already have the list, you can add a 2D plot over the 3D rendering programmatically, using this function:

    // plot 2d lines
    MJAPI void mjr_lines(mjrRect viewport, int nline, const int* npoint, const mjtNum* data);

    viewport is the rectangle where the 2D plot will be created
    nline is the number of lines/curves to be drawn
    npoint is an array of ints specifying how many data points are in each line
    data is an array of mjtNum (x,y) coordinates of the points in all lines

    The axes are scaled automatically, colors range from red to green.

    I will add documentation after the 1.40 release.