Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpSimulatorPioneer Class Reference

#include <vpSimulatorPioneer.h>

Inheritance diagram for vpSimulatorPioneer:

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

 vpSimulatorPioneer ()
Inherited functionalities from vpRobotSimulator
double getSamplingTime () const
virtual void setSamplingTime (const double &delta_t)
Inherited functionalities from vpRobot
double getMaxTranslationVelocity (void) const
double getMaxRotationVelocity (void) const
int getNDof () 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)

Static Public Member Functions

Static Public Member Functions inherited from vpRobot
static vpColVector saturateVelocities (const vpColVector &v_in, const vpColVector &v_max, bool verbose=false)

Protected Member Functions

Protected Member Functions Inherited from vpRobot
vpControlFrameType setRobotFrame (vpRobot::vpControlFrameType newFrame)
vpControlFrameType getRobotFrame (void) const

Protected Attributes

vpHomogeneousMatrix wMc_
vpHomogeneousMatrix wMe_
double xm_
double ym_
double theta_
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 vpUnicycle

vpHomogeneousMatrix cMe_
vpMatrix eJe_
void set_cMe (const vpHomogeneousMatrix &cMe)
void set_eJe (const vpMatrix &eJe)
vpHomogeneousMatrix get_cMe () const
vpVelocityTwistMatrix get_cVe () const
void get_cVe (vpVelocityTwistMatrix &cVe) const
vpMatrix get_eJe () const

Inherited functionalities from vpSimulatorPioneer

void get_eJe (vpMatrix &eJe) VP_OVERRIDE
void getPosition (vpHomogeneousMatrix &wMc) const
void getPosition (const vpRobot::vpControlFrameType frame, vpColVector &q) VP_OVERRIDE
void setVelocity (const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE

Detailed Description

Class that defines the Pioneer mobile robot simulator equipped with a static camera.

It intends to simulate the mobile robot described in vpPioneer class. This robot has 2 dof: $(v_x, w_z)$, the translational and rotational velocities that are applied at point E.

The robot position evolves with respect to a world frame; wMc. When a new joint velocity is applied to the robot using setVelocity(), the position of the camera wrt the world frame is updated.

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

#include <visp3/robot/vpSimulatorPioneer.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
robot.getPosition(wMc); // Position of the camera in the world frame
std::cout << "Default position of the camera in the world frame wMc:\n" << wMc << std::endl;
robot.setSamplingTime(0.100); // Modify the default sampling time to 0.1 second
robot.setMaxTranslationVelocity(1.); // vx max set to 1 m/s
robot.setMaxRotationVelocity(vpMath::rad(90)); // wz max set to 90 deg/s
vpColVector v(2); // we control vx and wz dof
v = 0;
v[0] = 1.; // set vx to 1 m/s
robot.setVelocity(vpRobot::ARTICULAR_FRAME, v);
// The robot has moved from 0.1 meters along the z axis
robot.getPosition(wMc); // Position of the camera in the world frame
std::cout << "New position of the camera wMc:\n" << wMc << std::endl;
}
Implementation of column vector and the associated operations.
Implementation of an homogeneous matrix and operations on such kind of matrices.
static double rad(double deg)
Definition vpMath.h:129
@ ARTICULAR_FRAME
Definition vpRobot.h:77

Tutorials & Examples

Tutorials
If you are interested in simulating a Pioneer robot, you may have a look at:

Examples
tutorial-simu-pioneer-continuous-gain-adaptive.cpp, tutorial-simu-pioneer-continuous-gain-constant.cpp, and tutorial-simu-pioneer.cpp.

Definition at line 107 of file vpSimulatorPioneer.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 73 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 61 of file vpRobot.h.

Constructor & Destructor Documentation

◆ vpSimulatorPioneer()

BEGIN_VISP_NAMESPACE vpSimulatorPioneer::vpSimulatorPioneer ( )

Constructor.

