Visual Servoing Platform  version 3.2.0 under development (2018-12-11)

#include <visp3/robot/vpWireFrameSimulator.h>

+ Inheritance diagram for vpWireFrameSimulator:

Public Types

enum  vpSceneObject {
  THREE_PTS, CUBE, PLATE, SMALL_PLATE,
  RECTANGLE, SQUARE_10CM, DIAMOND, TRAPEZOID,
  THREE_LINES, ROAD, TIRE, PIPE,
  CIRCLE, SPHERE, CYLINDER, PLAN,
  POINT_CLOUD
}
 
enum  vpSceneDesiredObject { D_STANDARD, D_CIRCLE, D_TOOL }
 
enum  vpCameraTrajectoryDisplayType { CT_LINE, CT_POINT }
 

Public Member Functions

 vpWireFrameSimulator ()
 
virtual ~vpWireFrameSimulator ()
 
Inherited functionalities from vpWireFrameSimulator
void deleteCameraPositionHistory ()
 
void displayTrajectory (const vpImage< unsigned char > &I, const std::list< vpHomogeneousMatrix > &list_cMo, const std::list< vpHomogeneousMatrix > &list_fMo, const vpHomogeneousMatrix &camMf)
 
void displayTrajectory (const vpImage< vpRGBa > &I, const std::list< vpHomogeneousMatrix > &list_cMo, const std::list< vpHomogeneousMatrix > &list_fMo, const vpHomogeneousMatrix &camMf)
 
vpCameraParameters getExternalCameraParameters (const vpImage< unsigned char > &I) const
 
vpCameraParameters getExternalCameraParameters (const vpImage< vpRGBa > &I) const
 
vpHomogeneousMatrix getExternalCameraPosition () const
 
void getExternalImage (vpImage< unsigned char > &I)
 
void getExternalImage (vpImage< unsigned char > &I, const vpHomogeneousMatrix &camMf)
 
void getExternalImage (vpImage< vpRGBa > &I)
 
void getExternalImage (vpImage< vpRGBa > &I, const vpHomogeneousMatrix &camMf)
 
vpCameraParameters getInternalCameraParameters (const vpImage< unsigned char > &I) const
 
vpCameraParameters getInternalCameraParameters (const vpImage< vpRGBa > &I) const
 
void getInternalImage (vpImage< unsigned char > &I)
 
void getInternalImage (vpImage< vpRGBa > &I)
 
vpHomogeneousMatrix get_cMo () const
 
void get_cMo_History (std::list< vpHomogeneousMatrix > &cMo_history)
 
vpHomogeneousMatrix get_fMo () const
 
void get_fMo_History (std::list< vpHomogeneousMatrix > &fMo_history)
 
