Visual Servoing Platform
version 3.3.0 under development (2020-02-17)
|
#include <visp3/robot/vpServolens.h>
Public Types | |
enum | vpServoType { ZOOM = 1, FOCUS = 2, IRIS = 3 } |
enum | vpLimitsType { ZOOM_MAX = 10000, ZOOM_MIN = 1000, FOCUS_MAX = 1500, FOCUS_MIN = 100, IRIS_MAX = 1000, IRIS_MIN = 160 } |
enum | vpControllerType { AUTO = 1, CONTROLLED = 2, RELEASED = 3 } |
Public Member Functions | |
vpServolens () | |
vpServolens (const char *port) | |
virtual | ~vpServolens () |
void | open (const char *port="/dev/ttyS0") |
void | close () |
void | reset () const |
void | setController (vpControllerType controller) const |
void | setAutoIris (bool enable) const |
void | setPosition (vpServoType servo, unsigned int position) const |
bool | getPosition (vpServoType servo, unsigned int &position) const |
vpCameraParameters | getCameraParameters (vpImage< unsigned char > &I) const |
void | enablePrompt (bool active) const |
Interface for the Servolens lens attached to the camera fixed on the Afma4 robot.
The code below shows how to manipulate this class to get and modify the position of the focal lens.
Definition at line 92 of file vpServolens.h.
Enumerator | |
---|---|
AUTO | |
CONTROLLED | |
RELEASED |
Definition at line 104 of file vpServolens.h.
Enumerator | |
---|---|
ZOOM_MAX | |
ZOOM_MIN | |
FOCUS_MAX | |
FOCUS_MIN | |
IRIS_MAX | |
IRIS_MIN |
Definition at line 96 of file vpServolens.h.
Enumerator | |
---|---|
ZOOM | |
FOCUS | |
IRIS |
Definition at line 95 of file vpServolens.h.
vpServolens::vpServolens | ( | ) |
|
explicit |
Open and initialize the Servolens serial link at 9600 bauds, 7 data bits, even parity, 1 stop bit. The cariage return mode is not active, that means that each character is directly read without waitong for a cariage return.
Definition at line 81 of file vpServolens.cpp.
References open().
|
virtual |
Destructor.
Close the Servolens serial link.
Definition at line 90 of file vpServolens.cpp.
References close().
void vpServolens::close | ( | ) |
Close the Servolens serial link.
Definition at line 178 of file vpServolens.cpp.
Referenced by open(), and ~vpServolens().
void vpServolens::enablePrompt | ( | bool | active | ) | const |
Enable or disable the emission of the Servolens prompt "SERVOLENS>".
active | : true to activate the emission of the prompy. false to disable this functionality. |
vpRobotException::communicationError | : If cannot dial with Servolens. |
Definition at line 260 of file vpServolens.cpp.
References vpRobotException::communicationError, and vpERROR_TRACE.
vpCameraParameters vpServolens::getCameraParameters | ( | vpImage< unsigned char > & | I | ) | const |
These parameters are computed from the Dragonfly2 DR2-COL camera sensor pixel size (7.4 um) and from the servolens zoom position.
I | : An image coming from the Dragonfly2 camera attached to the servolens. |
vpRobotException::communicationError | : If cannot dial with Servolens. |
Definition at line 569 of file vpServolens.cpp.
References vpRobotException::communicationError, FOCUS, vpImage< Type >::getHeight(), getPosition(), vpImage< Type >::getWidth(), vpCameraParameters::initPersProjWithoutDistortion(), IRIS, vpERROR_TRACE, vpTime::wait(), and ZOOM.
bool vpServolens::getPosition | ( | vpServoType | servo, |
unsigned int & | position | ||
) | const |
Get the Servolens current servo position.
servo | : Servolens servo motor to actuate. |
position | : Measured position of the servo. |
vpRobotException::communicationError | : If cannot dial with Servolens. |
Definition at line 434 of file vpServolens.cpp.
References vpRobotException::communicationError, FOCUS, IRIS, vpERROR_TRACE, and ZOOM.
Referenced by getCameraParameters(), and open().
void vpServolens::open | ( | const char * | port = "/dev/ttyS0" | ) |
Open and initialize the Servolens serial link at 9600 bauds, 7 data bits, even parity, 1 stop bit. The cariage return mode is not active, that means that each character is directly read without waitong for a cariage return.
port | : Serial device like /dev/ttyS0 or /dev/ttya. |
vpRobotException::communicationError | : If cannot open Servolens serial port or intialize the serial link. |
Definition at line 106 of file vpServolens.cpp.
References close(), vpRobotException::communicationError, getPosition(), vpERROR_TRACE, and ZOOM.
Referenced by vpServolens().
void vpServolens::reset | ( | ) | const |
Reset the Servolens.
vpRobotException::communicationError | : If cannot dial with Servolens. |
Definition at line 193 of file vpServolens.cpp.
References vpRobotException::communicationError, vpERROR_TRACE, and vpTime::wait().
void vpServolens::setAutoIris | ( | bool | enable | ) | const |
Activates the auto iris mode of the Servolens.
enable | : true to activate the auto iris. |
Definition at line 323 of file vpServolens.cpp.
References vpRobotException::communicationError, and vpERROR_TRACE.
void vpServolens::setController | ( | vpControllerType | controller | ) | const |
Set the controller type.
controller | : Controller type. |
vpRobotException::communicationError | : If cannot dial with Servolens. |
Definition at line 285 of file vpServolens.cpp.
References AUTO, vpRobotException::communicationError, CONTROLLED, RELEASED, and vpERROR_TRACE.
void vpServolens::setPosition | ( | vpServoType | servo, |
unsigned int | position | ||
) | const |
Set the Servolens servo to the desired position.
servo | : Servolens servo motor to actuate. |
position | : Desired position of the servo. |
vpRobotException::communicationError | : If cannot dial with Servolens. |
Definition at line 349 of file vpServolens.cpp.
References vpRobotException::communicationError, FOCUS, FOCUS_MAX, IRIS, IRIS_MAX, vpERROR_TRACE, ZOOM, and ZOOM_MIN.