Visual Servoing Platform  version 3.6.1 under development (2024-11-14)

#include <visp3/robot/vpWireFrameSimulator.h>

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

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>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
vpImage<vpRGBa> Iint(480, 640, vpRGBa(255));
vpImage<vpRGBa> Iext(480, 640, vpRGBa(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)
sim.setDesiredCameraPosition(vpHomogeneousMatrix(0.0, 0, 0.5, 0, 0, 0));
//Set the pose of the reference frame (for the external view)
sim.setExternalCameraPosition(vpHomogeneousMatrix(0.1, 0, 0.2, 0, 0, 0));
//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;
}
Generic class defining intrinsic camera parameters.
Implementation of an homogeneous matrix and operations on such kind of matrices.
static double rad(double deg)
Definition: vpMath.h:129
Definition: vpRGBa.h:65
Implementation of a wire frame simulator. Compared to the vpSimulator class, it does not require thir...
void setCameraPositionRelObj(const vpHomogeneousMatrix &cMo_)
void getInternalImage(vpImage< unsigned char > &I)
void initScene(const vpSceneObject &obj, const vpSceneDesiredObject &desiredObject)
void setExternalCameraPosition(const vpHomogeneousMatrix &cam_Mf)
void setDesiredCameraPosition(const vpHomogeneousMatrix &cdMo_)
void setInternalCameraParameters(const vpCameraParameters &cam)
void setExternalCameraParameters(const vpCameraParameters &cam)
void getExternalImage(vpImage< unsigned char > &I)
Examples
servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuSphere.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, and wireframeSimulator.cpp.

Definition at line 156 of file vpWireFrameSimulator.h.

Member Enumeration Documentation

◆ vpCameraTrajectoryDisplayType

Enumerator
CT_LINE 
CT_POINT 

Definition at line 222 of file vpWireFrameSimulator.h.

◆ vpSceneDesiredObject

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 214 of file vpWireFrameSimulator.h.

◆ vpSceneObject

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 162 of file vpWireFrameSimulator.h.

Constructor & Destructor Documentation

◆ vpWireFrameSimulator()

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 174 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::~vpWireFrameSimulator ( )
virtual

Member Function Documentation

◆ deleteCameraPositionHistory()

void vpWireFrameSimulator::deleteCameraPositionHistory ( )
inline

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

Definition at line 297 of file vpWireFrameSimulator.h.

◆ display_scene() [1/2]

void vpWireFrameSimulator::display_scene ( Matrix  mat,
Bound_scene &  sc,
const vpImage< unsigned char > &  I,
const vpColor color 
)
protected

◆ display_scene() [2/2]

void vpWireFrameSimulator::display_scene ( Matrix  mat,
Bound_scene &  sc,
const vpImage< vpRGBa > &  I,
const vpColor color 
)
protected

◆ displayTrajectory() [1/2]

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 1282 of file vpWireFrameSimulator.cpp.

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

◆ displayTrajectory() [2/2]

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 1329 of file vpWireFrameSimulator.cpp.

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

◆ get_cMo()

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 408 of file vpWireFrameSimulator.h.

◆ get_cMo_History()

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 416 of file vpWireFrameSimulator.h.

◆ get_fMo()

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 429 of file vpWireFrameSimulator.h.

◆ get_fMo_History()

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 437 of file vpWireFrameSimulator.h.

◆ getExternalCameraParameters() [1/2]

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 316 of file vpWireFrameSimulator.h.

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

Referenced by projectCameraTrajectory().

◆ getExternalCameraParameters() [2/2]

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 335 of file vpWireFrameSimulator.h.

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

◆ getExternalCameraPosition()

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 354 of file vpWireFrameSimulator.h.

◆ getExternalImage() [1/4]

◆ getExternalImage() [2/4]

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 1215 of file vpWireFrameSimulator.cpp.

References camColor, camera, cMo, curColor, vpDisplay::display(), vpImage< Type >::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().

◆ getExternalImage() [3/4]

void vpWireFrameSimulator::getExternalImage ( vpImage< vpRGBa > &  I)

◆ getExternalImage() [4/4]

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 947 of file vpWireFrameSimulator.cpp.

References camColor, camera, cMo, curColor, vpDisplay::display(), vpImage< Type >::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().

◆ getInternalCameraParameters() [1/2]

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 368 of file vpWireFrameSimulator.h.

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

Referenced by getExternalImage(), and getInternalImage().

◆ getInternalCameraParameters() [2/2]

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 387 of file vpWireFrameSimulator.h.

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

◆ getInternalImage() [1/2]

◆ getInternalImage() [2/2]

void vpWireFrameSimulator::getInternalImage ( vpImage< vpRGBa > &  I)

◆ initScene() [1/8]

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 666 of file vpWireFrameSimulator.cpp.

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