void initScene (const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
 
void initScene (const char *obj, const char *desiredObject)
 
void initScene (const vpSceneObject &obj)
 
void initScene (const char *obj)
 
void initScene (const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject, const std::list< vpImageSimulator > &imObj)
 
void initScene (const char *obj, const char *desiredObject, const std::list< vpImageSimulator > &imObj)
 
void initScene (const vpSceneObject &obj, const std::list< vpImageSimulator > &imObj)
 
void initScene (const char *obj, const std::list< vpImageSimulator > &imObj)
 
void setCameraColor (const vpColor &col)
 
void setCameraPositionRelObj (const vpHomogeneousMatrix &cMo_)
 
void setCameraPositionRelWorld (const vpHomogeneousMatrix &fMc_)
 
void setCameraSizeFactor (const float factor)
 
void setCameraTrajectoryColor (const vpColor &col)
 
void setCameraTrajectoryDisplayType (const vpCameraTrajectoryDisplayType &camTraj_type)
 
void setCurrentViewColor (const vpColor &col)
 
void setDesiredCameraPosition (const vpHomogeneousMatrix &cdMo_)
 
void setDesiredViewColor (const vpColor &col)
 
void setDisplayCameraTrajectory (const bool &do_display)
 
void setExternalCameraParameters (const vpCameraParameters &cam)
 
void setExternalCameraPosition (const vpHomogeneousMatrix &cam_Mf)
 
void setGraphicsThickness (unsigned int thickness)
 
void setInternalCameraParameters (const vpCameraParameters &cam)
 
void setNbPtTrajectory (const unsigned int nbPt)
 
void set_fMo (const vpHomogeneousMatrix &fMo_)
 

Protected Member Functions

Protected Member Functions Inherited from vpWireFrameSimulator
void display_scene (Matrix mat, Bound_scene &sc, const vpImage< vpRGBa > &I, const vpColor &color)
 
void display_scene (Matrix mat, Bound_scene &sc, const vpImage< unsigned char > &I, const vpColor &color)
 
vpHomogeneousMatrix navigation (const vpImage< vpRGBa > &I, bool &changed)
 
vpHomogeneousMatrix navigation (const vpImage< unsigned char > &I, bool &changed)
 
vpImagePoint projectCameraTrajectory (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo)
 
vpImagePoint projectCameraTrajectory (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo)
 
vpImagePoint projectCameraTrajectory (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo, const vpHomogeneousMatrix &cMf)
 
vpImagePoint projectCameraTrajectory (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpHomogeneousMatrix &fMo, const vpHomogeneousMatrix &cMf)
 

Protected Attributes

Bound_scene scene
 
Bound_scene desiredScene
 
Bound_scene camera
 
std::list< vpImageSimulatorobjectImage
 
vpHomogeneousMatrix fMo
 
vpHomogeneousMatrix fMc
 
vpHomogeneousMatrix camMf
 
vpHomogeneousMatrix refMo
 
vpHomogeneousMatrix cMo
 
vpHomogeneousMatrix cdMo
 
vpSceneObject object
 
vpSceneDesiredObject desiredObject
 
vpColor camColor
 
vpColor camTrajColor
 
vpColor curColor
 
vpColor desColor
 
bool sceneInitialized
 
bool displayCameraTrajectory
 
std::list< vpImagePointcameraTrajectory
 
std::list< vpHomogeneousMatrixposeList
 
std::list< vpHomogeneousMatrixfMoList
 
unsigned int nbrPtLimit
 
vpImagePoint old_iPr
 
vpImagePoint old_iPz
 
vpImagePoint old_iPt
 
bool blockedr
 
bool blockedz
 
bool blockedt
 
bool blocked
 
vpHomogeneousMatrix camMf2
 
vpHomogeneousMatrix f2Mf
 
double px_int
 
double py_int
 
double px_ext
 
double py_ext
 
bool displayObject
 
bool displayDesiredObject
 
bool displayCamera
 
bool displayImageSimulator
 
float cameraFactor
 
vpCameraTrajectoryDisplayType camTrajType
 
bool extCamChanged
 
vpHomogeneousMatrix rotz
 
unsigned int thickness_
 

Detailed Description

Implementation of a wire frame simulator. Compared to the vpSimulator class, it does not require third party libraries to be used.

The simulator uses several frames to display the scene in the image. There are:

  • The world frame : This is a fixed frame used to compute the position of the other frames against each other. By default this frame is positionned at the same location as the initial object frame position.
  • The object frame : It is the frame linked to the object.
  • The camera frame : It is the frame linked to the main camera.
  • The external camera frame : It is the frame which corresponds to one external point of view.

The most used homogeneous matrices which describes the displacement between two frames are :

  • fMo which is the displacement between the world frame and the object frame.
  • cMo which is the displacement between the main camera frame and the object frame.
  • cextMf which is the displacement between one external camera frame and the world frame.

The following picture summarize all the previous information.

vpWireFrameSimulator.jpeg

The simulator uses .bnd or .wrl files as 3D scene descriptors. Several scenes can be found in the data folder which is in the directory where you build ViSP.

You can move the main external view while clicking in the image. The left click enables to turn, the middle button enables to zoom and the left to translate along x and y.

The simulator is able to take into account to camera parameters. You can set the internal and external cameras parameters thanks to a vpCameraParameters.

The following example shows how it is easy to use.

#include <visp3/core/vpImage.h>
#include <visp3/robot/vpWireFrameSimulator.h>
int main()
{
vpImage<vpRGBa> Iint(480,640,255);
vpImage<vpRGBa> Iext(480,640,255);
//Set the type of scene to use
//Set the initial pose of the camera
//Set the desired pose of the camera (for the internal view)
//Set the pose of the reference frame (for the external view)
//Set the camera parameters
vpCameraParameters camera(1000,1000,320,240);
//Get the internal view
sim.getInternalImage(Iint);
//Get the external view
sim.getExternalImage(Iext);
return 0;
}
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 155 of file vpWireFrameSimulator.h.

Member Enumeration Documentation

Enumerator
CT_LINE 
CT_POINT 

Definition at line 219 of file vpWireFrameSimulator.h.

Type of scene used to display the object at the desired pose (in the internal view).

  • D_STANDARD will use the vpSceneObject used to be the object at the current position.
  • D_OUTIL will display a tool which is attached to the camera.
Enumerator
D_STANDARD 

The object displayed at the desired position is the same than the scene object defined in vpSceneObject.

D_CIRCLE 

The object displayed at the desired position is a circle.

D_TOOL 

A cylindrical tool is attached to the camera.

Definition at line 212 of file vpWireFrameSimulator.h.

Type of scene used to display the object at the current position.

Enumerator
THREE_PTS 

A 40cm by 40cm plate with 3 points at coordinates (0,0,0), (0.1,0,0), (0,0.1,0). Each point is represented by a circle with 2cm radius.

CUBE 

A 12.5cm size cube.

PLATE 

A 40cm by 40cm plate with 4 points at coordinates (-0.1,-0.1,0), (0.1,-0.1,0), (0.1,0.1,0), (0.1,0.1,0). Each point is represented by a circle with 2cm radius.

SMALL_PLATE 

4 points at coordinates (-0.03,-0.03,0), (0.03,-0.03,0), (0.03,0.03,0), (0.03,0.03,0). Each point is represented by a circle with 1cm radius.

RECTANGLE 

A 40cm by 40cm plate with 4 points at coordinates (-0.07,-0.05,0), (0.07,0.05,0), (0.07,-0.05,0), (-0.07,-0.05,0). Each point is represented by a circle with 2cm radius.

SQUARE_10CM 

A 40cm by 40cm plate with 4 points at coordinates (-0.05,0.05,0), (0.05,0.05,0), (0.05,-0.05,0), (-0.05,-0.05,0). Each point is represented by a circle with 2cm radius.

DIAMOND 

A 40cm by 40cm plate with 4 points at coordinates (0,-0.1,0), (0.1,0,0), (0,0.1,0), (-0.1,0,0). Each point is represented by a circle with 2cm radius.

TRAPEZOID 

A 40cm by 40cm plate with 4 points at coordinates (-0.025,-0.05,0), (-0.075,0.05,0), (0.075,0.05,0), (0.025,-0.05,0). Each point is represented by a circle with 2cm radius.

THREE_LINES 

Three parallel lines with equation y=-5, y=0, y=5.

ROAD 

Three parallel lines representing a road.

TIRE 

A tire represented by 2 circles with radius 10cm and 15cm.

PIPE 

A pipe represented by a cylinder of 25 cm length and 15cm radius.

CIRCLE 

A 10cm radius circle.

SPHERE 

A 15cm radius sphere.

CYLINDER 

A cylinder of 80cm length and 10cm radius.

PLAN 

A plane represented by a 56cm by 56cm plate with a grid of 49 squares inside.

POINT_CLOUD 

A plate with 8 points at coordinates (0.05,0,0), (0.15,0.05,0), (0.2,0.2,0), (-0.05,0.2,0), (-0.15,-0.1,0), (-0.1,-0.1,0), (-0.05,0.05,0) and (0.5,0,0). ach point is represented by a circle with 2cm radius.

Definition at line 161 of file vpWireFrameSimulator.h.

Constructor & Destructor Documentation

vpWireFrameSimulator::vpWireFrameSimulator ( )

Basic constructor.

Set the path to the scene files (*.bnd and *.sln) used by the simulator. If the path set in vpConfig.h in VISP_SCENES_DIR macro is not valid, the path is set from the VISP_SCENES_DIR environment variable that the user has to set.

Definition at line 175 of file vpWireFrameSimulator.cpp.

References vpHomogeneousMatrix::buildFrom(), camera, vpIoTools::checkDirectory(), desiredScene, vpIoTools::getenv(), old_iPr, old_iPt, old_iPz, vpMath::rad(), rotz, scene, and vpIoTools::splitChain().

vpWireFrameSimulator::~vpWireFrameSimulator ( )
virtual

Member Function Documentation

void vpWireFrameSimulator::deleteCameraPositionHistory ( )
inline

Delete the history of the main camera position which are displayed in the external views.

Definition at line 294 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::display_scene ( Matrix  mat,
Bound_scene &  sc,
const vpImage< vpRGBa > &  I,
const vpColor color 
)
protected
void vpWireFrameSimulator::display_scene ( Matrix  mat,
Bound_scene &  sc,
const vpImage< unsigned char > &  I,
const vpColor color 
)
protected
void vpWireFrameSimulator::displayTrajectory ( const vpImage< unsigned char > &  I,
const std::list< vpHomogeneousMatrix > &  list_cMo,
const std::list< vpHomogeneousMatrix > &  list_fMo,
const vpHomogeneousMatrix cMf 
)

Display a trajectory thanks to a list of homogeneous matrices which give the position of the camera relative to the object and the position of the object relative to the world reference frame. The trajectory is projected into the view of an external camera whose position is given in parameter.

The two lists must have the same size of homogeneous matrices must have the same size.

Parameters
I: The image where the trajectory is displayed.
list_cMo: The homogeneous matrices list containing the position of the camera relative to the object.
list_fMo: The homogeneous matrices list containing the position of the object relative to the world reference frame.
cMf: A homogeneous matrix which gives the position of the external camera (used to project the trajectory) relative to the world reference frame.

Definition at line 1269 of file vpWireFrameSimulator.cpp.

References camTrajColor, camTrajType, CT_LINE, CT_POINT, vpException::dimensionError, vpDisplay::displayLine(), vpDisplay::displayPoint(), projectCameraTrajectory(), rotz, and thickness_.

void vpWireFrameSimulator::displayTrajectory ( const vpImage< vpRGBa > &  I,
const std::list< vpHomogeneousMatrix > &  list_cMo,
const std::list< vpHomogeneousMatrix > &  list_fMo,
const vpHomogeneousMatrix cMf 
)

Display a trajectory thanks to a list of homogeneous matrices which give the position of the camera relative to the object and the position of the object relative to the world reference frame. The trajectory is projected into the view of an external camera whose position is given in parameter.

The two lists must have the same size of homogeneous matrices must have the same size.

Parameters
I: The image where the trajectory is displayed.
list_cMo: The homogeneous matrices list containing the position of the camera relative to the object.
list_fMo: The homogeneous matrices list containing the position of the object relative to the world reference frame.
cMf: A homogeneous matrix which gives the position of the external camera (used to project the trajectory) relative to the world reference frame.

Definition at line 1315 of file vpWireFrameSimulator.cpp.

References camTrajColor, camTrajType, CT_LINE, CT_POINT, vpException::dimensionError, vpDisplay::displayLine(), vpDisplay::displayPoint(), projectCameraTrajectory(), rotz, and thickness_.

vpHomogeneousMatrix vpWireFrameSimulator::get_cMo ( ) const
inline

Get the pose between the object and the camera.

Returns
The pose between between the object and the camera.

Definition at line 405 of file vpWireFrameSimulator.h.

Referenced by vpRobotWireFrameSimulator::getExternalCameraPosition().

void vpWireFrameSimulator::get_cMo_History ( std::list< vpHomogeneousMatrix > &  cMo_history)
inline

Get the homogeneous matrices cMo stored to display the camera trajectory.

Parameters
cMo_history: The list of the homogeneous matrices cMo.

Definition at line 413 of file vpWireFrameSimulator.h.

vpHomogeneousMatrix vpWireFrameSimulator::get_fMo ( ) const
inline

Get the pose between the object and the fixed world frame.

Returns
The pose between the object and the fixed world frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, and servoSimuSphere.cpp.

Definition at line 426 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::get_fMo_History ( std::list< vpHomogeneousMatrix > &  fMo_history)
inline

Get the homogeneous matrices fMo stored to display the camera trajectory.

Parameters
fMo_history: The list of the homogeneous matrices fMo.

Definition at line 434 of file vpWireFrameSimulator.h.

vpCameraParameters vpWireFrameSimulator::getExternalCameraParameters ( const vpImage< unsigned char > &  I) const
inline

Get the parameters of the virtual external camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 313 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

Referenced by projectCameraTrajectory().

vpCameraParameters vpWireFrameSimulator::getExternalCameraParameters ( const vpImage< vpRGBa > &  I) const
inline

Get the parameters of the virtual external camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 332 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

vpHomogeneousMatrix vpWireFrameSimulator::getExternalCameraPosition ( ) const
inline

Get the main external camera's position relative to the the world reference frame.

Returns
the main external camera position relative to the the world reference frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, and servoSimuSphere.cpp.

Definition at line 351 of file vpWireFrameSimulator.h.

Referenced by vpRobotWireFrameSimulator::getExternalCameraPosition().

void vpWireFrameSimulator::getExternalImage ( vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cam_Mf 
)

Get an external view. The point of view is set thanks to the pose between the camera camMf and the fixed world frame.

Parameters
I: The image where the external view is displayed.
cam_Mf: The pose between the point of view and the fixed world frame.
Warning
: The objects are displayed thanks to overlays. The image I is not modified.

Definition at line 1203 of file vpWireFrameSimulator.cpp.

References camColor, camera, cMo, curColor, vpImage< Type >::display, vpDisplay::display(), display_scene(), displayCamera, displayImageSimulator, displayObject, fMo, vpImage< Type >::getHeight(), vpImageSimulator::getImage(), getInternalCameraParameters(), vpImage< Type >::getWidth(), vpHomogeneousMatrix::inverse(), vpMath::maximum(), vpMath::minimum(), objectImage, px_ext, py_ext, rotz, scene, and vpImageSimulator::setCameraPosition().

void vpWireFrameSimulator::getExternalImage ( vpImage< vpRGBa > &  I)
void vpWireFrameSimulator::getExternalImage ( vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cam_Mf 
)

Get an external view. The point of view is set thanks to the pose between the camera camMf and the fixed world frame.

Parameters
I: The image where the external view is displayed.
cam_Mf: The pose between the point of view and the fixed world frame.
Warning
: The objects are displayed thanks to overlays. The image I is not modified.

Definition at line 941 of file vpWireFrameSimulator.cpp.

References camColor, camera, cMo, curColor, vpImage< Type >::display, vpDisplay::display(), display_scene(), displayCamera, displayImageSimulator, displayObject, fMo, vpImage< Type >::getHeight(), vpImageSimulator::getImage(), getInternalCameraParameters(), vpImage< Type >::getWidth(), vpHomogeneousMatrix::inverse(), vpMath::maximum(), vpMath::minimum(), objectImage, px_ext, py_ext, rotz, scene, and vpImageSimulator::setCameraPosition().

vpCameraParameters vpWireFrameSimulator::getInternalCameraParameters ( const vpImage< unsigned char > &  I) const
inline

Get the parameters of the virtual internal camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 365 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

Referenced by getExternalImage(), and getInternalImage().

vpCameraParameters vpWireFrameSimulator::getInternalCameraParameters ( const vpImage< vpRGBa > &  I) const
inline

Get the parameters of the virtual internal camera.

Parameters
I: The image used to display the view of the camera.
Returns
It returns the camera parameters.

Definition at line 384 of file vpWireFrameSimulator.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpMath::maximum(), and vpMath::minimum().

void vpWireFrameSimulator::getInternalImage ( vpImage< vpRGBa > &  I)
void vpWireFrameSimulator::initScene ( const vpSceneObject obj,
const vpSceneDesiredObject desired_object 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

It exists several default scenes you can use. Use the vpSceneObject and the vpSceneDesiredObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

Parameters
obj: Type of scene used to display the object at the current position.
desired_object: Type of scene used to display the object at the desired pose (in the internal view).
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 261 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, CIRCLE, CUBE, CYLINDER, D_CIRCLE, D_STANDARD, D_TOOL, desiredObject, desiredScene, DIAMOND, displayCamera, displayDesiredObject, displayImageSimulator, displayObject, vpException::memoryAllocationError, PIPE, PLAN, PLATE, POINT_CLOUD, RECTANGLE, ROAD, scene, sceneInitialized, SMALL_PLATE, SPHERE, SQUARE_10CM, THREE_LINES, THREE_PTS, TIRE, and TRAPEZOID.

Referenced by vpRobotWireFrameSimulator::get_fMo(), vpRobotWireFrameSimulator::initScene(), and initScene().

void vpWireFrameSimulator::initScene ( const char *  obj,
const char *  desired_object 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

Parameters
obj: Path to the scene file you want to use.
desired_object: Path to the scene file you want to use.

Definition at line 432 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, D_STANDARD, desiredObject, desiredScene, displayCamera, displayDesiredObject, displayObject, vpException::memoryAllocationError, scene, sceneInitialized, THREE_PTS, and vpERROR_TRACE.

void vpWireFrameSimulator::initScene ( const vpSceneObject obj)

Initialize the simulator. It enables to choose the type of object which will be used to display the object at the current position. The object at the desired position is not displayed.

It exists several default scenes you can use. Use the vpSceneObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

Parameters
obj: Type of scene used to display the object at the current position.

Definition at line 526 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, CIRCLE, CUBE, CYLINDER, DIAMOND, displayCamera, displayDesiredObject, displayImageSimulator, displayObject, vpException::memoryAllocationError, PIPE, PLAN, PLATE, POINT_CLOUD, RECTANGLE, ROAD, scene, sceneInitialized, SMALL_PLATE, SPHERE, SQUARE_10CM, THREE_LINES, THREE_PTS, TIRE, and TRAPEZOID.

void vpWireFrameSimulator::initScene ( const char *  obj)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position. The object at the desired position is not displayed.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

Parameters
obj: Path to the scene file you want to use.

Definition at line 665 of file vpWireFrameSimulator.cpp.

References camera, cameraFactor, displayCamera, displayObject, vpException::memoryAllocationError, scene, sceneInitialized, THREE_PTS, and vpERROR_TRACE.

void vpWireFrameSimulator::initScene ( const vpSceneObject obj,
const vpSceneDesiredObject desired_object,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

It exists several default scenes you can use. Use the vpSceneObject and the vpSceneDesiredObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Type of scene used to display the object at the current position.
desired_object: Type of scene used to display the object at the desired pose (in the internal view).
imObj: A list of vpImageSimulator instances.

Definition at line 413 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

void vpWireFrameSimulator::initScene ( const char *  obj,
const char *  desired_object,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position and at the desired position.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Path to the scene file you want to use.
desired_object: Path to the scene file you want to use.
imObj: A list of vpImageSimulator instances.

Definition at line 506 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

void vpWireFrameSimulator::initScene ( const vpSceneObject obj,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of object which will be used to display the object at the current position. The object at the desired position is not displayed.

It exists several default scenes you can use. Use the vpSceneObject attributes to use them in this method. The corresponding files are stored in the "data" folder which is in the ViSP build directory.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Type of scene used to display the object at the current position.
imObj: A list of vpImageSimulator instances.

Definition at line 648 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

void vpWireFrameSimulator::initScene ( const char *  obj,
const std::list< vpImageSimulator > &  imObj 
)

Initialize the simulator. It enables to choose the type of scene which will be used to display the object at the current position. The object at the desired position is not displayed.

Here you can use the scene you want. You have to set the path to a .bnd or a .wrl file which is a 3D model file.

It is also possible to add a list of vpImageSimulator instances. They will be automatically projected into the image. The position of the four corners have to be given in the object frame.

Parameters
obj: Path to the scene file you want to use.
imObj: A list of vpImageSimulator instances.

Definition at line 722 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo_,
const vpHomogeneousMatrix fMo_ 
)
protected
vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo_,
const vpHomogeneousMatrix fMo_ 
)
protected
vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo_,
const vpHomogeneousMatrix fMo_,
const vpHomogeneousMatrix cMf 
)
protected
vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo_,
const vpHomogeneousMatrix fMo_,
const vpHomogeneousMatrix cMf 
)
protected
void vpWireFrameSimulator::set_fMo ( const vpHomogeneousMatrix fMo_)
inline

Set the pose between the object and the fixed world frame.

Parameters
fMo_: The pose between the object and the fixed world frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, and wireframeSimulator.cpp.

Definition at line 588 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraColor ( const vpColor col)
inline

Set the color used to display the camera in the external view.

Parameters
col: The desired color.
Examples:
wireframeSimulator.cpp.

Definition at line 452 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraPositionRelObj ( const vpHomogeneousMatrix cMo_)
inline

Set the position of the camera relative to the object.

Parameters
cMo_: The pose of the camera.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 458 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::inverse().

void vpWireFrameSimulator::setCameraPositionRelWorld ( const vpHomogeneousMatrix fMc_)
inline

Set the position of the the world reference frame relative to the camera.

Parameters
fMc_: The pose of the camera.

Definition at line 470 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::inverse().

void vpWireFrameSimulator::setCameraSizeFactor ( const float  factor)
inline

Set the parameter which enables to choose the size of the main camera in the external camera views. By default this parameter is set to 1.

Parameters
factor: The ration for the camera size.

Definition at line 482 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraTrajectoryColor ( const vpColor col)
inline

Set the color used to display the camera trajectory in the external view.

Parameters
col: The desired color.

Definition at line 490 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCameraTrajectoryDisplayType ( const vpCameraTrajectoryDisplayType camTraj_type)
inline

Set the way to display the history of the main camera trajectory in the main external view. The choice is given between displaying lines and points.

Parameters
camTraj_type: The chosen way to display the camera trajectory.

Definition at line 499 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setCurrentViewColor ( const vpColor col)
inline

Set the color used to display the object at the current position.

Parameters
col: The desired color.
Examples:
wireframeSimulator.cpp.

Definition at line 509 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setDesiredCameraPosition ( const vpHomogeneousMatrix cdMo_)
inline

Set the desired position of the camera relative to the object.

Parameters
cdMo_: The desired pose of the camera.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 515 of file vpWireFrameSimulator.h.

Referenced by vpRobotWireFrameSimulator::setDesiredCameraPosition().

void vpWireFrameSimulator::setDesiredViewColor ( const vpColor col)
inline

Set the color used to display the object at the desired position.

Parameters
col: The desired color.
Examples:
wireframeSimulator.cpp.

Definition at line 521 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setDisplayCameraTrajectory ( const bool &  do_display)
inline

Enable or disable the displaying of the camera trajectory in the main external camera view.

By default the trajectory is displayed.

Parameters
do_display: Set to true to display the camera trajectory.

Definition at line 530 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setExternalCameraParameters ( const vpCameraParameters cam)
inline

Set the internal camera parameters.

Parameters
cam: The desired camera parameters.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 537 of file vpWireFrameSimulator.h.

References vpCameraParameters::get_px(), and vpCameraParameters::get_py().

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

void vpWireFrameSimulator::setExternalCameraPosition ( const vpHomogeneousMatrix cam_Mf)
inline

Set the external camera point of view.

Parameters
cam_Mf: The pose of the external camera relative to the world reference frame.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 548 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::buildFrom(), vpHomogeneousMatrix::extract(), and vpHomogeneousMatrix::inverse().

Referenced by vpRobotWireFrameSimulator::setExternalCameraPosition().

void vpWireFrameSimulator::setGraphicsThickness ( unsigned int  thickness)
inline

Specify the thickness of the graphics drawings.

Definition at line 561 of file vpWireFrameSimulator.h.

void vpWireFrameSimulator::setInternalCameraParameters ( const vpCameraParameters cam)
inline

Set the internal camera parameters.

Parameters
cam: The desired camera parameters.
Examples:
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 568 of file vpWireFrameSimulator.h.

References vpCameraParameters::get_px(), and vpCameraParameters::get_py().

void vpWireFrameSimulator::setNbPtTrajectory ( const unsigned int  nbPt)
inline

Set the maximum number of main camera's positions which are stored. Those position can be displayed in the external camera field of view. By default this parameter is set to 1000.

Parameters
nbPt: The desired number of position which are saved.

Definition at line 581 of file vpWireFrameSimulator.h.

Member Data Documentation

bool vpWireFrameSimulator::blocked
protected

Definition at line 256 of file vpWireFrameSimulator.h.

Referenced by navigation().

bool vpWireFrameSimulator::blockedr
protected

Definition at line 253 of file vpWireFrameSimulator.h.

Referenced by navigation().

bool vpWireFrameSimulator::blockedt
protected

Definition at line 255 of file vpWireFrameSimulator.h.

Referenced by navigation().

bool vpWireFrameSimulator::blockedz
protected

Definition at line 254 of file vpWireFrameSimulator.h.

Referenced by navigation().

vpColor vpWireFrameSimulator::camColor
protected
float vpWireFrameSimulator::cameraFactor
protected
std::list<vpImagePoint> vpWireFrameSimulator::cameraTrajectory
protected

Definition at line 245 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and ~vpWireFrameSimulator().

vpHomogeneousMatrix vpWireFrameSimulator::camMf2
protected
vpColor vpWireFrameSimulator::camTrajColor
protected

Definition at line 238 of file vpWireFrameSimulator.h.

Referenced by displayTrajectory(), and getExternalImage().

vpCameraTrajectoryDisplayType vpWireFrameSimulator::camTrajType
protected

Definition at line 273 of file vpWireFrameSimulator.h.

Referenced by displayTrajectory(), and getExternalImage().

vpHomogeneousMatrix vpWireFrameSimulator::cdMo
protected
vpHomogeneousMatrix vpWireFrameSimulator::cMo
protected
vpColor vpWireFrameSimulator::desColor
protected
vpSceneDesiredObject vpWireFrameSimulator::desiredObject
protected
Bound_scene vpWireFrameSimulator::desiredScene
protected
bool vpWireFrameSimulator::displayCameraTrajectory
protected

Definition at line 244 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

bool vpWireFrameSimulator::displayDesiredObject
protected
bool vpWireFrameSimulator::displayImageSimulator
protected

Definition at line 269 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), getInternalImage(), and initScene().

bool vpWireFrameSimulator::extCamChanged
protected

Definition at line 275 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

vpHomogeneousMatrix vpWireFrameSimulator::f2Mf
protected
vpHomogeneousMatrix vpWireFrameSimulator::fMc
protected

Definition at line 228 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

std::list<vpHomogeneousMatrix> vpWireFrameSimulator::fMoList
protected

Definition at line 247 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and ~vpWireFrameSimulator().

unsigned int vpWireFrameSimulator::nbrPtLimit
protected

Definition at line 248 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

vpSceneObject vpWireFrameSimulator::object
protected

Definition at line 234 of file vpWireFrameSimulator.h.

std::list<vpImageSimulator> vpWireFrameSimulator::objectImage
protected

Definition at line 225 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), getInternalImage(), and initScene().

vpImagePoint vpWireFrameSimulator::old_iPr
protected

Definition at line 250 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

vpImagePoint vpWireFrameSimulator::old_iPt
protected

Definition at line 252 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

vpImagePoint vpWireFrameSimulator::old_iPz
protected

Definition at line 251 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

std::list<vpHomogeneousMatrix> vpWireFrameSimulator::poseList
protected

Definition at line 246 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and ~vpWireFrameSimulator().

double vpWireFrameSimulator::px_ext
protected
double vpWireFrameSimulator::py_ext
protected
vpHomogeneousMatrix vpWireFrameSimulator::refMo
protected

Definition at line 230 of file vpWireFrameSimulator.h.

unsigned int vpWireFrameSimulator::thickness_
protected