Visual Servoing Platform  version 3.3.0

#include <vpRobotCamera.h>

+ Inheritance diagram for vpRobotCamera:

Public Types

enum  vpRobotStateType {
  STATE_STOP, STATE_VELOCITY_CONTROL, STATE_POSITION_CONTROL, STATE_ACCELERATION_CONTROL,
  STATE_FORCE_TORQUE_CONTROL
}
 
enum  vpControlFrameType {
  REFERENCE_FRAME, ARTICULAR_FRAME, JOINT_STATE = ARTICULAR_FRAME, END_EFFECTOR_FRAME,
  CAMERA_FRAME, TOOL_FRAME = CAMERA_FRAME, MIXT_FRAME
}
 

Public Member Functions

 vpRobotCamera ()
 
virtual ~vpRobotCamera ()
 

Protected Attributes

vpHomogeneousMatrix cMw_
 
double delta_t_
 
double maxTranslationVelocity
 
double maxRotationVelocity
 
int nDof
 
vpMatrix eJe
 
int eJeAvailable
 
vpMatrix fJe
 
int fJeAvailable
 
int areJointLimitsAvailable
 
double * qmin
 
double * qmax
 
bool verbose_
 

Static Protected Attributes

static const double maxTranslationVelocityDefault = 0.2
 
static const double maxRotationVelocityDefault = 0.7
 

Inherited functionalities from vpRobot

double getMaxTranslationVelocity (void) const
 
double getMaxRotationVelocity (void) const
 
vpColVector getPosition (const vpRobot::vpControlFrameType frame)
 
virtual vpRobotStateType getRobotState (void) const
 
void setMaxRotationVelocity (double maxVr)
 
void setMaxTranslationVelocity (double maxVt)
 
virtual vpRobotStateType setRobotState (const vpRobot::vpRobotStateType newState)
 
void setVerbose (bool verbose)
 

Inherited functionalities from vpRobotCamera

void get_cVe (vpVelocityTwistMatrix &cVe) const
 
void get_eJe (vpMatrix &eJe)
 
void getPosition (vpHomogeneousMatrix &cMw) const
 
void getPosition (const vpRobot::vpControlFrameType frame, vpColVector &q)
 
void setPosition (const vpHomogeneousMatrix &cMw)
 
void setVelocity (const vpRobot::vpControlFrameType frame, const vpColVector &v)
 

Inherited functionalities from vpRobotSimulator

double getSamplingTime () const
 
virtual void setSamplingTime (const double &delta_t)
 

Detailed Description

Class that defines the simplest robot: a free flying camera. We recommend to use vpSimulatorCamera instead.

Deprecated:
This class is deprecated since ViSP 3.0.0.

This free flying camera has 6 dof; 3 in translation and 3 in rotation. It evolves as a gantry robot with respect to a world frame. This class is similar to vpSimulatorCamera class except that here the position of the robot is provided as the transformation from camera frame to world frame; cMw. Since the position of the camera frame evolves, this representation is less intuitive than the one implemented in vpSimulatorCamera where the transformation from world to camera frame is considered; wMc.

For this particular simulated robot, the end-effector and camera frame are confused. That means that the cMe transformation is equal to identity.

The robot jacobian expressed in the end-effector frame $ {^e}{\bf J}_e $ is also set to identity (see get_eJe()).

The following code shows how to control this robot in position and velocity.

#include <visp3/robot/vpRobotCamera.h>
int main()
{
robot.getPosition(cMw); // Position of the world frame in the camera frame
std::cout << "Default position of the world frame in the camera frame cMw:\n" << cMw << std::endl;
cMw[2][3] = 1.; // World frame is 1 meter along z axis in front of the camera frame
robot.setPosition(cMw); // Set the new position of the world frame in the camera frame
std::cout << "New position of the world frame in the camera frame cMw:\n" << cMw << std::endl;
robot.setSamplingTime(0.100); // Modify the default sampling time to 0.1 second
robot.setMaxTranslationVelocity(1.); // vx, vy and vz max set to 1 m/s
robot.setMaxRotationVelocity(vpMath::rad(90)); // wx, wy and wz max set to 90 deg/s
v = 0;
v[2] = 1.; // set v_z to 1 m/s
// The robot has moved from 0.1 meters along the z axis
robot.getPosition(cMw); // Position of the world frame in the camera frame
std::cout << "New position of the camera cMw:\n" << cMw << std::endl;
}

Definition at line 110 of file vpRobotCamera.h.

Member Enumeration Documentation

◆ vpControlFrameType

Robot control frames.

Enumerator
REFERENCE_FRAME 