Definition at line 52 of file vpSimulatorPioneer.cpp.

References vpRobot::init(), theta_, wMc_, wMe_, xm_, and ym_.

Member Function Documentation

◆ get_cMe()

vpHomogeneousMatrix vpUnicycle::get_cMe ( ) const
inlineinherited

Return the transformation ${^c}{\bf M}_e$ between the camera frame and the mobile robot end effector frame.

Definition at line 65 of file vpUnicycle.h.

References cMe_.

◆ get_cVe() [1/2]

vpVelocityTwistMatrix vpUnicycle::get_cVe ( ) const
inlineinherited

Return the twist transformation from camera frame to the mobile robot end effector frame. This transformation allows to compute a velocity expressed in the end effector frame into the camera frame.

Examples
servoPioneerPanSegment3D.cpp.

Definition at line 72 of file vpUnicycle.h.

References vpVelocityTwistMatrix::buildFrom(), and cMe_.

◆ get_cVe() [2/2]

void vpUnicycle::get_cVe ( vpVelocityTwistMatrix & cVe) const
inlineinherited

Return the twist transformation from camera frame to the mobile robot end effector frame. This transformation allows to compute a velocity expressed in the end effector frame into the camera frame.

See also
get_cVe()

Definition at line 86 of file vpUnicycle.h.

References get_cVe().

Referenced by get_cVe().

◆ get_eJe() [1/2]

void vpSimulatorPioneer::get_eJe ( vpMatrix & _eJe)
virtual

Get the robot jacobian expressed in the end-effector frame. The jacobian expression is given in vpPioneer class.

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

Implements vpRobot.

Definition at line 84 of file vpSimulatorPioneer.cpp.

References vpUnicycle::get_eJe().

◆ get_eJe() [2/2]

vpMatrix vpUnicycle::get_eJe ( ) const
inlineinherited

Return the robot jacobian ${^e}{\bf J}_e$ expressed in the end effector frame.

Returns
The robot jacobian such as ${\bf v} = {^e}{\bf J}_e \; \dot{\bf
q}$ with $\dot{\bf q} = (v_x, w_z)$ the robot control velocities and $\bf v$ the six dimension velocity skew.
Examples
servoPioneerPanSegment3D.cpp.

Definition at line 96 of file vpUnicycle.h.

References eJe_.

Referenced by vpRobotPioneer::get_eJe(), vpSimulatorPioneer::get_eJe(), and vpSimulatorPioneerPan::get_eJe().

◆ getMaxRotationVelocity()

◆ getMaxTranslationVelocity()

◆ getNDof()

int vpRobot::getNDof ( ) const
inlineinherited

Return robot degrees of freedom number.

Definition at line 142 of file vpRobot.h.

References nDof.

◆ getPosition() [1/3]

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

Return the current robot position in the specified frame.

Definition at line 215 of file vpRobot.cpp.

References getPosition().

◆ getPosition() [2/3]

void vpSimulatorPioneer::getPosition ( const vpRobot::vpControlFrameType frame,
vpColVector & position )
virtual

◆ getPosition() [3/3]

void vpSimulatorPioneer::getPosition ( vpHomogeneousMatrix & wMc) const

Get the robot position in the world frame.

Definition at line 155 of file vpSimulatorPioneer.cpp.

References wMc_.

◆ getRobotFrame()

vpControlFrameType vpRobot::getRobotFrame ( void ) const
inlineprotectedinherited

◆ getRobotState()

virtual vpRobotStateType vpRobot::getRobotState ( void ) const
inlinevirtualinherited

Definition at line 152 of file vpRobot.h.

