Fawkes API  Fawkes Development Version
fawkes::OpenRaveRobot Class Reference

OpenRAVE Robot class. More...

#include <>>

Public Member Functions

 OpenRaveRobot (fawkes::Logger *logger=0)
 Constructor. More...
 
 OpenRaveRobot (const std::string &filename, fawkes::OpenRaveEnvironmentPtr &env, fawkes::Logger *logger=0)
 Constructor. More...
 
 OpenRaveRobot (const fawkes::OpenRaveRobot &src, const fawkes::OpenRaveEnvironmentPtr &new_env)
 Copy Constructor. More...
 
virtual ~OpenRaveRobot ()
 Destructor. More...
 
virtual void load (const std::string &filename, fawkes::OpenRaveEnvironmentPtr &env)
 Load robot from xml file. More...
 
virtual void set_ready ()
 Set robot ready for usage. More...
 
virtual void set_offset (float trans_x, float trans_y, float trans_z)
 Directly set transition offset between coordinate systems of real device and OpenRAVE model. More...
 
virtual void calibrate (float device_trans_x, float device_trans_y, float device_trans_z)
 Calculate transition offset between coordinate systems of real device and OpenRAVE model. More...
 
virtual void set_manipulator (fawkes::OpenRaveManipulatorPtr &manip, bool display_movements=false)
 Set pointer to OpenRaveManipulator object. More...
 
virtual void update_manipulator ()
 Update motor values from OpenRAVE model. More...
 
virtual void update_model ()
 Update/Set OpenRAVE motor angles. More...
 
virtual bool attach_object (OpenRAVE::KinBodyPtr object, const char *manip_name=NULL)
 Attach a kinbody to the robot. More...
 
virtual bool attach_object (const char *name, fawkes::OpenRaveEnvironmentPtr &env, const char *manip_name=NULL)
 Attach a kinbody to the robot. More...
 
virtual bool release_object (OpenRAVE::KinBodyPtr object)
 Release a kinbody from the robot. More...
 
virtual bool release_object (const std::string &name, fawkes::OpenRaveEnvironmentPtr &env)
 Release a kinbody from the robot. More...
 
virtual bool release_all_objects ()
 Release all grabbed kinbodys from the robot. More...
 
virtual bool set_target_rel (float trans_x, float trans_y, float trans_z, bool is_extension=false)
 Set target, given relative transition. More...
 
virtual bool set_target_straight (float trans_x, float trans_y, float trans_z)
 Set target for a straight movement, given transition. More...
 
virtual bool set_target_quat (float trans_x, float trans_y, float trans_z, float quat_w, float quat_x, float quat_y, float quat_z, OpenRAVE::IkFilterOptions filter=OpenRAVE::IKFO_CheckEnvCollisions, bool no_offset=false)
 Set target, given transition, and rotation as quaternion. More...
 
virtual bool set_target_axis_angle (float trans_x, float trans_y, float trans_z, float angle, float axisX, float axisY, float axisZ, OpenRAVE::IkFilterOptions filter=OpenRAVE::IKFO_CheckEnvCollisions, bool no_offset=false)
 Set target, given transition, and rotation as axis-angle. More...
 
virtual bool set_target_euler (euler_rotation_t type, float trans_x, float trans_y, float trans_z, float phi, float theta, float psi, OpenRAVE::IkFilterOptions filter=OpenRAVE::IKFO_CheckEnvCollisions, bool no_offset=false)
 Set target, given transition, and Euler-rotation. More...
 
virtual bool set_target_object_position (float trans_x, float trans_y, float trans_z, float rot_x, OpenRAVE::IkFilterOptions filter=OpenRAVE::IKFO_CheckEnvCollisions)
 Set target by giving position of an object. More...
 
virtual bool set_target_ikparam (OpenRAVE::IkParameterization ik_param, OpenRAVE::IkFilterOptions filter=OpenRAVE::IKFO_CheckEnvCollisions)
 Set target by giving IkParameterizaion of target. More...
 
virtual void set_target_plannerparams (std::string &params)
 Set additional planner parameters. More...
 
virtual void set_target_plannerparams (const char *params)
 Set additional planner parameters. More...
 
virtual void set_target_raw (std::string &cmd)
 Set raw command for BaseManipulation module. More...
 
virtual void set_target_raw (const char *cmd)
 Set raw command for BaseManipulation module. More...
 
virtual void set_target_angles (std::vector< float > &angles)
 Set target angles directly. More...
 
virtual void enable_ik_comparison (bool enable)
 Activate/Deactive IK comparison. More...
 
virtual OpenRAVE::RobotBasePtr get_robot_ptr () const
 Returns RobotBasePtr for uses in other classes. More...
 
