WireFrameSimulator

class WireFrameSimulator(self)

Bases: pybind11_object

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.

<unparsed image <doxmlparser.compound.docImageType object at 0x7f421776c9d0>>

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()
{
  vpWireFrameSimulator sim;

  vpImage<vpRGBa> Iint(480, 640, vpRGBa(255));
  vpImage<vpRGBa> Iext(480, 640, vpRGBa(255));

  //Set the type of scene to use
  sim.initScene(vpWireFrameSimulator::PLATE, vpWireFrameSimulator::D_STANDARD);

  //Set the initial pose of the camera
  sim.setCameraPositionRelObj(vpHomogeneousMatrix(0, 0, 0.5, vpMath::rad(0), vpMath::rad(10), 0));
  //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);
  sim.setInternalCameraParameters(camera);
  sim.setExternalCameraParameters(camera);

  //Get the internal view
  sim.getInternalImage(Iint);

  //Get the external view
  sim.getExternalImage(Iext);

  return 0;
}

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.

Methods

__init__

Basic constructor.

deleteCameraPositionHistory

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

displayTrajectory

Overloaded function.

getExternalCameraParameters

Overloaded function.

getExternalCameraPosition

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

getExternalImage

Overloaded function.

getInternalCameraParameters

Overloaded function.

getInternalImage

Overloaded function.

get_cMo

Get the pose between the object and the camera.

get_cMo_History

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

get_fMo

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

get_fMo_History

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

initScene

Overloaded function.

setCameraColor

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

setCameraPositionRelObj

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

setCameraPositionRelWorld

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

setCameraSizeFactor

Set the parameter which enables to choose the size of the main camera in the external camera views.

setCameraTrajectoryColor

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

setCameraTrajectoryDisplayType

setCurrentViewColor

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

setDesiredCameraPosition

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

setDesiredViewColor

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

setDisplayCameraTrajectory

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

setExternalCameraParameters

Set the internal camera parameters.

setExternalCameraPosition

Set the external camera point of view.

setGraphicsThickness

Specify the thickness of the graphics drawings.

setInternalCameraParameters

Set the internal camera parameters.

setNbPtTrajectory

Set the maximum number of main camera's positions which are stored.

set_fMo

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

Inherited Methods

Operators

__doc__

__init__

Basic constructor.

__module__

Attributes

CIRCLE

CT_LINE

CT_POINT

CUBE

CYLINDER

DIAMOND

D_CIRCLE

D_STANDARD

D_TOOL

PIPE

PLAN

PLATE

POINT_CLOUD

RECTANGLE

ROAD

SMALL_PLATE

SPHERE

SQUARE_10CM

THREE_LINES

THREE_PTS

TIRE

TRAPEZOID

__annotations__

class CameraTrajectoryDisplayType(self, value: int)

Bases: pybind11_object

Values:

  • CT_LINE

  • CT_POINT

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class SceneDesiredObject(self, value: int)

Bases: pybind11_object

Values:

  • CT_LINE

  • CT_POINT

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class SceneObject(self, value: int)

Bases: pybind11_object

Values:

  • CT_LINE

  • CT_POINT

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
__init__(self)

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.

deleteCameraPositionHistory(self) None

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

displayTrajectory(*args, **kwargs)

Overloaded function.

  1. displayTrajectory(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageGray, list_cMo: list[visp._visp.core.HomogeneousMatrix], list_fMo: list[visp._visp.core.HomogeneousMatrix], camMf: visp._visp.core.HomogeneousMatrix) -> None

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.

  1. displayTrajectory(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageRGBa, list_cMo: list[visp._visp.core.HomogeneousMatrix], list_fMo: list[visp._visp.core.HomogeneousMatrix], camMf: visp._visp.core.HomogeneousMatrix) -> None

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.

getExternalCameraParameters(*args, **kwargs)

Overloaded function.

  1. getExternalCameraParameters(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageGray) -> visp._visp.core.CameraParameters

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.

  1. getExternalCameraParameters(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageRGBa) -> visp._visp.core.CameraParameters

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.

getExternalCameraPosition(self) visp._visp.core.HomogeneousMatrix

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.

getExternalImage(*args, **kwargs)

Overloaded function.

  1. getExternalImage(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageGray) -> None

Get the external view. It corresponds to the view of the scene from a reference frame you have to set.

Warning

: The objects are displayed thanks to overlays. The image I is not modified.

Parameters:
I

The image where the external view is displayed.

  1. getExternalImage(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageGray, camMf: visp._visp.core.HomogeneousMatrix) -> None

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

Warning

: The objects are displayed thanks to overlays. The image I is not modified.

Parameters:
I

The image where the external view is displayed.

  1. getExternalImage(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageRGBa) -> None

Get the external view. It corresponds to the view of the scene from a reference frame you have to set.

Warning

: The objects are displayed thanks to overlays. The image I is not modified.

Parameters:
I

The image where the external view is displayed.

  1. getExternalImage(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageRGBa, camMf: visp._visp.core.HomogeneousMatrix) -> None

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

Warning

: The objects are displayed thanks to overlays. The image I is not modified.

Parameters:
I

The image where the external view is displayed.

getInternalCameraParameters(*args, **kwargs)

Overloaded function.

  1. getInternalCameraParameters(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageGray) -> visp._visp.core.CameraParameters

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.

  1. getInternalCameraParameters(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageRGBa) -> visp._visp.core.CameraParameters

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.