Corresponds to a fixed reference frame attached to the robot structure.

ARTICULAR_FRAME 

Corresponds to the joint state. This value is deprecated. You should rather use vpRobot::JOINT_STATE.

JOINT_STATE 

Corresponds to the joint state.

END_EFFECTOR_FRAME 

Corresponds to robot end-effector frame.

CAMERA_FRAME 

Corresponds to a frame attached to the camera mounted on the robot end-effector.

TOOL_FRAME 

Corresponds to a frame attached to the tool (camera, gripper...) mounted on the robot end-effector. This value is equal to vpRobot::CAMERA_FRAME.

MIXT_FRAME 

Corresponds to a "virtual" frame where translations are expressed in the reference frame, and rotations in the camera frame.

Definition at line 75 of file vpRobot.h.

◆ vpRobotStateType

enum vpRobot::vpRobotStateType
inherited

Robot control states.

Enumerator
STATE_STOP 

Stops robot motion especially in velocity and acceleration control.

STATE_VELOCITY_CONTROL 

Initialize the velocity controller.

STATE_POSITION_CONTROL 

Initialize the position controller.

STATE_ACCELERATION_CONTROL 

Initialize the acceleration controller.

STATE_FORCE_TORQUE_CONTROL 

Initialize the force/torque controller.

Definition at line 64 of file vpRobot.h.

Constructor & Destructor Documentation

◆ vpRobotCamera()

vpRobotCamera::vpRobotCamera ( )

Constructor.

Initialise the robot by a call to init().

Sampling time is set to 40 ms. To change it you should call setSamplingTime().

Robot jacobian expressed in the end-effector frame $ {^e}{\bf J}_e $ is set to identity (see get_eJe()).

robot.setSamplingTime(0.020); // Set the sampling time to 20 ms.

Definition at line 72 of file vpRobotCamera.cpp.

◆ ~vpRobotCamera()

vpRobotCamera::~vpRobotCamera ( )
virtual

Destructor.

Definition at line 99 of file vpRobotCamera.cpp.

Member Function Documentation

◆ get_cVe()

void vpRobotCamera::get_cVe ( vpVelocityTwistMatrix cVe) const

Get the twist transformation from camera frame to end-effector frame. This transformation allows to compute a velocity expressed in the end-effector frame into the camera frame.

Parameters
cVe: Twist transformation. Here this transformation is equal to identity since camera frame and end-effector frame are at the same location.

Definition at line 111 of file vpRobotCamera.cpp.

◆ get_eJe()

void vpRobotCamera::get_eJe ( vpMatrix eJe_)
virtual

Get the robot jacobian expressed in the end-effector frame. For that simple robot the Jacobian is the identity.

Parameters
eJe_: A 6 by 6 matrix representing the robot jacobian $ {^e}{\bf J}_e$ expressed in the end-effector frame.

Implements vpRobot.

Definition at line 124 of file vpRobotCamera.cpp.

References vpRobot::eJe.

◆ getMaxRotationVelocity()

◆ getMaxTranslationVelocity()

◆ getPosition() [1/3]

vpColVector vpRobot::getPosition ( const vpRobot::vpControlFrameType  frame)
inherited

Return the current robot position in the specified frame.

Definition at line 216 of file vpRobot.cpp.

References vpRobot::getPosition().

◆ getPosition() [2/3]

void vpRobotCamera::getPosition ( const vpRobot::vpControlFrameType  frame,
vpColVector q 
)
virtual

◆ getPosition() [3/3]

void vpRobotCamera::getPosition ( vpHomogeneousMatrix cMw) const

Get the robot position as the transformation from camera frame to world frame.

Definition at line 189 of file vpRobotCamera.cpp.

References cMw_.

◆ getRobotFrame()

vpControlFrameType vpRobot::getRobotFrame ( void  ) const
inlineprotectedinherited

◆ getRobotState()

virtual vpRobotStateType vpRobot::getRobotState ( void  ) const
inlinevirtualinherited

◆ getSamplingTime()

◆ saturateVelocities()

vpColVector vpRobot::saturateVelocities ( const vpColVector v_in,
const vpColVector v_max,
bool  verbose = false 
)
staticinherited

Saturate velocities.

Parameters
v_in: Vector of input velocities to saturate. Translation velocities should be expressed in m/s while rotation velocities in rad/s.
v_max: Vector of maximal allowed velocities. Maximal translation velocities should be expressed in m/s while maximal rotation velocities in rad/s.
verbose: Print a message indicating which axis causes the saturation.
Returns
Saturated velocities.
Exceptions
vpRobotException::dimensionError: If the input vectors have different dimensions.

