Visual Servoing Platform
version 3.0.1
|
#include <visp3/robot/vpVirtuose.h>
Public Member Functions | |
vpVirtuose () | |
~vpVirtuose () | |
void | addForce (vpColVector &force) |
void | enableForceFeedback (int enable) |
vpColVector | getArticularPosition () const |
vpColVector | getArticularVelocity () const |
vpPoseVector | getAvatarPosition () const |
vpPoseVector | getBaseFrame () const |
VirtCommandType | getCommandType () const |
bool | getDeadMan () const |
bool | getEmergencyStop () const |
vpColVector | getForce () const |
VirtContext | getHandler () |
vpPoseVector | getObservationFrame () const |
vpPoseVector | getPhysicalPosition () const |
vpColVector | getPhysicalVelocity () const |
vpPoseVector | getPosition () const |
bool | getPower () const |
vpColVector | getVelocity () const |
void | init () |
void | setArticularForce (const vpColVector &articularForce) |
void | setArticularPosition (const vpColVector &articularPosition) |
void | setArticularVelocity (const vpColVector &articularVelocity) |
void | setBaseFrame (const vpPoseVector &position) |
void | setCommandType (const VirtCommandType &type) |
void | setForce (const vpColVector &force) |
void | setForceFactor (const float &forceFactor) |
void | setIndexingMode (const VirtIndexingType &type) |
void | setIpAddress (const std::string &ip) |
void | setObservationFrame (const vpPoseVector &position) |
void | setPeriodicFunction (VirtPeriodicFunction CallBackVirt) |
void | setPosition (vpPoseVector &position) |
void | setPowerOff () |
void | setPowerOn () |
void | setSaturation (const float &forceLimit, const float &torqueLimit) |
void | setTimeStep (const float &timeStep) |
void | setVelocity (vpColVector &velocity) |
void | setVelocityFactor (const float &velocityFactor) |
void | setVerbose (bool mode) |
void | startPeriodicFunction () |
void | stopPeriodicFunction () |
Protected Attributes | |
VirtContext | m_virtContext |
std::string | m_ip |
bool | m_verbose |
int | m_apiMajorVersion |
int | m_apiMinorVersion |
int | m_ctrlMajorVersion |
int | m_ctrlMinorVersion |
VirtCommandType | m_typeCommand |
VirtIndexingType | m_indexType |
bool | m_is_init |
float | m_period |
This class was tested with Haption (http://www.haption.com) Virtuose 6D haptic device.
The class vpVirtuose allows to work with the original Virtuose API inside ViSP. The Virtuose API supports the following devices:
Not all Virtuose API function are implemented in the class. Original Virtuose API functions need to be called with a VirtContext object, provided by the function getHandler().
The Virtuose library implements different control modes that could be set using setCommandType(). The choice of the control mode depends on the application. The following is the description of the main control modes as described in the Virtuose API documentation.
The Virtuose library defines the following reference frames:
The position of the following frames can be defined only once using the API: base frame (with respect to the observation frame) thanks to setBaseFrame() and end-effector frame (with respect to the tool frame).
The position of the observation frame (with respect to the environment frame) can be modified dynamically using setObservationFrame().
The position of the tool frame (with respect to the environment frame) cannot be modified.
All values used in the Virtuose API are expressed in physical units using metric conventions:
The following sample code shows how to connect to the haptic device to get its current joint position:
Definition at line 133 of file vpVirtuose.h.
vpVirtuose::vpVirtuose | ( | ) |
Default constructor. Set command type to virtual mechanism by default (impedance mode). Authorize indexing on all movements by default.
Definition at line 53 of file vpVirtuose.cpp.
References m_apiMajorVersion, and m_apiMinorVersion.
vpVirtuose::~vpVirtuose | ( | ) |
Default destructor that delete the VirtContext object.
Definition at line 67 of file vpVirtuose.cpp.
References m_virtContext.
void vpVirtuose::addForce | ( | vpColVector & | force | ) |
Add a force to be applied to the virtuose (impedance effort). This function works in every mode.
force | : Is 6 component dynamic tensor (three forces and three torques) wrt virtuose end-effector and is expressed in the coordinates of the base frame. |
Definition at line 81 of file vpVirtuose.cpp.
References vpException::dimensionError, vpException::fatalError, init(), m_virtContext, and vpArray2D< Type >::size().
void vpVirtuose::enableForceFeedback | ( | int | enable | ) |
Activate or desactivate force feedback.
enable | : 1 to activate (system's default value), 0 to desactivate. |
Definition at line 106 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
vpColVector vpVirtuose::getArticularPosition | ( | ) | const |
Return the 6 joint values of the virtuose.
Definition at line 120 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
vpColVector vpVirtuose::getArticularVelocity | ( | ) | const |
Return the 6 joint velocities of the virtuose.
Definition at line 145 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
vpPoseVector vpVirtuose::getAvatarPosition | ( | ) | const |
Return the indexed position of the end-effector, expressed in the coordinates of the environment reference frame. With respect to the function getPosition(), getAvatarPosition() takes into account current offsets (indexing) and motor scale factors.
Definition at line 172 of file vpVirtuose.cpp.
References vpPoseVector::buildFrom(), vpException::fatalError, m_is_init, and m_virtContext.
vpPoseVector vpVirtuose::getBaseFrame | ( | ) | const |
Return the current position of the base frame with respect to the observation reference frame.
Definition at line 209 of file vpVirtuose.cpp.
References vpPoseVector::buildFrom(), vpException::fatalError, m_is_init, and m_virtContext.
VirtCommandType vpVirtuose::getCommandType | ( | ) | const |
Return the current command type.
Definition at line 243 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
bool vpVirtuose::getDeadMan | ( | ) | const |
Return the status of DeadMan sensor : true if the sensor is ON (a user is holding the handle) and false if the sensor is OFF (no user detected).
Definition at line 263 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
bool vpVirtuose::getEmergencyStop | ( | ) | const |
Return the status of the emergency stop button : true if the system is operational (button correctly plugged and not triggered) and false if the system is not operational (button not plugged or triggered).
Definition at line 282 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
vpColVector vpVirtuose::getForce | ( | ) | const |
Return the 6-dimension force tensor to be applied to the object attached to the Virtuose, allowing the dynamic simulation of the scene.
Definition at line 301 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
VirtContext vpVirtuose::getHandler | ( | ) |
Return the handler used to communicate with the device. This function could be used to access to a functionality that is not implemented in vpVirtuose class.
The following sample code shows how to use this function to get the device joint positions. This functionality is already implemented in getArticularPosition().
Definition at line 352 of file vpVirtuose.cpp.
References m_virtContext.
vpPoseVector vpVirtuose::getObservationFrame | ( | ) | const |
Return the cartesian current position of the observation reference frame with respect to the environment reference frame.
Definition at line 362 of file vpVirtuose.cpp.
References vpPoseVector::buildFrom(), vpException::fatalError, m_is_init, and m_virtContext.
vpPoseVector vpVirtuose::getPhysicalPosition | ( | ) | const |
Return the cartesian physical position of the Virtuose expressed in the coordinates of the base reference frame.
Definition at line 396 of file vpVirtuose.cpp.
References vpPoseVector::buildFrom(), vpException::fatalError, m_is_init, and m_virtContext.
vpColVector vpVirtuose::getPhysicalVelocity | ( | ) | const |
Return the physical cartesian velocity twist of the Virtuose expressed in the coordinates of the base reference frame.
Definition at line 432 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
vpPoseVector vpVirtuose::getPosition | ( | ) | const |
Return the cartesian position of the virtuose (or the object attached to it, if any) expressed in the coordinates of the environment reference frame.
Definition at line 455 of file vpVirtuose.cpp.
References vpPoseVector::buildFrom(), vpException::fatalError, m_is_init, and m_virtContext.
bool vpVirtuose::getPower | ( | ) | const |
Return status of the motors : true if motors are ON, false otherwise.
Definition at line 488 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
vpColVector vpVirtuose::getVelocity | ( | ) | const |
Return the cartesian velocity twist of the virtuose (or the object attached to it, if any) expressed in the coordinates of the environment reference frame.
Definition at line 505 of file vpVirtuose.cpp.
References vpException::fatalError, m_is_init, and m_virtContext.
void vpVirtuose::init | ( | void | ) |
Initialize virtuose device opening the connection to the device and setting the default command type. If the device is already initialized, a call to init() does nothing.
Definition at line 527 of file vpVirtuose.cpp.
References vpException::fatalError, m_ctrlMajorVersion, m_ctrlMinorVersion, m_ip, m_is_init, m_period, m_typeCommand, m_verbose, and m_virtContext.
Referenced by addForce(), enableForceFeedback(), setArticularForce(), setArticularPosition(), setArticularVelocity(), setBaseFrame(), setCommandType(), setForce(), setForceFactor(), setIndexingMode(), setObservationFrame(), setPeriodicFunction(), setPosition(), setPowerOff(), setPowerOn(), setSaturation(), setTimeStep(), setVelocity(), setVelocityFactor(), startPeriodicFunction(), and stopPeriodicFunction().
void vpVirtuose::setArticularForce | ( | const vpColVector & | articularForce | ) |
Send a command of articular force to the Virtuose. setArticularForce() only works in mode COMMAND_TYPE_ARTICULAR_IMPEDANCE, to be set with setCommandType().
articularForce | : Six dimension torque vector. |
Definition at line 569 of file vpVirtuose.cpp.
References vpException::dimensionError, vpException::fatalError, init(), m_virtContext, and vpArray2D< Type >::size().
void vpVirtuose::setArticularPosition | ( | const vpColVector & | articularPosition | ) |
Send a command of articular (joint) position to the virtuose. This function works only in COMMAND_TYPE_ARTICULAR mode, to be set with setCommandType().
articularPosition | : Six dimension joint position vector. |
Definition at line 595 of file vpVirtuose.cpp.
References vpException::dimensionError, vpException::fatalError, init(), m_virtContext, and vpArray2D< Type >::size().
void vpVirtuose::setArticularVelocity | ( | const vpColVector & | articularVelocity | ) |
Send a command of articular (joint) velocity to the virtuose. This function works only in COMMAND_TYPE_ARTICULAR mode, to be set with setCommandType().
articularVelocity | : Six dimension joint velocity vector. |
Definition at line 621 of file vpVirtuose.cpp.
References vpException::dimensionError, vpException::fatalError, init(), m_virtContext, and vpArray2D< Type >::size().
void vpVirtuose::setBaseFrame | ( | const vpPoseVector & | position | ) |
Move the base frame with respect to the observation reference frame. It can be called at any time.
position | : Position of the base frame. |
Definition at line 649 of file vpVirtuose.cpp.
References vpPoseVector::extract(), vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::setCommandType | ( | const VirtCommandType & | type | ) |
Set the command type.
type | : Possible values:
|
Definition at line 681 of file vpVirtuose.cpp.
References vpException::fatalError, init(), m_typeCommand, and m_virtContext.
void vpVirtuose::setForce | ( | const vpColVector & | force | ) |
Set the force to be applied by the Virtuose. setForce() only works in COMMAND_TYPE_IMPEDANCE mode, to be set with setCommandType().
force | : Force vector that represents a dynamic tensor with 6 components. |
Definition at line 701 of file vpVirtuose.cpp.
References vpException::dimensionError, vpException::fatalError, init(), m_virtContext, and vpArray2D< Type >::size().
void vpVirtuose::setForceFactor | ( | const float & | forceFactor | ) |
Set the force scale factor.
forceFactor | : Force scale factor applied to the force torque tensor set by setForce(). |
Definition at line 726 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::setIndexingMode | ( | const VirtIndexingType & | type | ) |
Set indexing (offset) mode.
type | : Possible choices are:
|
Definition at line 746 of file vpVirtuose.cpp.
References vpException::fatalError, init(), m_indexType, and m_virtContext.
|
inline |
Set haptic device ip address and port. Default value is "localhost#5000".
Definition at line 169 of file vpVirtuose.h.
void vpVirtuose::setObservationFrame | ( | const vpPoseVector & | position | ) |
Move the observation frame with respect to the environment reference frame. It can be called at any time.
position | : Position of the observation frame. |
Definition at line 768 of file vpVirtuose.cpp.
References vpPoseVector::extract(), vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::setPeriodicFunction | ( | VirtPeriodicFunction | CallBackVirt | ) |
Register the periodic function. setPeriodicFunction() defines a callback function to be called at a fixed period of time, as timing for the simulation. The callback function is synchronized with the Virtuose controller (messages arrive at very constant time intervals from it) and generates hardware interrupts to be taken into account by the operating system. In practice, this function is much more efficient for timing the simulation than common software timers. This function is started using startPeriodicFunction() and stopped using stopPeriodicFunction().
CallBackVirt | : Callback function. |
Example of the use of the periodic function:
Definition at line 825 of file vpVirtuose.cpp.
References vpException::fatalError, init(), m_period, and m_virtContext.
void vpVirtuose::setPosition | ( | vpPoseVector & | position | ) |
Modify the current value of the control position and send it to the Virtuose.
position | : Position of the end-effector (or the attached object, if any). |
Definition at line 840 of file vpVirtuose.cpp.
References vpPoseVector::extract(), vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::setPowerOff | ( | ) |
Turn the motor power OFF.
Definition at line 867 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::setPowerOn | ( | ) |
Turn the motor power ON.
Definition at line 881 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::setSaturation | ( | const float & | forceLimit, |
const float & | torqueLimit | ||
) |
Set saturation values of the force feedback
forceLimit | : Value expressed in N. |
torqueLimit | : Value expressed in Nm. |
Definition at line 897 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::setTimeStep | ( | const float & | timeStep | ) |
Set the the simulation time step. The function must be called before the selection of the type of control mode.
timeStep | : Simulation time step (seconds). |
Definition at line 913 of file vpVirtuose.cpp.
References vpException::fatalError, init(), m_period, and m_virtContext.
void vpVirtuose::setVelocity | ( | vpColVector & | velocity | ) |
Modify the current value of the control velocity and send it to the Virtuose.
velocity | : Velocity twist vector, where translations velocities are expressed in m/s and rotation velocities in rad/s. |
Definition at line 933 of file vpVirtuose.cpp.
References vpException::dimensionError, vpException::fatalError, init(), m_virtContext, and vpArray2D< Type >::size().
void vpVirtuose::setVelocityFactor | ( | const float & | velocityFactor | ) |
Set the speed factor.
velocityFactor | : Scale factor applied to the velocities set using setVelocity(). |
Definition at line 958 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
|
inline |
Enable/disable verbose mode.
mode | : true to enable, false to disable verbose. |
Definition at line 183 of file vpVirtuose.h.
void vpVirtuose::startPeriodicFunction | ( | ) |
Start the callback function set with setPeriodicFunction().
Definition at line 974 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
void vpVirtuose::stopPeriodicFunction | ( | ) |
Stop the callback function set with setPeriodicFunction().
Definition at line 992 of file vpVirtuose.cpp.
References vpException::fatalError, init(), and m_virtContext.
|
protected |
Definition at line 192 of file vpVirtuose.h.
Referenced by vpVirtuose().
|
protected |
Definition at line 193 of file vpVirtuose.h.
Referenced by vpVirtuose().
|
protected |
Definition at line 194 of file vpVirtuose.h.
Referenced by init().
|
protected |
Definition at line 195 of file vpVirtuose.h.
Referenced by init().
|
protected |
Definition at line 197 of file vpVirtuose.h.
Referenced by setIndexingMode().
|
protected |
Definition at line 190 of file vpVirtuose.h.
Referenced by init().
|
protected |
Definition at line 198 of file vpVirtuose.h.
Referenced by getArticularPosition(), getArticularVelocity(), getAvatarPosition(), getBaseFrame(), getCommandType(), getDeadMan(), getEmergencyStop(), getForce(), getObservationFrame(), getPhysicalPosition(), getPhysicalVelocity(), getPosition(), getPower(), getVelocity(), and init().
|
protected |
Definition at line 199 of file vpVirtuose.h.
Referenced by init(), setPeriodicFunction(), and setTimeStep().
|
protected |
Definition at line 196 of file vpVirtuose.h.
Referenced by init(), and setCommandType().
|
protected |
Definition at line 191 of file vpVirtuose.h.
Referenced by init().
|
protected |
Definition at line 189 of file vpVirtuose.h.
Referenced by addForce(), enableForceFeedback(), getArticularPosition(), getArticularVelocity(), getAvatarPosition(), getBaseFrame(), getCommandType(), getDeadMan(), getEmergencyStop(), getForce(), getHandler(), getObservationFrame(), getPhysicalPosition(), getPhysicalVelocity(), getPosition(), getPower(), getVelocity(), init(), setArticularForce(), setArticularPosition(), setArticularVelocity(), setBaseFrame(), setCommandType(), setForce(), setForceFactor(), setIndexingMode(), setObservationFrame(), setPeriodicFunction(), setPosition(), setPowerOff(), setPowerOn(), setSaturation(), setTimeStep(), setVelocity(), setVelocityFactor(), startPeriodicFunction(), stopPeriodicFunction(), and ~vpVirtuose().