getInternalImage(*args, **kwargs)

Overloaded function.

  1. getInternalImage(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageGray) -> None

Get the internal view ie the view of the camera.

Warning

: The objects are displayed thanks to overlays. The image I is not modified.

Parameters:
I

The image where the internal view is displayed.

  1. getInternalImage(self: visp._visp.robot.WireFrameSimulator, I: visp._visp.core.ImageRGBa) -> None

Get the internal view ie the view of the camera.

Warning

: The objects are displayed thanks to overlays. The image I is not modified.

Parameters:
I

The image where the internal view is displayed.

get_cMo(self) visp._visp.core.HomogeneousMatrix

Get the pose between the object and the camera.

Returns:

The pose between between the object and the camera.

get_cMo_History(self) list[visp._visp.core.HomogeneousMatrix]

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

Returns:

A tuple containing:

  • cMo_history: The list of the homogeneous matrices cMo.

get_fMo(self) visp._visp.core.HomogeneousMatrix

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

Returns:

The pose between the object and the fixed world frame.

get_fMo_History(self) list[visp._visp.core.HomogeneousMatrix]

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

Returns:

A tuple containing:

  • fMo_history: The list of the homogeneous matrices fMo.

initScene(*args, **kwargs)

Overloaded function.

  1. initScene(self: visp._visp.robot.WireFrameSimulator, obj: visp._visp.robot.WireFrameSimulator.SceneObject, desiredObject: visp._visp.robot.WireFrameSimulator.SceneDesiredObject) -> None

  2. initScene(self: visp._visp.robot.WireFrameSimulator, obj: str, desiredObject: str) -> None

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.

  1. initScene(self: visp._visp.robot.WireFrameSimulator, obj: visp._visp.robot.WireFrameSimulator.SceneObject) -> None

  2. initScene(self: visp._visp.robot.WireFrameSimulator, obj: str) -> None

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.

  1. initScene(self: visp._visp.robot.WireFrameSimulator, obj: visp._visp.robot.WireFrameSimulator.SceneObject, desiredObject: visp._visp.robot.WireFrameSimulator.SceneDesiredObject, imObj: list[visp._visp.robot.ImageSimulator]) -> None

  2. initScene(self: visp._visp.robot.WireFrameSimulator, obj: str, desiredObject: str, imObj: list[visp._visp.robot.ImageSimulator]) -> None

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.

imObj

A list of vpImageSimulator instances.

  1. initScene(self: visp._visp.robot.WireFrameSimulator, obj: visp._visp.robot.WireFrameSimulator.SceneObject, imObj: list[visp._visp.robot.ImageSimulator]) -> None

  2. initScene(self: visp._visp.robot.WireFrameSimulator, obj: str, imObj: list[visp._visp.robot.ImageSimulator]) -> None

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.

setCameraColor(self, col: visp._visp.core.Color) None

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

Parameters:
col: visp._visp.core.Color

The desired color.

setCameraPositionRelObj(self, cMo_: visp._visp.core.HomogeneousMatrix) None

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

Parameters:
cMo_: visp._visp.core.HomogeneousMatrix

The pose of the object in the camera frame.

setCameraPositionRelWorld(self, fMc_: visp._visp.core.HomogeneousMatrix) None

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

Parameters:
fMc_: visp._visp.core.HomogeneousMatrix

The pose of the camera.

setCameraSizeFactor(self, factor: float) None

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: float

The ration for the camera size.

setCameraTrajectoryColor(self, col: visp._visp.core.Color) None

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

Parameters:
col: visp._visp.core.Color

The desired color.

setCameraTrajectoryDisplayType(self, camTraj_type: visp._visp.robot.WireFrameSimulator.CameraTrajectoryDisplayType) None
setCurrentViewColor(self, col: visp._visp.core.Color) None

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

Parameters:
col: visp._visp.core.Color

The desired color.

setDesiredCameraPosition(self, cdMo_: visp._visp.core.HomogeneousMatrix) None

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

Parameters:
cdMo_: visp._visp.core.HomogeneousMatrix

The position of the object in the desired camera frame

setDesiredViewColor(self, col: visp._visp.core.Color) None

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

Parameters:
col: visp._visp.core.Color

The desired color.

setDisplayCameraTrajectory(self, do_display: bool) None

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

By default the trajectory is displayed.

Parameters:
do_display: bool

Set to true to display the camera trajectory.

setExternalCameraParameters(self, cam: visp._visp.core.CameraParameters) None

Set the internal camera parameters.

Parameters:
cam: visp._visp.core.CameraParameters

The desired camera parameters.

setExternalCameraPosition(self, cam_Mf: visp._visp.core.HomogeneousMatrix) None

Set the external camera point of view.

Parameters:
cam_Mf: visp._visp.core.HomogeneousMatrix

The pose of the external camera relative to the world reference frame.

setGraphicsThickness(self, thickness: int) None

Specify the thickness of the graphics drawings.

setInternalCameraParameters(self, cam: visp._visp.core.CameraParameters) None

Set the internal camera parameters.

Parameters:
cam: visp._visp.core.CameraParameters

The desired camera parameters.

setNbPtTrajectory(self, nbPt: int) None

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: int

The desired number of position which are saved.

set_fMo(self, fMo_: visp._visp.core.HomogeneousMatrix) None

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

Parameters:
fMo_: visp._visp.core.HomogeneousMatrix

The pose between the object and the fixed world frame.