The code below shows how to use this static method in order to saturate a velocity skew vector.

#include <iostream>
#include <visp3/robot/vpRobot.h>
int main()
{
// Set a velocity skew vector
v[0] = 0.1; // vx in m/s
v[1] = 0.2; // vy
v[2] = 0.3; // vz
v[3] = vpMath::rad(10); // wx in rad/s
v[4] = vpMath::rad(-10); // wy
v[5] = vpMath::rad(20); // wz
// Set the maximal allowed velocities
vpColVector v_max(6);
for (int i=0; i<3; i++)
v_max[i] = 0.3; // in translation (m/s)
for (int i=3; i<6; i++)
v_max[i] = vpMath::rad(10); // in rotation (rad/s)
// Compute the saturated velocity skew vector
vpColVector v_sat = vpRobot::saturateVelocities(v, v_max, true);
std::cout << "v : " << v.t() << std::endl;
std::cout << "v max: " << v_max.t() << std::endl;
std::cout << "v sat: " << v_sat.t() << std::endl;
return 0;
}

Definition at line 163 of file vpRobot.cpp.

References vpException::dimensionError, and vpArray2D< Type >::size().

Referenced by vpRobotTemplate::setVelocity(), vpSimulatorCamera::setVelocity(), setVelocity(), vpSimulatorPioneer::setVelocity(), vpRobotPioneer::setVelocity(), vpSimulatorPioneerPan::setVelocity(), vpRobotFlirPtu::setVelocity(), vpRobotAfma4::setVelocity(), vpRobotAfma6::setVelocity(), vpRobotFranka::setVelocity(), vpRobotViper650::setVelocity(), and vpRobotViper850::setVelocity().

◆ setMaxRotationVelocity()

void vpRobot::setMaxRotationVelocity ( double  w_max)
inherited

Set the maximal rotation velocity that can be sent to the robot during a velocity control.

Parameters
w_max: Maximum rotational velocity expressed in rad/s.
Examples
servoMomentPoints.cpp, servoSimu4Points.cpp, servoSimuSphere.cpp, testFeatureSegment.cpp, testFrankaJointVelocityLimits.cpp, and testRobotFlirPtu.cpp.

Definition at line 260 of file vpRobot.cpp.

References vpRobot::maxRotationVelocity.

Referenced by vpRobotViper650::setMaxRotationVelocity(), vpRobotViper850::setMaxRotationVelocity(), and vpSimulatorAfma6::setPosition().

◆ setMaxTranslationVelocity()

void vpRobot::setMaxTranslationVelocity ( double  v_max)
inherited

Set the maximal translation velocity that can be sent to the robot during a velocity control.

Parameters
v_max: Maximum translation velocity expressed in m/s.
Examples
servoMomentPoints.cpp, servoSimu4Points.cpp, servoSimuSphere.cpp, simulateCircle2DCamVelocity.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, and testFeatureSegment.cpp.

Definition at line 239 of file vpRobot.cpp.

References vpRobot::maxTranslationVelocity.

Referenced by vpSimulatorAfma6::setPosition().

◆ setPosition()

void vpRobotCamera::setPosition ( const vpHomogeneousMatrix cMw)

Set the robot position as the transformation from camera frame to world frame.

Definition at line 250 of file vpRobotCamera.cpp.

References cMw_, vpRobot::getRobotState(), vpRobot::setRobotState(), and vpRobot::STATE_POSITION_CONTROL.

◆ setRobotFrame()

◆ setRobotState()

vpRobot::vpRobotStateType vpRobot::setRobotState ( const vpRobot::vpRobotStateType  newState)
virtualinherited

Reimplemented in vpRobotViper850, vpRobotViper650, vpRobotFranka, vpRobotAfma6, vpRobotAfma4, vpRobotFlirPtu, vpRobotPtu46, vpSimulatorViper850, vpSimulatorAfma6, and vpRobotBiclops.

