API
-
enum schunk_svh::SVHChannel
Enum mapping fingers to their index.
Values:
-
enumerator SVH_ALL
-
enumerator SVH_THUMB_FLEXION
-
enumerator SVH_THUMB_OPPOSITION
-
enumerator SVH_INDEX_FINGER_DISTAL
-
enumerator SVH_INDEX_FINGER_PROXIMAL
-
enumerator SVH_MIDDLE_FINGER_DISTAL
-
enumerator SVH_MIDDLE_FINGER_PROXIMAL
-
enumerator SVH_RING_FINGER
-
enumerator SVH_PINKY
-
enumerator SVH_FINGER_SPREAD
-
enumerator SVH_DIMENSION
-
enumerator SVH_ALL
-
class SchunkSVH
Schunk SVH API.
Public Functions
-
SchunkSVH()
Construct a new Schunk SVH object.
-
virtual ~SchunkSVH()
Destroy the Schunk SVH object and stop motion.
-
void connect(const std::string &port, const std::string &finger_order = "", int priority = 0)
Connect to the Schunk SVH, reset each finger, home its position, and start the control thread in the background.
- Parameters:
port – Serial port on which the robot is connected
finger_order – Order in which to initialise the fingers as a string containing the finger indices. Default order is “012345678”
priority – Thread priority for the control thread (default 0, set to a positive value for real-time scheduling on Linux)
-
bool read(std::vector<double> &position, std::vector<double> &velocity, std::vector<double> &effort, int timeout = 500)
Read joint state from the robot.
- Parameters:
position – Returns joint position in
rad
(will resize the vector)velocity – Returns joint velocity in
rad/s
(will resize the vector)effort – Returns joint current in
A
(will resize the vector)timeout – Timeout in
ms
for waiting for the read operation (default 500, set 0 for non-blocking read)
- Returns:
true If read operation completed before timeout or if timeout=0
- Returns:
false If failed to read within the allocated time
-
void write(const std::vector<double> &position)
Write joint commands to the robot.
- Parameters:
position – Vector of 9 joint position commands in
rad
in the order defined in theSVHChannel
enum
-
bool get_last_command(std::vector<double> &position)
Get the last position command.
- Parameters:
position – Returns last command set to the robot (returns the measured position after startup)
- Returns:
true If last command is available (should always return this if
connect()
was successful)- Returns:
false If last command is not available
-
std::string get_info()
Get the firmware info.
- Returns:
std::string Returns the firmware info and position/current/encoder settings for each finger
-
double get_position_min(SVHChannel channel)
Get joint lower position limit.
- Parameters:
channel – Joint index
- Returns:
double Returns joint limit in radians
-
double get_position_max(SVHChannel channel)
Get joint upper position limit.
- Parameters:
channel – Joint index
- Returns:
double Returns joint limit in radians
-
double get_position_home(SVHChannel channel)
Get joint home position.
- Parameters:
channel – Joint index
- Returns:
double Joint home position
-
void set_position_settings(SVHChannel channel, const std::vector<double> &settings)
Set the position settings for a joint (incorrect settings can break the robot, consult the manual)
- Parameters:
channel – Joint index
settings – Vector of joint position settings to update (wmn, wmx, dwmx, ky, dt, imn, imx, kp, ki, kd)
-
void set_current_settings(SVHChannel channel, const std::vector<double> &settings)
Set the current settings for a joint (incorrect settings can break the robot, consult the manual)
- Parameters:
channel – Joint index
settings – Vector of joint position settings to update (wmn, wmx, ky, dt, imn, imx, kp, ki, umn, umx)
-
SchunkSVH()