virtual target_t get_target () const
 Get target. More...
 
virtual OpenRaveManipulatorPtr get_manipulator () const
 Get manipulator. More...
 
virtual OpenRAVE::PlannerBase::PlannerParametersPtr get_planner_params () const
 Updates planner parameters and return pointer to it. More...
 
virtual std::vector< std::vector< OpenRAVE::dReal > > * get_trajectory () const
 Return pointer to trajectory of motion from __manip to __target.manip with OpenRAVE-model angle format. More...
 
virtual std::vector< std::vector< float > > * get_trajectory_device () const
 Return pointer to trajectory of motion from __manip to __target.manip with device angle format. More...
 
virtual bool display_planned_movements () const
 Getter for __display_planned_movements. More...
 
virtual OpenRAVE::ModuleBasePtr get_basemanip () const
 Return BaseManipulation Module-Pointer. More...
 

Detailed Description

OpenRAVE Robot class.

Class handling interaction with the OpenRAVE::RobotBase class.

This class mainly handles robot specific tasks, like setting a target, looking for IK solutions and handling planning parameters for the robot.

Author
Bahram Maleki-Fard

Definition at line 39 of file robot.h.

Constructor & Destructor Documentation

◆ OpenRaveRobot() [1/3]

fawkes::OpenRaveRobot::OpenRaveRobot ( fawkes::Logger logger = 0)

Constructor.

Parameters
loggerpointer to fawkes logger

Definition at line 48 of file robot.cpp.

◆ OpenRaveRobot() [2/3]

fawkes::OpenRaveRobot::OpenRaveRobot ( const std::string &  filename,
fawkes::OpenRaveEnvironmentPtr env,
fawkes::Logger logger = 0 
)

Constructor.

Parameters
filenamepath to robot's xml file
envpointer to OpenRaveEnvironment object
loggerpointer to fawkes logger

Definition at line 61 of file robot.cpp.

References load().

◆ OpenRaveRobot() [3/3]

fawkes::OpenRaveRobot::OpenRaveRobot ( const fawkes::OpenRaveRobot src,
const fawkes::OpenRaveEnvironmentPtr new_env 
)

Copy Constructor.

Parameters
srcThe OpenRaveRobot to clone
new_envPointer to the new OpenRaveEnvironment. We need this to set __robot to the correct robot in the new OpenRAVE-environment.

Definition at line 76 of file robot.cpp.

References fawkes::OpenRaveManipulator::copy(), get_manipulator(), get_robot_ptr(), fawkes::Logger::log_debug(), fawkes::target_t::manip, and set_ready().

◆ ~OpenRaveRobot()

fawkes::OpenRaveRobot::~OpenRaveRobot ( )
virtual

Destructor.

Definition at line 120 of file robot.cpp.

References fawkes::Logger::log_warn(), and fawkes::target_t::manip.

Member Function Documentation

◆ attach_object() [1/2]

bool fawkes::OpenRaveRobot::attach_object ( OpenRAVE::KinBodyPtr  object,
const char *  manip_name = NULL 
)
virtual

Attach a kinbody to the robot.

Parameters
objectKinbodyPtr of object to be attached
manip_namename of the manipulator to attach the object to. If non given, the currently active manipulator is taken.
Returns
true if successful

Definition at line 727 of file robot.cpp.

References fawkes::Logger::log_warn().

Referenced by attach_object().

◆ attach_object() [2/2]

bool fawkes::OpenRaveRobot::attach_object ( const char *  name,
fawkes::OpenRaveEnvironmentPtr env,
const char *  manip_name = NULL 
)
virtual

Attach a kinbody to the robot.

Parameters
namename of the object
envpointer to OpenRaveEnvironment object
manip_namename of the manipulator to attach the object to
Returns
true if successful

Definition at line 764 of file robot.cpp.

References attach_object().

◆ calibrate()

void fawkes::OpenRaveRobot::calibrate ( float  device_trans_x,
float  device_trans_y,
float  device_trans_z 
)
virtual

Calculate transition offset between coordinate systems of real device and OpenRAVE model.

Sets model's angles to current device's angles (from __manip), and compares transitions.

Parameters
device_trans_xtransition on x-axis (real device)
device_trans_ytransition on y-axis (real device)
device_trans_ztransition on z-axis (real device)

Definition at line 260 of file robot.cpp.

References fawkes::OpenRaveManipulator::get_angles().

◆ display_planned_movements()

bool fawkes::OpenRaveRobot::display_planned_movements ( ) const
virtual

Getter for __display_planned_movements.

Returns
return value

Definition at line 317 of file robot.cpp.