◆ initScene() [2/8]

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 433 of file vpWireFrameSimulator.cpp.

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

◆ initScene() [3/8]

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 507 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

◆ initScene() [4/8]

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 723 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

◆ initScene() [5/8]

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

◆ initScene() [6/8]

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 649 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

◆ initScene() [7/8]

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 initScene().

◆ initScene() [8/8]

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 414 of file vpWireFrameSimulator.cpp.

References displayImageSimulator, initScene(), and objectImage.

◆ navigation() [1/2]

◆ navigation() [2/2]

◆ projectCameraTrajectory() [1/4]

vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo_,
const vpHomogeneousMatrix fMo_ 
)
protected

◆ projectCameraTrajectory() [2/4]

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

◆ projectCameraTrajectory() [3/4]

vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo_,
const vpHomogeneousMatrix fMo_ 
)
protected

◆ projectCameraTrajectory() [4/4]

vpImagePoint vpWireFrameSimulator::projectCameraTrajectory ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo_,
const vpHomogeneousMatrix fMo_,
const vpHomogeneousMatrix cMf 
)
protected

◆ set_fMo()

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 591 of file vpWireFrameSimulator.h.

◆ setCameraColor()

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 455 of file vpWireFrameSimulator.h.

◆ setCameraPositionRelObj()

void vpWireFrameSimulator::setCameraPositionRelObj ( const vpHomogeneousMatrix cMo_)
inline

Set the transformation between the camera frame and the object frame.

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

Definition at line 461 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::inverse().

◆ setCameraPositionRelWorld()

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 473 of file vpWireFrameSimulator.h.

References vpHomogeneousMatrix::inverse().

◆ setCameraSizeFactor()