Referenced by vpRobotBiclops::getPosition(), vpRobotBiclops::getVelocity(), vpRobotAfma6::setPosition(), vpRobotBiclops::setPosition(), vpRobotCamera::setPosition(), vpRobotFranka::setPosition(), vpRobotPololuPtu::setPosition(), vpRobotPtu46::setPosition(), vpRobotUniversalRobots::setPosition(), vpRobotViper650::setPosition(), vpRobotViper850::setPosition(), vpSimulatorAfma6::setPosition(), vpSimulatorCamera::setPosition(), vpSimulatorViper850::setPosition(), vpRobotAfma6::setRobotState(), vpRobotBiclops::setRobotState(), vpRobotFlirPtu::setRobotState(), vpRobotFranka::setRobotState(), vpRobotPololuPtu::setRobotState(), vpRobotPtu46::setRobotState(), vpRobotUniversalRobots::setRobotState(), vpRobotViper650::setRobotState(), vpRobotViper850::setRobotState(), vpSimulatorAfma6::setRobotState(), vpSimulatorViper850::setRobotState(), vpRobotAfma6::setVelocity(), vpRobotBiclops::setVelocity(), vpRobotCamera::setVelocity(), vpRobotFlirPtu::setVelocity(), vpRobotFranka::setVelocity(), vpRobotKinova::setVelocity(), vpRobotPololuPtu::setVelocity(), vpRobotPtu46::setVelocity(), vpRobotTemplate::setVelocity(), vpRobotUniversalRobots::setVelocity(), vpRobotViper650::setVelocity(), vpRobotViper850::setVelocity(), vpSimulatorAfma6::setVelocity(), vpSimulatorCamera::setVelocity(), vpSimulatorPioneer::setVelocity(), vpSimulatorPioneerPan::setVelocity(), vpSimulatorViper850::setVelocity(), vpRobotFlirPtu::stopMotion(), vpRobotFranka::stopMotion(), vpRobotViper650::stopMotion(), vpRobotViper850::stopMotion(), vpSimulatorAfma6::stopMotion(), and vpSimulatorViper850::stopMotion().

◆ getSamplingTime()

double vpRobotSimulator::getSamplingTime ( ) const
inlineinherited

Return the sampling time.

Returns
Sampling time in second used to compute the robot displacement from the velocity applied to the robot during this time.

Definition at line 73 of file vpRobotSimulator.h.

Referenced by vpSimulatorAfma6::updateArticularPosition(), and vpSimulatorViper850::updateArticularPosition().

◆ 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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
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;
}
vpRowVector t() const
static vpColVector saturateVelocities(const vpColVector &v_in, const vpColVector &v_max, bool verbose=false)
Definition vpRobot.cpp:162

Definition at line 162 of file vpRobot.cpp.

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

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

◆ set_cMe()

void vpUnicycle::set_cMe ( const vpHomogeneousMatrix & cMe)
inlineinherited

Set the transformation between the camera frame and the end effector frame.

Definition at line 102 of file vpUnicycle.h.

References cMe_.

Referenced by vpPioneer::vpPioneer(), and vpPioneerPan::vpPioneerPan().

◆ set_eJe()

void vpUnicycle::set_eJe ( const vpMatrix & eJe)
inlineinherited

Set the robot jacobian ${^e}{\bf J}_e$ expressed in the end effector frame.

Parameters
eJe: The robot jacobian to set such as ${\bf v} = {^e}{\bf J}_e
\; \dot{\bf q}$ with $\dot{\bf q} = (v_x, w_z)$ the robot control velocities and $\bf v$ the six dimension velocity skew.

Definition at line 112 of file vpUnicycle.h.

References eJe_.

Referenced by vpPioneer::vpPioneer(), and vpPioneerPan::vpPioneerPan().

◆ 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.

Definition at line 259 of file vpRobot.cpp.

References maxRotationVelocity.

Referenced by init(), 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.

Definition at line 238 of file vpRobot.cpp.

References maxTranslationVelocity.

Referenced by init(), and vpSimulatorAfma6::setPosition().

◆ setRobotFrame()

◆ setRobotState()

◆ setSamplingTime()

◆ setVelocity()

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

Send to the controller a velocity.