◆ enable_ik_comparison()

void fawkes::OpenRaveRobot::enable_ik_comparison ( bool  enable)
virtual

Activate/Deactive IK comparison.

When activated, we don't just take the first returned IK solution, but compare them all to find the best, i.e. the one that is "closest" to our current configuration.

Parameters
enableSets the state of the comparison. Enabled by default.

Definition at line 329 of file robot.cpp.

◆ get_basemanip()

OpenRAVE::ModuleBasePtr fawkes::OpenRaveRobot::get_basemanip ( ) const
virtual

Return BaseManipulation Module-Pointer.

Returns
ModuleBasePtr

Definition at line 713 of file robot.cpp.

◆ get_manipulator()

OpenRaveManipulatorPtr fawkes::OpenRaveRobot::get_manipulator ( ) const
virtual

Get manipulator.

Returns
pointer to currentl used OpenRaveManipulator

Definition at line 656 of file robot.cpp.

Referenced by OpenRaveRobot().

◆ get_planner_params()

OpenRAVE::PlannerBase::PlannerParametersPtr fawkes::OpenRaveRobot::get_planner_params ( ) const
virtual

Updates planner parameters and return pointer to it.

Returns
PlannerParametersPtr or robot's planner params

Definition at line 665 of file robot.cpp.

References fawkes::OpenRaveManipulator::get_angles(), and fawkes::target_t::manip.

◆ get_robot_ptr()

OpenRAVE::RobotBasePtr fawkes::OpenRaveRobot::get_robot_ptr ( ) const
virtual

Returns RobotBasePtr for uses in other classes.

Returns
RobotBasePtr of current robot

Definition at line 638 of file robot.cpp.

Referenced by OpenRaveRobot().

◆ get_target()

target_t fawkes::OpenRaveRobot::get_target ( ) const
virtual

Get target.

Returns
target struct

Definition at line 647 of file robot.cpp.

◆ get_trajectory()

std::vector< std::vector< dReal > > * fawkes::OpenRaveRobot::get_trajectory ( ) const
virtual

Return pointer to trajectory of motion from __manip to __target.manip with OpenRAVE-model angle format.

Returns
pointer to trajectory

Definition at line 685 of file robot.cpp.

◆ get_trajectory_device()

std::vector< std::vector< float > > * fawkes::OpenRaveRobot::get_trajectory_device ( ) const
virtual

Return pointer to trajectory of motion from __manip to __target.manip with device angle format.

Returns
pointer to trajectory

Definition at line 695 of file robot.cpp.

References fawkes::OpenRaveManipulator::angles_or_to_device().

◆ load()

void fawkes::OpenRaveRobot::load ( const std::string &  filename,
fawkes::OpenRaveEnvironmentPtr env 
)
virtual

Load robot from xml file.

Parameters
filenamepath to robot's xml file
envpointer to OpenRaveEnvironment object

Definition at line 178 of file robot.cpp.

References fawkes::Logger::log_debug().

Referenced by OpenRaveRobot().

◆ release_all_objects()

◆ release_object() [1/2]

bool fawkes::OpenRaveRobot::release_object ( OpenRAVE::KinBodyPtr  object)
virtual

Release a kinbody from the robot.

Parameters
objectKinbodyPtr of object to be released
Returns
true if successful

Definition at line 780 of file robot.cpp.

References fawkes::Logger::log_warn().

Referenced by release_object().

◆ release_object() [2/2]

bool fawkes::OpenRaveRobot::release_object ( const std::string &  name,
fawkes::OpenRaveEnvironmentPtr env 
)
virtual

Release a kinbody from the robot.

Parameters
namename of the object
envpointer to OpenRaveEnvironment object
Returns
true if successful

Definition at line 799 of file robot.cpp.

References release_object().

◆ set_manipulator()

void fawkes::OpenRaveRobot::set_manipulator ( fawkes::OpenRaveManipulatorPtr manip,
bool  display_movements = false 
)
virtual

Set pointer to OpenRaveManipulator object.

Make sure this is called AFTER all manipulator settings have been set (assures that __target.manip has the same settings).

Parameters
manippointer to OpenRaveManipulator object
display_movementstrue, if movements should be displayed in viewer. Better be "false" if want to sync OpenRAVE models with device

Definition at line 284 of file robot.cpp.

References fawkes::OpenRaveManipulator::copy(), and fawkes::target_t::manip.

◆ set_offset()

void fawkes::OpenRaveRobot::set_offset ( float  trans_x,
float  trans_y,
float  trans_z 
)
virtual

Directly set transition offset between coordinate systems of real device and OpenRAVE model.

