Servolens¶
- class Servolens(*args, **kwargs)¶
Bases:
pybind11_object
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.
#include <iostream> #include <visp3/vs/vpServolens.h> #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif int main() { // Open the serial device to communicate with the Servolens lens vpServolens servolens("/dev/ttyS0"); // Get the current zoom position unsigned zoom; servolens.getPosition(vpServolens::ZOOM, zoom); std::cout << "Actual zoom value: " << zoom << std::endl; // Set a new zoom value servolens.setPosition(vpServolens::ZOOM, zoom+1000); }
Overloaded function.
__init__(self: visp._visp.robot.Servolens) -> None
Default constructor. Does nothing.
Note
See open()
__init__(self: visp._visp.robot.Servolens, port: str) -> None
Methods
Overloaded function.
Close the Servolens serial link.
Enable or disable the emission of the Servolens prompt "SERVOLENS>".
These parameters are computed from the Dragonfly2 DR2-COL camera sensor pixel size (7.4 um) and from the servolens zoom position.
Get the Servolens current servo position.
Open and initialize the Servolens serial link at 9600 bauds, 7 data bits, even parity, 1 stop bit.
Reset the Servolens.
Activates the auto iris mode of the Servolens.
Set the controller type.
Set the Servolens servo to the desired position.
Inherited Methods
Operators
__doc__
Overloaded function.
__module__
Attributes
AUTO
CONTROLLED
FOCUS
FOCUS_MAX
FOCUS_MIN
IRIS
IRIS_MAX
IRIS_MIN
RELEASED
ZOOM
ZOOM_MAX
ZOOM_MIN
__annotations__
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.robot.Servolens) -> None
Default constructor. Does nothing.
Note
See open()
__init__(self: visp._visp.robot.Servolens, port: str) -> None
- enablePrompt(self, active: bool) None ¶
Enable or disable the emission of the Servolens prompt “SERVOLENS>”.
- getCameraParameters(self, I: visp._visp.core.ImageGray) visp._visp.core.CameraParameters ¶
These parameters are computed from the Dragonfly2 DR2-COL camera sensor pixel size (7.4 um) and from the servolens zoom position.
#include <visp3/vs/vpServolens.h> #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif int main() { // UNIX vpServolens servolens("/dev/ttyS0"); #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) vpImage<unsigned char> I(240, 320); vpCameraParameters cam = servolens.getCameraParameters(I); std::cout << "Camera parameters: " << cam << std::endl; #endif }
- Parameters:
- I: visp._visp.core.ImageGray¶
An image coming from the Dragonfly2 camera attached to the servolens.
- getPosition(self, servo: visp._visp.robot.Servolens.ServoType, position: int) tuple[bool, int] ¶
Get the Servolens current servo position.
- Parameters:
- servo: visp._visp.robot.Servolens.ServoType¶
Servolens servo motor to actuate.
- position: int¶
Measured position of the servo.
- Returns:
A tuple containing:
position: Measured position of the servo.
- open(self: visp._visp.robot.Servolens, port: str = /dev/ttyS0) None ¶
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.
Note
See close()
- Parameters:
- port
Serial device like /dev/ttyS0 or /dev/ttya.
- setController(self, controller: visp._visp.robot.Servolens.ControllerType) None ¶
Set the controller type.
- Parameters:
- controller: visp._visp.robot.Servolens.ControllerType¶
Controller type.
- setPosition(self, servo: visp._visp.robot.Servolens.ServoType, position: int) None ¶
Set the Servolens servo to the desired position.
- Parameters:
- servo: visp._visp.robot.Servolens.ServoType¶
Servolens servo motor to actuate.
- position: int¶
Desired position of the servo.