void vpWireFrameSimulator::setCameraSizeFactor ( 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 485 of file vpWireFrameSimulator.h.

◆ setCameraTrajectoryColor()

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 493 of file vpWireFrameSimulator.h.

◆ setCameraTrajectoryDisplayType()

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 502 of file vpWireFrameSimulator.h.

◆ setCurrentViewColor()

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 512 of file vpWireFrameSimulator.h.

◆ setDesiredCameraPosition()

void vpWireFrameSimulator::setDesiredCameraPosition ( const vpHomogeneousMatrix cdMo_)
inline

Set the transformation between the desired position of the camera and the object.

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

Definition at line 518 of file vpWireFrameSimulator.h.

◆ setDesiredViewColor()

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 524 of file vpWireFrameSimulator.h.

◆ setDisplayCameraTrajectory()

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 533 of file vpWireFrameSimulator.h.

◆ setExternalCameraParameters()

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 540 of file vpWireFrameSimulator.h.

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

◆ setExternalCameraPosition()

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 551 of file vpWireFrameSimulator.h.

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

◆ setGraphicsThickness()

void vpWireFrameSimulator::setGraphicsThickness ( unsigned int  thickness)
inline

Specify the thickness of the graphics drawings.

Definition at line 564 of file vpWireFrameSimulator.h.

◆ setInternalCameraParameters()

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 571 of file vpWireFrameSimulator.h.

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

◆ setNbPtTrajectory()

void vpWireFrameSimulator::setNbPtTrajectory ( 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 584 of file vpWireFrameSimulator.h.

Member Data Documentation

◆ blocked

bool vpWireFrameSimulator::blocked
protected

Definition at line 259 of file vpWireFrameSimulator.h.

Referenced by navigation().

◆ blockedr

bool vpWireFrameSimulator::blockedr
protected

Definition at line 256 of file vpWireFrameSimulator.h.

Referenced by navigation().

◆ blockedt

bool vpWireFrameSimulator::blockedt
protected

Definition at line 258 of file vpWireFrameSimulator.h.

Referenced by navigation().

◆ blockedz

bool vpWireFrameSimulator::blockedz
protected

Definition at line 257 of file vpWireFrameSimulator.h.

Referenced by navigation().

◆ camColor

vpColor vpWireFrameSimulator::camColor
protected

Definition at line 240 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ camera

Bound_scene vpWireFrameSimulator::camera
protected

◆ cameraFactor

float vpWireFrameSimulator::cameraFactor
protected

Definition at line 274 of file vpWireFrameSimulator.h.

Referenced by initScene().

◆ cameraTrajectory

std::list<vpImagePoint> vpWireFrameSimulator::cameraTrajectory
protected

Definition at line 248 of file vpWireFrameSimulator.h.

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

◆ camMf

vpHomogeneousMatrix vpWireFrameSimulator::camMf
protected

◆ camMf2

vpHomogeneousMatrix vpWireFrameSimulator::camMf2
protected

Definition at line 261 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ camTrajColor

vpColor vpWireFrameSimulator::camTrajColor
protected

Definition at line 241 of file vpWireFrameSimulator.h.

Referenced by displayTrajectory(), and getExternalImage().

◆ camTrajType

vpCameraTrajectoryDisplayType vpWireFrameSimulator::camTrajType
protected

Definition at line 276 of file vpWireFrameSimulator.h.

Referenced by displayTrajectory(), and getExternalImage().

◆ cdMo

vpHomogeneousMatrix vpWireFrameSimulator::cdMo
protected

Definition at line 235 of file vpWireFrameSimulator.h.

Referenced by getInternalImage().

◆ cMo

vpHomogeneousMatrix vpWireFrameSimulator::cMo
protected

Definition at line 234 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and getInternalImage().

◆ curColor

vpColor vpWireFrameSimulator::curColor
protected

Definition at line 242 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and getInternalImage().

◆ desColor

vpColor vpWireFrameSimulator::desColor
protected

Definition at line 243 of file vpWireFrameSimulator.h.

Referenced by getInternalImage().

◆ desiredObject

vpSceneDesiredObject vpWireFrameSimulator::desiredObject
protected

Definition at line 238 of file vpWireFrameSimulator.h.

Referenced by getInternalImage(), and initScene().

◆ desiredScene

Bound_scene vpWireFrameSimulator::desiredScene
protected

◆ displayCamera

bool vpWireFrameSimulator::displayCamera
protected

Definition at line 271 of file vpWireFrameSimulator.h.

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

◆ displayCameraTrajectory

bool vpWireFrameSimulator::displayCameraTrajectory
protected

Definition at line 247 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ displayDesiredObject

bool vpWireFrameSimulator::displayDesiredObject
protected

Definition at line 270 of file vpWireFrameSimulator.h.

Referenced by getInternalImage(), initScene(), and ~vpWireFrameSimulator().

◆ displayImageSimulator

bool vpWireFrameSimulator::displayImageSimulator
protected

Definition at line 272 of file vpWireFrameSimulator.h.

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

◆ displayObject

bool vpWireFrameSimulator::displayObject
protected

◆ extCamChanged

bool vpWireFrameSimulator::extCamChanged
protected

Definition at line 278 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ f2Mf

vpHomogeneousMatrix vpWireFrameSimulator::f2Mf
protected

Definition at line 262 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ fMc

vpHomogeneousMatrix vpWireFrameSimulator::fMc
protected

Definition at line 231 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ fMo

vpHomogeneousMatrix vpWireFrameSimulator::fMo
protected

Definition at line 230 of file vpWireFrameSimulator.h.

Referenced by getExternalImage(), and getInternalImage().

◆ fMoList

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

Definition at line 250 of file vpWireFrameSimulator.h.

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

◆ nbrPtLimit

unsigned int vpWireFrameSimulator::nbrPtLimit
protected

Definition at line 251 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ object

vpSceneObject vpWireFrameSimulator::object
protected

Definition at line 237 of file vpWireFrameSimulator.h.

◆ objectImage

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

Definition at line 228 of file vpWireFrameSimulator.h.

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

◆ old_iPr

vpImagePoint vpWireFrameSimulator::old_iPr
protected

Definition at line 253 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

◆ old_iPt

vpImagePoint vpWireFrameSimulator::old_iPt
protected

Definition at line 255 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

◆ old_iPz

vpImagePoint vpWireFrameSimulator::old_iPz
protected

Definition at line 254 of file vpWireFrameSimulator.h.

Referenced by navigation(), and vpWireFrameSimulator().

◆ poseList

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

Definition at line 249 of file vpWireFrameSimulator.h.

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

◆ px_ext

double vpWireFrameSimulator::px_ext
protected

Definition at line 266 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ px_int

double vpWireFrameSimulator::px_int
protected

Definition at line 264 of file vpWireFrameSimulator.h.

Referenced by getInternalImage().

◆ py_ext

double vpWireFrameSimulator::py_ext
protected

Definition at line 267 of file vpWireFrameSimulator.h.

Referenced by getExternalImage().

◆ py_int

double vpWireFrameSimulator::py_int
protected

Definition at line 265 of file vpWireFrameSimulator.h.

Referenced by getInternalImage().

◆ refMo

vpHomogeneousMatrix vpWireFrameSimulator::refMo
protected

Definition at line 233 of file vpWireFrameSimulator.h.

◆ rotz

◆ scene

Bound_scene vpWireFrameSimulator::scene
protected

◆ sceneInitialized

bool vpWireFrameSimulator::sceneInitialized
protected

Definition at line 245 of file vpWireFrameSimulator.h.

Referenced by getInternalImage(), initScene(), and ~vpWireFrameSimulator().

◆ thickness_

unsigned int vpWireFrameSimulator::thickness_
protected

Definition at line 282 of file vpWireFrameSimulator.h.

Referenced by display_scene(), displayTrajectory(), and getExternalImage().