Parameters
frame: Control frame type. Only vpRobot::ARTICULAR_FRAME is implemented.
v: Velocity vector $(v_x, \omega_z)$ to apply to the robot, where $v_x$ is the linear translational velocity in m/s and $\omega_z$ is the rotational velocity in rad/s around the vertical axis.

Depending on the velocity specified as input, the robot position is updated using the sampling time that can be modified using setSamplingTime().

See also
setSamplingTime()

Implements vpRobot.

Definition at line 103 of file vpSimulatorPioneer.cpp.

References vpRobot::ARTICULAR_FRAME, vpRobot::CAMERA_FRAME, vpUnicycle::cMe_, vpRobotSimulator::delta_t_, vpException::dimensionError, vpRobot::END_EFFECTOR_FRAME, vpRobot::getMaxRotationVelocity(), vpRobot::getMaxTranslationVelocity(), vpRobot::getRobotState(), vpRobot::MIXT_FRAME, vpRobot::REFERENCE_FRAME, vpRobot::saturateVelocities(), vpRobot::setRobotFrame(), vpRobot::setRobotState(), vpRobot::STATE_VELOCITY_CONTROL, theta_, vpERROR_TRACE, wMc_, wMe_, vpRobotException::wrongStateError, xm_, and ym_.

◆ setVerbose()

void vpRobot::setVerbose ( bool verbose)
inlineinherited

Member Data Documentation

◆ areJointLimitsAvailable

int vpRobot::areJointLimitsAvailable
protectedinherited

Definition at line 111 of file vpRobot.h.

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

◆ cMe_

◆ delta_t_

◆ eJe

◆ eJe_

vpMatrix vpUnicycle::eJe_
protectedinherited

Definition at line 117 of file vpUnicycle.h.

Referenced by get_eJe(), vpPioneerPan::set_eJe(), set_eJe(), and vpUnicycle().

◆ eJeAvailable

int vpRobot::eJeAvailable
protectedinherited

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

Definition at line 105 of file vpRobot.h.

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

◆ fJe

◆ fJeAvailable

int vpRobot::fJeAvailable
protectedinherited

is the robot Jacobian expressed in the robot reference frame available

Definition at line 109 of file vpRobot.h.

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

◆ maxRotationVelocity

◆ maxRotationVelocityDefault

const double vpRobot::maxRotationVelocityDefault = 0.7
staticprotectedinherited

◆ maxTranslationVelocity

double vpRobot::maxTranslationVelocity
protectedinherited

◆ maxTranslationVelocityDefault

BEGIN_VISP_NAMESPACE const double vpRobot::maxTranslationVelocityDefault = 0.2
staticprotectedinherited

◆ nDof

◆ qmax

double* vpRobot::qmax
protectedinherited

Definition at line 113 of file vpRobot.h.

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

◆ qmin

double* vpRobot::qmin
protectedinherited

Definition at line 112 of file vpRobot.h.

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

◆ theta_

double vpSimulatorPioneer::theta_
protected

Definition at line 120 of file vpSimulatorPioneer.h.

Referenced by setVelocity(), and vpSimulatorPioneer().

◆ verbose_

◆ wMc_

vpHomogeneousMatrix vpSimulatorPioneer::wMc_
protected

Definition at line 112 of file vpSimulatorPioneer.h.

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

◆ wMe_

vpHomogeneousMatrix vpSimulatorPioneer::wMe_
protected

Definition at line 115 of file vpSimulatorPioneer.h.

Referenced by setVelocity(), and vpSimulatorPioneer().

◆ xm_

double vpSimulatorPioneer::xm_
protected

Definition at line 118 of file vpSimulatorPioneer.h.

Referenced by setVelocity(), and vpSimulatorPioneer().

◆ ym_

double vpSimulatorPioneer::ym_
protected

Definition at line 119 of file vpSimulatorPioneer.h.

Referenced by setVelocity(), and vpSimulatorPioneer().