OpenRAVE Documentation

qtserverprocess Module

Pyqt example to demonstrate how openrave elements can be controlled by a qt-gui.


Running the Example: --example qtserverprocess


This example shows how a qt-gui can control openrave functionality. If an environment with a robot is loaded, a random pose is generated for which a trajectory is planned. This trajectory can be replayed using the qt-gui.



Usage: --example qtserverprocess [options]

Pyqt example to demonstrate how openrave elements can be controlled by a qt-

  -h, --help  show this help message and exit

Main Python Code

def main(env,options):
    "Main example code."
    global logger
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    logger = logging.getLogger('PyqtControl')
    lhandler =logging.StreamHandler(sys.stdout)
    lhandler.setFormatter(logging.Formatter("%(levelname)-10s:: %(filename)-20s - %(lineno)4d :: %(message)s"))
    server = Server()

Class Definitions

class openravepy.examples.qtserverprocess.CallbackHandler(pipe, callback=None)[source]

Bases: PyQt4.QtCore.QThread

class openravepy.examples.qtserverprocess.MainWindow(pipeOR, pipeServer)[source]

Bases: PyQt4.QtGui.QMainWindow, openravepy.examples.qtserverprocess.Ui_MainWindow

SendToOR(command, args=None, callback=None)[source]
SendToServer(command, args=None, callback=None)[source]
class openravepy.examples.qtserverprocess.OpenRaveServer(pipe)[source]

Bases: object



executeFunction(name, args)[source]
openravepy.examples.qtserverprocess.RaveClone((Interface)ref, (int)cloningoptions) → Interface :

boost::shared_ptr< T > RaveClone(boost::shared_ptr< T const > preference, int cloningoptions)

returned a fully cloned interface
openravepy.examples.qtserverprocess.RaveCreateCollisionChecker((Environment)env, (str)name) → CollisionChecker :