Examples
frankaMoveToPosition.cpp, frankaSavePosition.cpp, moveAfma4.cpp, moveBiclops.cpp, movePtu46.cpp, photometricVisualServoing.cpp, servoAfma4Point2DArtVelocity.cpp, servoAfma4Point2DCamVelocity.cpp, servoAfma4Point2DCamVelocityKalman.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6Cylinder2DCamVelocity.cpp, servoAfma6Cylinder2DCamVelocitySecondaryTask.cpp, servoAfma6Ellipse2DCamVelocity.cpp, servoAfma6FourPoints2DArtVelocity.cpp, servoAfma6FourPoints2DCamVelocityLs_cur.cpp, servoAfma6FourPoints2DCamVelocityLs_des.cpp, servoAfma6Line2DCamVelocity.cpp, servoAfma6Point2DArtVelocity.cpp, servoAfma6Point2DCamVelocity.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoAfma6Segment2DCamVelocity.cpp, servoAfma6SquareLines2DCamVelocity.cpp, servoAfma6TwoLines2DCamVelocity.cpp, servoBiclopsPoint2DArtVelocity.cpp, servoFlirPtuIBVS.cpp, servoFrankaIBVS.cpp, servoFrankaPBVS.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, servoPtu46Point2DArtVelocity.cpp, servoSimuAfma6FourPoints2DCamVelocity.cpp, servoSimuViper850FourPoints2DCamVelocity.cpp, servoViper650FourPoints2DArtVelocityLs_cur.cpp, servoViper650FourPoints2DCamVelocityLs_cur-SR300.cpp, servoViper650FourPoints2DCamVelocityLs_cur.cpp, servoViper650Point2DCamVelocity.cpp, servoViper850FourPoints2DArtVelocityLs_cur.cpp, servoViper850FourPoints2DArtVelocityLs_des.cpp, servoViper850FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPointsKinect.cpp, servoViper850Point2DArtVelocity-jointAvoidance-basic.cpp, servoViper850Point2DArtVelocity-jointAvoidance-gpa.cpp, servoViper850Point2DArtVelocity-jointAvoidance-large.cpp, servoViper850Point2DArtVelocity.cpp, servoViper850Point2DCamVelocity.cpp, servoViper850Point2DCamVelocityKalman.cpp, testFrankaCartForceTorque-2.cpp, testFrankaCartForceTorque.cpp, testFrankaCartVelocity-2.cpp, testFrankaCartVelocity-3.cpp, testFrankaCartVelocity.cpp, testFrankaJointPosition.cpp, testFrankaJointTorque.cpp, testFrankaJointVelocity-2.cpp, testFrankaJointVelocity-3.cpp, testFrankaJointVelocity.cpp, testFrankaJointVelocityLimits.cpp, testRobotFlirPtu.cpp, testRobotViper650-frames.cpp, testRobotViper850-frames.cpp, testVirtuoseAfma6.cpp, tutorial-flir-ptu-ibvs.cpp, tutorial-ibvs-4pts-wireframe-robot-afma6.cpp, and tutorial-ibvs-4pts-wireframe-robot-viper.cpp.

Definition at line 201 of file vpRobot.cpp.

Referenced by vpSimulatorCamera::setPosition(), setPosition(), vpRobotPtu46::setRobotState(), vpRobotBiclops::setRobotState(), vpRobotFlirPtu::setRobotState(), vpSimulatorAfma6::setRobotState(), vpRobotAfma4::setRobotState(), vpSimulatorViper850::setRobotState(), vpRobotAfma6::setRobotState(), vpRobotFranka::setRobotState(), vpRobotViper650::setRobotState(), vpRobotViper850::setRobotState(), vpSimulatorCamera::setVelocity(), setVelocity(), vpSimulatorPioneer::setVelocity(), vpSimulatorPioneerPan::setVelocity(), vpSimulatorAfma6::stopMotion(), and vpSimulatorViper850::stopMotion().

◆ setSamplingTime()

◆ setVelocity()

void vpRobotCamera::setVelocity ( const vpRobot::vpControlFrameType  frame,
const vpColVector v 
)
virtual

Send to the controller a velocity.

Parameters
frame: Control frame type. Only articular (vpRobot::ARTICULAR_FRAME) and camera frame (vpRobot::CAMERA_FRAME) are implemented.
v: Velocity twist to apply to the robot.
  • In the camera frame, this velocity is represented by a twist vector of dimension 6 $ {\bf v} = [v_x v_y v_z w_x w_y w_z]^t $ where $ v_x, v_y, v_z $ are the translation velocities in m/s and $ w_x, w_y, w_z $ the rotation velocities in rad/s applied in the camera frame.
  • In articular, the behavior is the same as in camera frame.

Internally, the exponential map (vpExponentialMap) is used to update the camera position from its velocity after applying the velocity during a sampling time. This sampling time can be set using setSamplingTime().

See also
setSamplingTime()

Implements vpRobot.

Definition at line 148 of file vpRobotCamera.cpp.