Parameters
trans_xtransition offset on x-axis
trans_ytransition offset on y-axis
trans_ztransition offset on z-axis

Definition at line 244 of file robot.cpp.

◆ set_ready()

void fawkes::OpenRaveRobot::set_ready ( )
virtual

Set robot ready for usage.

Here: Set active DOFs and create plannerParameters. CAUTION: Only successful after added to environment. Otherwise no active DOF will be recognized.

Definition at line 200 of file robot.cpp.

References fawkes::Logger::log_debug().

Referenced by OpenRaveRobot().

◆ set_target_angles()

void fawkes::OpenRaveRobot::set_target_angles ( std::vector< float > &  angles)
virtual

Set target angles directly.

Parameters
anglesvector with angle values

Definition at line 623 of file robot.cpp.

References fawkes::target_t::manip, fawkes::OpenRaveManipulator::set_angles(), fawkes::target_t::solvable, fawkes::TARGET_JOINTS, and fawkes::target_t::type.

◆ set_target_axis_angle()

bool fawkes::OpenRaveRobot::set_target_axis_angle ( float  trans_x,
float  trans_y,
float  trans_z,
float  angle,
float  axisX,
float  axisY,
float  axisZ,
OpenRAVE::IkFilterOptions  filter = OpenRAVE::IKFO_CheckEnvCollisions,
bool  no_offset = false 
)
virtual

Set target, given transition, and rotation as axis-angle.

Parameters
trans_xx-transition
trans_yy-transition
trans_zz-transition
angleaxis-angle angle
axisXaxis-angle x-axis value
axisYaxis-angle y-axis value
axisZaxis-angle z-axis value
filterIK filter options (see OpenRAVE doc for details)
no_offsetif true, do not include manipulator offset (default: false)
Returns
true if solvable, false otherwise

Definition at line 420 of file robot.cpp.

◆ set_target_euler()

bool fawkes::OpenRaveRobot::set_target_euler ( euler_rotation_t  type,
float  trans_x,
float  trans_y,
float  trans_z,
float  phi,
float  theta,
float  psi,
OpenRAVE::IkFilterOptions  filter = OpenRAVE::IKFO_CheckEnvCollisions,
bool  no_offset = false 
)
virtual

Set target, given transition, and Euler-rotation.

Parameters
typeEuler-rotation type (ZXZ, ZYZ, ...)
trans_xx-transition
trans_yy-transition
trans_zz-transition
phi1st rotation
theta2nd rotation
psi3rd rotation
filterIK filter options (see OpenRAVE doc for details)
no_offsetif true, do not include manipulator offset (default: false)
Returns
true if solvable, false otherwise

Definition at line 444 of file robot.cpp.

References fawkes::EULER_ZXZ, fawkes::EULER_ZYX, fawkes::EULER_ZYZ, fawkes::Logger::log_debug(), fawkes::target_t::solvable, fawkes::TARGET_NONE, and fawkes::target_t::type.

Referenced by release_all_objects().

◆ set_target_ikparam()

bool fawkes::OpenRaveRobot::set_target_ikparam ( OpenRAVE::IkParameterization  ik_param,
OpenRAVE::IkFilterOptions  filter = OpenRAVE::IKFO_CheckEnvCollisions 
)
virtual

Set target by giving IkParameterizaion of target.

OpenRAVE::IkParameterization is the desired type to be calculated with by OpenRAVE. Each oter type (i.e. Transform) is implicitly transformed to an IkParameterization before continuing to check for Ik solution and planning, i.e. by the BaseManipulation module.

Parameters
ik_paramthe OpenRAVE::IkParameterization of the target
filterIK filter options (see OpenRAVE doc for details)
Returns
true if solvable, false otherwise

Definition at line 561 of file robot.cpp.

References fawkes::target_t::ikparam, fawkes::target_t::solvable, fawkes::TARGET_IKPARAM, and fawkes::target_t::type.

Referenced by release_all_objects().

◆ set_target_object_position()

bool fawkes::OpenRaveRobot::set_target_object_position ( float  trans_x,
float  trans_y,
float  trans_z,
float  rot_x,
OpenRAVE::IkFilterOptions  filter = OpenRAVE::IKFO_CheckEnvCollisions 
)
virtual

Set target by giving position of an object.

Currently the object should be cylindric, and stand upright. It may also be rotated on its x-axis, but that rotation needs to be given in an argument to calculate correct position for end-effector. This is only temporary until proper grasp planning for 5DOF in OpenRAVE is provided.

Parameters
trans_xx-transition of object
trans_yy-transition of object
trans_zz-transition of object
rot_xrotation of object on x-axis (radians) (default: 0.f, i.e. upright)
filterIK filter options (see OpenRAVE doc for details)
Returns
true if solvable, false otherwise