OPENRAVE_API CollisionCheckerBasePtr RaveCreateCollisionChecker(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateController((Environment)env, (str)name) → Controller :

OPENRAVE_API ControllerBasePtr RaveCreateController(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateIkSolver((Environment)env, (str)name) → IkSolver :

OPENRAVE_API IkSolverBasePtr RaveCreateIkSolver(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateInterface((Environment)env, (InterfaceType)type, (str)name) → Interface :

OPENRAVE_API InterfaceBasePtr RaveCreateInterface(EnvironmentBasePtr penv, InterfaceType type, const std::string & interfacename)

openravepy.examples.qtserverprocess.RaveCreateKinBody((Environment)env, (str)name) → KinBody :

OPENRAVE_API KinBodyPtr RaveCreateKinBody(EnvironmentBasePtr penv, const std::string & name = “” )

openravepy.examples.qtserverprocess.RaveCreateModule((Environment)env, (str)name) → Module :

OPENRAVE_API ModuleBasePtr RaveCreateModule(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreatePhysicsEngine((Environment)env, (str)name) → PhysicsEngine :

OPENRAVE_API PhysicsEngineBasePtr RaveCreatePhysicsEngine(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreatePlanner((Environment)env, (str)name) → Planner :

OPENRAVE_API PlannerBasePtr RaveCreatePlanner(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateProblem((Environment)env, (str)name) → Module :

OPENRAVE_API ModuleBasePtr RaveCreateModule(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateProblemInstance((Environment)env, (str)name) → Module :

OPENRAVE_API ModuleBasePtr RaveCreateModule(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateRobot((Environment)env, (str)name) → Robot :

OPENRAVE_API RobotBasePtr RaveCreateRobot(EnvironmentBasePtr penv, const std::string & name = “” )

openravepy.examples.qtserverprocess.RaveCreateSensor((Environment)env, (str)name) → Sensor :

OPENRAVE_API SensorBasePtr RaveCreateSensor(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateSensorSystem((Environment)env, (str)name) → SensorSystem :

OPENRAVE_API SensorSystemBasePtr RaveCreateSensorSystem(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateSpaceSampler((Environment)env, (str)name) → SpaceSampler :

OPENRAVE_API SpaceSamplerBasePtr RaveCreateSpaceSampler(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveCreateTrajectory((Environment)env, (str)name) → Trajectory :

OPENRAVE_API TrajectoryBasePtr RaveCreateTrajectory(EnvironmentBasePtr penv, const std::string & name = “” )

Return an empty trajectory instance.
openravepy.examples.qtserverprocess.RaveCreateViewer((Environment)env, (str)name) → Viewer :

OPENRAVE_API ViewerBasePtr RaveCreateViewer(EnvironmentBasePtr penv, const std::string & name)

openravepy.examples.qtserverprocess.RaveDestroy() → None :

OPENRAVE_API void RaveDestroy()

Destroys the entire OpenRAVE state and all loaded environments.

This functions should be always called before program shutdown in order to assure all resources are relased appropriately.

openravepy.examples.qtserverprocess.RaveFindDatabaseFile((str)arg1, (bool)arg2) → str :

OPENRAVE_API std::string RaveFindDatabaseFile(const std::string & filename, bool bRead = true )

Searches for a filename in the database and returns a full path/URL to it.

filename -
the relative filename in the database
bRead -
if true will only return a file if it exists. If false, will return the filename of the first valid database directory.
a non-empty string if a file could be found.
openravepy.examples.qtserverprocess.RaveFindLocalFile((str)filename[, (str)curdir]) → str
openravepy.examples.qtserverprocess.RaveGetAffineConfigurationSpecification((int)affinedofs[, (KinBody)body[, (str)interpolation]]) → ConfigurationSpecification :

OPENRAVE_API ConfigurationSpecification RaveGetAffineConfigurationSpecification(int affinedofs, KinBodyConstPtr pbody = KinBodyConstPtr () , const std::string & interpolation = “” )

openravepy.examples.qtserverprocess.RaveGetAffineDOF((int)affinedofs) → int :

OPENRAVE_API int RaveGetAffineDOF(int affinedofs)

Returns the degrees of freedom needed to represent all the values in the affine dof mask.

openrave_exception -
throws if
openravepy.examples.qtserverprocess.RaveGetAffineDOFFromIndex((int)affinedofs, (int)index) → DOFAffine :

OPENRAVE_API DOFAffine RaveGetAffineDOFFromIndex(int affinedofs, int index)

Given a mask of affine dofs and an index into the array, returns the affine dof that is being referenced.

affinedofs -
a mask of DOFAffine values
index -
an index into the affine dof array Exceptions
openrave_exception -
throws if dof if index is out of bounds
openravepy.examples.qtserverprocess.RaveGetAffineDOFValuesFromTransform((planningutils)transform, (int)affinedofs[, (planningutils)rotationaxis]) → object :

OPENRAVE_API void RaveGetAffineDOFValuesFromTransform(std::vector< dReal >::iterator itvalues, const Transform & t, int affinedofs, const Vector & vActvAffineRotationAxis = Vector (0, 0, 1) )

Converts the transformation matrix into the specified affine values format.

itvalues -
an iterator to the vector to write the values to. Will write exactly RaveGetAffineDOF(affinedofs) values.
the -
affine transformation to convert
affinedofs -
the affine format to output values in
vActvAffineRotationAxis -
optional rotation axis if affinedofs specified DOF_RotationAxis
openravepy.examples.qtserverprocess.RaveGetDataAccess() → int :

OPENRAVE_API int RaveGetDataAccess()

Returns the acess options set.

openravepy.examples.qtserverprocess.RaveGetDebugLevel() → int :

OPENRAVE_API int RaveGetDebugLevel()

Returns the openrave debug level.
openravepy.examples.qtserverprocess.RaveGetEnvironment((int)arg1) → Environment :

OPENRAVE_API EnvironmentBasePtr RaveGetEnvironment(int id)

get the environment from its unique id

id -
the unique environment id returned by RaveGetEnvironmentId
openravepy.examples.qtserverprocess.RaveGetEnvironmentId((Environment)arg1) → int :

OPENRAVE_API int RaveGetEnvironmentId(EnvironmentBasePtr penv)

return the environment’s unique id, returns 0 if environment could not be found or not registered
openravepy.examples.qtserverprocess.RaveGetEnvironments() → object :

OPENRAVE_API void RaveGetEnvironments(std::list< EnvironmentBasePtr > & listenvironments)

Return all the created OpenRAVE environments.
openravepy.examples.qtserverprocess.RaveGetHomeDirectory() → str :

OPENRAVE_API std::string RaveGetHomeDirectory()

Returns the openrave home directory where settings, cache, and other files are stored.

On Linux/Unix systems, this is usually $HOME/.openrave, on Windows this is $HOMEPATH/.openrave

openravepy.examples.qtserverprocess.RaveGetIkTypeFromUniqueId((int)uniqueid) → IkParameterizationType :

OPENRAVE_API IkParameterizationType RaveGetIkTypeFromUniqueId(int uniqueid)

returns the IkParameterizationType given the unique id detmerined b IKP_UniqueIdMask
openravepy.examples.qtserverprocess.RaveGetIndexFromAffineDOF((int)affinedofs, (DOFAffine)dof) → int :

OPENRAVE_API int RaveGetIndexFromAffineDOF(int affinedofs, DOFAffine dof)

Given a mask of affine dofs and a dof inside that mask, returns the index where the value could be found.

affinedofs -
a mask of DOFAffine values
dof -
a set of values inside affinedofs, the index of the first value is returned Exceptions
openrave_exception -
throws if dof is not present in affinedofs
openravepy.examples.qtserverprocess.RaveGetLoadedInterfaces() → object :

OPENRAVE_API void RaveGetLoadedInterfaces(std::map< InterfaceType, std::vector< std::string > > & interfacenames)

Get a list of all the loaded interfaces.
openravepy.examples.qtserverprocess.RaveGetPluginInfo() → object :

OPENRAVE_API void RaveGetPluginInfo(std::list< std::pair< std::string, PLUGININFO > > & plugins)

Get all the loaded plugins and the interfaces they support.

plugins -
A list of plugins. Each entry has the plugin name and the interfaces it supports
openravepy.examples.qtserverprocess.RaveGlobalState() → UserData :

OPENRAVE_API UserDataPtr RaveGlobalState()

A pointer to the global openrave state.

a managed pointer to the state.
openravepy.examples.qtserverprocess.RaveHasInterface((InterfaceType)type, (str)name) → bool :

OPENRAVE_API bool RaveHasInterface(InterfaceType type, const std::string & interfacename)

Returns true if interface can be created, otherwise false.
openravepy.examples.qtserverprocess.RaveInitialize([(bool)load_all_plugins[, (planningutils)level]]) → int :

OPENRAVE_API int RaveInitialize(bool bLoadAllPlugins = true , int level = Level_Info )

Explicitly initializes the global OpenRAVE state (optional).

bLoadAllPlugins -
If true will load all the openrave plugins automatically that can be found in the OPENRAVE_PLUGINS environment path Optional function to initialize openrave plugins, logging, and read OPENRAVE_* environment variables. Although environment creation will automatically make sure this function is called, users might want explicit control of when this happens. Will not do anything if OpenRAVE runtime is already initialized. If OPENRAVE_* environment variables must be re-read, first call RaveDestroy.
0 if successful, otherwise an error code
openravepy.examples.qtserverprocess.RaveLoadPlugin((str)filename) → bool
openravepy.examples.qtserverprocess.RaveLog((str)log, (int)level) → None :

Send a log to the openrave system with excplicit level

openravepy.examples.qtserverprocess.RaveLogDebug((str)log) → None :

Send a debug log to the openrave system

openravepy.examples.qtserverprocess.RaveLogError((str)log) → None :

Send an error log to the openrave system

openravepy.examples.qtserverprocess.RaveLogFatal((str)log) → None :

Send a fatal log to the openrave system

openravepy.examples.qtserverprocess.RaveLogInfo((str)log) → None :

Send an info log to the openrave system

openravepy.examples.qtserverprocess.RaveLogVerbose((str)log) → None :

Send a verbose log to the openrave system

openravepy.examples.qtserverprocess.RaveLogWarn((str)log) → None :

Send a warn log to the openrave system

openravepy.examples.qtserverprocess.RaveReloadPlugins() → None :

OPENRAVE_API void RaveReloadPlugins()

Reloads all the plugins.

The interfaces currently created remain will continue using the old plugins, so this function is safe in that plugins currently loaded remain loaded until the last interface that uses them is released.

openravepy.examples.qtserverprocess.RaveSetDataAccess((planningutils)accessoptions) → None :

OPENRAVE_API void RaveSetDataAccess(int accessoptions)

Sets the default data access options for cad resources/robot files.

accessoptions -
  • if 1 will only allow resources inside directories specified from OPERNAVE_DATA environment variable. This allows reject of full paths from unsecure/unauthenticated resources. Controls how files are processed in functions like RaveFindLocalFile
openravepy.examples.qtserverprocess.RaveSetDebugLevel((planningutils)level) → None :

OPENRAVE_API void RaveSetDebugLevel(int level)

Sets the global openrave debug level. A combination of DebugLevel.
class openravepy.examples.qtserverprocess.Server[source]

Bases: object

Control server to run the benchmark in its own process.

Setup the shared memory data structure model and initialize the control parts.

executeFunction(name, args)[source]
class openravepy.examples.qtserverprocess.Ui_MainWindow[source]

Bases: object

openravepy.examples.qtserverprocess.axisAngleFromQuat((planningutils)quat) → object :

RaveVector < T > axisAngleFromQuat(const RaveVector < T > & quat)

Converts a quaternion into the axis-angle representation.

quat -
quaternion, (s,vx,vy,vz)
openravepy.examples.qtserverprocess.axisAngleFromRotationMatrix((planningutils)rotation) → object :

RaveVector < T > axisAngleFromMatrix(const RaveTransformMatrix < T > & rotation)

Converts the rotation of a matrix into axis-angle representation.

rotation -
3x3 rotation matrix
openravepy.examples.qtserverprocess.invertPoses((planningutils)poses) → object :

Inverts a Nx7 array of poses where first 4 columns are the quaternion and last 3 are the translation components.

Parameters:poses – nx7 array
openravepy.examples.qtserverprocess.main(env, options)[source]

Main example code.

openravepy.examples.qtserverprocess.matrixFromAxisAngle((planningutils)axisangle) → object :

RaveTransformMatrix < T > matrixFromAxisAngle(const RaveVector < T > & axisangle)

Converts an axis-angle rotation to a 3x3 matrix.

axis -
unit axis * rotation angle (radians), 3 values

matrixFromAxisAngle( (planningutils)axis, (float)angle) -> object

openravepy.examples.qtserverprocess.matrixFromPose((planningutils)pose) → object :

Converts a 7 element quaterion+translation transform to a 4x4 matrix.

Parameters:pose – 7 values
openravepy.examples.qtserverprocess.matrixFromPoses((planningutils)poses) → object :

Converts a Nx7 element quaterion+translation array to a 4x4 matrices.

Parameters:poses – nx7 array
openravepy.examples.qtserverprocess.matrixFromQuat((planningutils)quat) → object :

Converts a quaternion to a 4x4 affine matrix.

Parameters:quat – 4 values
openravepy.examples.qtserverprocess.matrixSerialization((planningutils)transform) → str :

Serializes a transformation into a string representing a 3x4 matrix.

Parameters:transform – 3x4 or 4x4 array
openravepy.examples.qtserverprocess.normalizeAxisRotation((planningutils)axis, (planningutils)quat) → object :

std::pair< T, RaveVector < T > > normalizeAxisRotation(const RaveVector < T > & axis, const RaveVector < T > & quat)

Find the rotation theta around axis such that rot(axis,theta) * q is closest to the identity rotation.

axis -
axis to minimize rotation about
quat -
The angle that minimizes the rotation along with the normalized rotation rot(axis,theta)*q
openravepy.examples.qtserverprocess.openravepyCompilerVersion() → str :

Returns the compiler version that openravepy_int was compiled with

openravepy.examples.qtserverprocess.poseFromMatrices((planningutils)transforms) → object :

Converts an array/list of 4x4 matrices to a Nx7 array where each row is quaternion+translation representation.

Parameters:transforms – list of 3x4 or 4x4 affine matrices
openravepy.examples.qtserverprocess.poseFromMatrix((planningutils)transform) → object :

Converts a 4x4 matrix to a 7 element quaternion+translation representation.

Parameters:transform – 3x4 or 4x4 affine matrix
openravepy.examples.qtserverprocess.poseMult((planningutils)pose1, (planningutils)pose2) → object :

multiplies two poses.

  • pose1 – 7 values
  • pose2 – 7 values
openravepy.examples.qtserverprocess.poseSerialization((planningutils)pose) → str :

Serializes a transformation into a string representing a quaternion with translation.

Parameters:pose – 7 values
openravepy.examples.qtserverprocess.poseTransformPoints((planningutils)pose, (planningutils)points) → object :

left-transforms a set of points by a pose transformation.

  • pose – 7 values
  • points – Nx3 values
openravepy.examples.qtserverprocess.quatFromAxisAngle((planningutils)axisangle) → object :

RaveVector < T > quatFromAxisAngle(const RaveVector < T > & axisangle)

Converts an axis-angle rotation into a quaternion.

axisangle -
unit axis * rotation angle (radians), 3 values

quatFromAxisAngle( (planningutils)axis, (float)angle) -> object :

RaveVector < T > quatFromAxisAngle(const RaveVector < T > & axis, T angle)

Converts an axis-angle rotation into a quaternion.

axis -
unit axis, 3 values
angle -
rotation angle (radians)
openravepy.examples.qtserverprocess.quatFromRotationMatrix((planningutils)rotation) → object :

RaveVector < T > quatFromMatrix(const RaveTransformMatrix < T > & rotation)

Converts the rotation of a matrix into a quaternion.

t -
transform for extracting the 3x3 rotation.
openravepy.examples.qtserverprocess.quatInverse((planningutils)quat) → object :

RaveVector < T > quatInverse(const RaveVector < T > & quat)

Inverted a quaternion rotation.

quat -
quaternion, (s,vx,vy,vz)
openravepy.examples.qtserverprocess.quatMult((planningutils)quat0, (planningutils)quat1) → object :

RaveVector < T > quatMultiply(const RaveVector < T > & quat0, const RaveVector < T > & quat1)

Multiply two quaternions.

quat0 -
quaternion, (s,vx,vy,vz)
quat1 -
quaternion, (s,vx,vy,vz)
openravepy.examples.qtserverprocess.quatMultiply((planningutils)quat0, (planningutils)quat1) → object :

RaveVector < T > quatMultiply(const RaveVector < T > & quat0, const RaveVector < T > & quat1)

Multiply two quaternions.

quat0 -
quaternion, (s,vx,vy,vz)
quat1 -
quaternion, (s,vx,vy,vz)
openravepy.examples.qtserverprocess.quatRotateDirection((planningutils)arg1, (planningutils)sourcedir, targetdir) → object :

RaveVector < T > quatRotateDirection(const RaveVector < T > & sourcedir, const RaveVector < T > & targetdir)

Return the minimal quaternion that orients sourcedir to targetdir.

sourcedir -
direction of the original vector, 3 values
targetdir -
new direction, 3 values
openravepy.examples.qtserverprocess.quatSlerp((planningutils)quat0, (planningutils)quat1, (float)t) → object :

RaveVector < T > quatSlerp(const RaveVector < T > & quat0, const RaveVector < T > & quat1, T t)

Sphereical linear interpolation between two quaternions.

quat0 -
quaternion, (s,vx,vy,vz)
quat1 -
quaternion, (s,vx,vy,vz)
t -
real value in [0,1]. 0 returns quat1, 1 returns quat2
openravepy.examples.qtserverprocess.raveGetDebugLevel() → int :

OPENRAVE_API int RaveGetDebugLevel()

Returns the openrave debug level.
openravepy.examples.qtserverprocess.raveLog((str)log, (int)level) → None :

Send a log to the openrave system with excplicit level

openravepy.examples.qtserverprocess.raveLogDebug((str)log) → None :

Send a debug log to the openrave system

openravepy.examples.qtserverprocess.raveLogError((str)log) → None :

Send an error log to the openrave system

openravepy.examples.qtserverprocess.raveLogFatal((str)log) → None :

Send a fatal log to the openrave system

openravepy.examples.qtserverprocess.raveLogInfo((str)log) → None :

Send an info log to the openrave system

openravepy.examples.qtserverprocess.raveLogVerbose((str)log) → None :

Send a verbose log to the openrave system

openravepy.examples.qtserverprocess.raveLogWarn((str)log) → None :

Send a warn log to the openrave system

openravepy.examples.qtserverprocess.raveSetDebugLevel((planningutils)level) → None :

OPENRAVE_API void RaveSetDebugLevel(int level)

Sets the global openrave debug level. A combination of DebugLevel.
openravepy.examples.qtserverprocess.rotationMatrixFromAxisAngle((planningutils)axisangle) → object :

RaveTransformMatrix < T > matrixFromAxisAngle(const RaveVector < T > & axisangle)

Converts an axis-angle rotation to a 3x3 matrix.

axis -
unit axis * rotation angle (radians), 3 values

rotationMatrixFromAxisAngle( (planningutils)axis, (float)angle) -> object

openravepy.examples.qtserverprocess.rotationMatrixFromQArray((planningutils)quatarray) → object :

Converts an array of quaternions to a list of 3x3 rotation matrices.

Parameters:quatarray – nx4 array
openravepy.examples.qtserverprocess.rotationMatrixFromQuat((planningutils)quat) → object :

RaveTransformMatrix < T > matrixFromQuat(const RaveVector < T > & quat)

Converts a quaternion to a 3x3 matrix.

quat -
quaternion, (s,vx,vy,vz)[source]

Command-line execution of the example.

Parameters:args – arguments for script to parse, if not specified will use sys.argv
openravepy.examples.qtserverprocess.transformLookat((planningutils)lookat, (planningutils)camerapos, (planningutils)cameraup) → object :

Returns a camera matrix that looks along a ray with a desired up vector.

  • lookat – unit axis, 3 values
  • camerapos – 3 values
  • cameraup – unit axis, 3 values


Having problems with OpenRAVE?