References vpRobot::ARTICULAR_FRAME, vpRobot::CAMERA_FRAME, cMw_, vpRobotSimulator::delta_t_, vpExponentialMap::direct(), vpRobot::END_EFFECTOR_FRAME, vpRobot::getMaxRotationVelocity(), vpRobot::getMaxTranslationVelocity(), vpRobot::getRobotState(), vpHomogeneousMatrix::inverse(), vpRobot::MIXT_FRAME, vpRobot::REFERENCE_FRAME, vpRobot::saturateVelocities(), vpRobot::setRobotState(), vpRobot::STATE_VELOCITY_CONTROL, and vpRobotException::wrongStateError.

◆ setVerbose()

Member Data Documentation

◆ areJointLimitsAvailable

int vpRobot::areJointLimitsAvailable
protectedinherited

Definition at line 112 of file vpRobot.h.

Referenced by vpRobot::operator=().

◆ cMw_

vpHomogeneousMatrix vpRobotCamera::cMw_
protected

Definition at line 113 of file vpRobotCamera.h.

Referenced by getPosition(), setPosition(), and setVelocity().

◆ delta_t_

double vpRobotSimulator::delta_t_
protectedinherited

◆ eJe

◆ eJeAvailable

int vpRobot::eJeAvailable
protectedinherited

is the robot Jacobian expressed in the end-effector frame available

Definition at line 106 of file vpRobot.h.

Referenced by vpRobot::operator=().

◆ fJe

vpMatrix vpRobot::fJe
protectedinherited

robot Jacobian expressed in the robot reference frame available

Definition at line 108 of file vpRobot.h.

Referenced by vpRobotPtu46::get_fJe(), vpRobotFlirPtu::get_fJe(), vpRobotAfma4::get_fJe(), vpRobotAfma6::get_fJe(), vpRobotViper650::get_fJe(), vpRobotViper850::get_fJe(), and vpRobot::operator=().

◆ fJeAvailable

int vpRobot::fJeAvailable
protectedinherited

is the robot Jacobian expressed in the robot reference frame available

Definition at line 110 of file vpRobot.h.

Referenced by vpRobot::operator=().

◆ maxRotationVelocity

◆ maxRotationVelocityDefault

const double vpRobot::maxRotationVelocityDefault = 0.7
staticprotectedinherited

Definition at line 99 of file vpRobot.h.

Referenced by vpRobotTemplate::init(), and vpRobotFlirPtu::init().

◆ maxTranslationVelocity

double vpRobot::maxTranslationVelocity
protectedinherited

◆ maxTranslationVelocityDefault

const double vpRobot::maxTranslationVelocityDefault = 0.2
staticprotectedinherited

Definition at line 97 of file vpRobot.h.

Referenced by vpRobotTemplate::init(), and vpRobotFlirPtu::init().

◆ nDof

int vpRobot::nDof
protectedinherited

◆ qmax

double* vpRobot::qmax
protectedinherited

Definition at line 114 of file vpRobot.h.

Referenced by vpRobot::operator=(), and vpRobot::~vpRobot().

◆ qmin

double* vpRobot::qmin
protectedinherited

Definition at line 113 of file vpRobot.h.

Referenced by vpRobot::operator=(), and vpRobot::~vpRobot().

◆ verbose_

vpColVector::t
vpRowVector t() const
Definition: vpColVector.cpp:782
vpMath::rad
static double rad(double deg)
Definition: vpMath.h:108
vpSimulatorCamera::setPosition
void setPosition(const vpHomogeneousMatrix &wMc)
Definition: vpSimulatorCamera.cpp:242
vpRobot::setMaxTranslationVelocity
void setMaxTranslationVelocity(double maxVt)
Definition: vpRobot.cpp:239
vpColVector
Implementation of column vector and the associated operations.
Definition: vpColVector.h:131
vpRobot::saturateVelocities
static vpColVector saturateVelocities(const vpColVector &v_in, const vpColVector &v_max, bool verbose=false)
Definition: vpRobot.cpp:163
vpSimulatorCamera::getPosition
vpHomogeneousMatrix getPosition() const
Definition: vpSimulatorCamera.cpp:119
vpRobot::setMaxRotationVelocity
void setMaxRotationVelocity(double maxVr)
Definition: vpRobot.cpp:260
vpRobotCamera
Class that defines the simplest robot: a free flying camera. We recommend to use vpSimulatorCamera in...
Definition: vpRobotCamera.h:111
vpRobot::CAMERA_FRAME
@ CAMERA_FRAME
Definition: vpRobot.h:82
vpRobotSimulator::setSamplingTime
virtual void setSamplingTime(const double &delta_t)
Definition: vpRobotSimulator.h:91
vpHomogeneousMatrix
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition: vpHomogeneousMatrix.h:150
vpSimulatorCamera::setVelocity
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
Definition: vpSimulatorCamera.cpp:198