Definition at line 499 of file robot.cpp.

◆ set_target_plannerparams() [1/2]

void fawkes::OpenRaveRobot::set_target_plannerparams ( std::string &  params)
virtual

Set additional planner parameters.

BaseManipulation module accepts many arguments that can be passed. Planner parameters can be important to plan a path according to ones needs, e.g. set deviations, optimizer iterations, etc. Do not mistake it with the single argument "plannerparams" of BaseManipulation.

Parameters
paramscomplete string of additional arguments.

Definition at line 581 of file robot.cpp.

References fawkes::target_t::plannerparams.

◆ set_target_plannerparams() [2/2]

void fawkes::OpenRaveRobot::set_target_plannerparams ( const char *  params)
virtual

Set additional planner parameters.

Parameters
paramscomplete string of additional arguments.

Definition at line 590 of file robot.cpp.

References fawkes::target_t::plannerparams.

◆ set_target_quat()

bool fawkes::OpenRaveRobot::set_target_quat ( float  trans_x,
float  trans_y,
float  trans_z,
float  quat_w,
float  quat_x,
float  quat_y,
float  quat_z,
OpenRAVE::IkFilterOptions  filter = OpenRAVE::IKFO_CheckEnvCollisions,
bool  no_offset = false 
)
virtual

Set target, given transition, and rotation as quaternion.

Parameters
trans_xx-transition
trans_yy-transition
trans_zz-transition
quat_wquaternion skalar
quat_xquaternion 1st value
quat_yquaternion 2nd value
quat_zquaternion 3rd value
filterIK filter options (see OpenRAVE doc for details)
no_offsetif true, do not include manipulator offset (default: false)
Returns
true if solvable, false otherwise

Definition at line 397 of file robot.cpp.

◆ set_target_raw() [1/2]

void fawkes::OpenRaveRobot::set_target_raw ( std::string &  cmd)
virtual

Set raw command for BaseManipulation module.

BaseManipulation module accepts many arguments that can be passed. Basic commands are covered by the other set_target_ methods. In case something is not covered, or you want to send a custom command, use this method. Remember that plannerparams set by "set_target_plannerparams" are still added to the planner, so make sure you don't send duplicate entries both in plannerparams and in the raw command string.

Parameters
cmdcomplete command string.

Definition at line 605 of file robot.cpp.

References fawkes::target_t::raw_cmd.

◆ set_target_raw() [2/2]

void fawkes::OpenRaveRobot::set_target_raw ( const char *  cmd)
virtual

Set raw command for BaseManipulation module.

Parameters
cmdcomplete command string.

Definition at line 614 of file robot.cpp.

References fawkes::target_t::raw_cmd.

◆ set_target_rel()

bool fawkes::OpenRaveRobot::set_target_rel ( float  trans_x,
float  trans_y,
float  trans_z,
bool  is_extension = false 
)
virtual

Set target, given relative transition.

This is the prefered method to set a target for straight manipulator movement.

Parameters
trans_xx-transition
trans_yy-transition
trans_zz-transition
is_extensiontrue, if base coordination system lies in arm extension
Returns
true if solvable, false otherwise

Definition at line 343 of file robot.cpp.

References fawkes::target_t::solvable, fawkes::TARGET_RELATIVE, fawkes::TARGET_RELATIVE_EXT, fawkes::target_t::type, fawkes::target_t::x, fawkes::target_t::y, and fawkes::target_t::z.

Referenced by set_target_straight().

◆ set_target_straight()

bool fawkes::OpenRaveRobot::set_target_straight ( float  trans_x,
float  trans_y,
float  trans_z 
)
virtual

Set target for a straight movement, given transition.

This is the a wrapper for "set_target_rel", to be able to call for a straight arm movement by giving non-relative transition.

Parameters
trans_xx-transition
trans_yy-transition
trans_zz-transition
Returns
true if solvable, false otherwise

Definition at line 370 of file robot.cpp.

References set_target_rel().

◆ update_manipulator()

void fawkes::OpenRaveRobot::update_manipulator ( )
virtual

Update motor values from OpenRAVE model.

Can be used to sync real device with OpenRAVE model

Definition at line 295 of file robot.cpp.

References fawkes::OpenRaveManipulator::set_angles().

◆ update_model()

void fawkes::OpenRaveRobot::update_model ( )
virtual

Update/Set OpenRAVE motor angles.

Definition at line 305 of file robot.cpp.

References fawkes::OpenRaveManipulator::get_angles().


The documentation for this class was generated from the following files: