Trajectories and Separate GUI/simulation Threads!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Trajectories and Separate GUI/simulation Threads!

Rosen Diankov-2
New OpenRAVE feature additions:

The GUI and Simulation threads are now separate, meaning that the GUI
screen will not freeze anymore when planning or doing other expensive
computation. There are several added bonuses to this feature:

- You can plot points/lines in a planner or some expensive function to
show progress, and see the GUI show the plots in real-time
- Because the GUI queries body positions independent of the simulation
thread, you can also see the robot or other bodies update respective
in the GUI. This is very useful for debugging, but can get annoying
very fast, especially when generating nice simulation videos.
Therefore, I added a way to change how the simulation thread publishes
data to the GUI. Use orEnvSetOptions('publishanytime 1') to enable it,
it is disabled by default to maintain backwards compatibility.

Greatly improved trajectories, all the changes can be found in rave.h
and Trajectory.h. Just a small summary:

 Trajectory::Write now takes an options parameter specifying what
parts of a trajectory to save. The options are

TO_OneLine - if set, will write everything without newlines, otherwise
                      will start a newline for the header and every
trajectory point
TO_NoHeader - do not write the header that specifies number of points,
degrees of freedom, and other options
TO_IncludeTimestamps - include timestamps
TO_IncludeBaseTransformation - include the base link transformation
TO_IncludeVelocities - include velocities. If
TO_IncludeBaseTransformation is also set, include the base
                                   base link velocity in terms of
linear and angular velocity

Note that the trajerctory format has changed. The new format is

    /// The file format is:
    /// #points #dof #options
    /// [timestamp 1] [dof joint values 1] [transform 1] [dof joint
velocities 1] [linear and angular velocity 1]
    /// [timestamp 2] [dof joint values 2] [transform 2] [dof joint
velocities 2] [linear and angular velocity 2]
    /// ...
    /// linear velocity - xyz velocity
    /// angular velocity - axis * angular_speed
    /// transform - look at Transform::operator <<, outputs quaternion
first then translation
    /// an example file that contains 2 points with timestamps for a 3
dof robot is
    /// 2 3 4
    /// 0.5 0 0   0
    /// 1.5 1 2.2 3.3

Also added a new network function to start a trajectory directly from matlab

% orRobotStartActiveTrajectory(robotid, jointvalues, timestamps,
% Starts/Queues a robot trajectory of the robot where the size of
% each trajectory point is the current active degrees of freedom
% of the robot (others are held constants)
% D is the number of active degrees of freedom.
% N is the number of points of the trajectory
% robotid - unique id of the robot
% jointvalues - DxN matrix of the joint values of each point in the trajrectory.
% timestamps [optional] - the time stamps in seconds of each trajectory point.
% transformations [optional] - 12xN or 7xN matrix. The base link
transformations of
%                              each trajectory point.
%                              If the column size is 12, then it is a 3x4 matrix
%                              in column first order
%                              If the column size is 7, then it is a
quaterion and a translation.

Finally, for those of you playing with simulations, note that now
there's a way to stop the internal simulation loop. It is very
important to note that stopping the internal simulation loop stops
calling the SimulationStep function for KinBody, Robot, Controller,
ProblemInstance, etc. There's also a way to change the physics engine
through the scripts.

By default OpenRAVE uses a dummy physics engine where nothing moves,
and the internal loop is always running. There's two commands
available through orEnvSetOptions to change this stuff:

simulation [start/stop] - start stop the internal loop
physics engine_name - set a new physics engine

Rosen Diankov,