Class SVHFingerManager

Nested Relationships

Nested Types

Class Documentation

class SVHFingerManager

This class manages controller parameters and the finger reset.

Public Types

enum Hints

The Hints enum provides mapping to hints that can be sent to the web-diagnostic interface.

Values:

enumerator HT_DEVICE_NOT_FOUND
enumerator HT_CONNECTION_FAILED
enumerator HT_NOT_RESETTED
enumerator HT_NOT_CONNECTED
enumerator HT_RESET_FAILED
enumerator HT_CHANNEL_SWITCHED_OF
enumerator HT_DANGEROUS_CURRENTS
enumerator HT_DIMENSION

Public Functions

SVHFingerManager(const std::vector<bool> &disable_mask = std::vector<bool>(9, false), const uint32_t &reset_timeout = 5)

Constructs a finger manager for the SCHUNK five finger hand.

Parameters:
  • autostart – if set to true, the driver will immediately connect to the hardware and try to reset all fingers

  • dev_name – the dev to use for autostart. Default is /dev/ttyUSB0

virtual ~SVHFingerManager()
bool connect(const std::string &dev_name = "/dev/ttyUSB0", const unsigned int &retry_count = 3)

Open connection to SCHUNK five finger hand. Wait until expected return packages are received.

Parameters:
  • dev_name – file handle of the serial device e.g. “/dev/ttyUSB0”

  • _retry_count – The number of times a connection is tried to be established if at least one package was received

Returns:

true if connection was succesful

void disconnect()

disconnect SCHUNK five finger hand

inline bool isConnected()

returns connected state of finger manager

Returns:

bool true if the finger manager is connected to the hardware

bool resetChannel(const SVHChannel &channel)

reset function for channel

Parameters:

channel – Channel to reset

Returns:

true if the reset was successful

bool enableChannel(const SVHChannel &channel)

enable controller of channel

Parameters:

channel – channel to enable

Returns:

true if the enabling was successful

void disableChannel(const SVHChannel &channel)

disable controller of channel

Parameters:

channel – channel to disable

bool requestControllerFeedbackAllChannels()

sends request controller feedback packet for all channels

Returns:

true if the request was successfully send to the hardware

bool requestControllerFeedback(const SVHChannel &channel)

send request controller feedback paket

Parameters:

channel – channel to request the feedback for

Returns:

true if the request was successfully send to the hardware

bool getPosition(const SVHChannel &channel, double &position)

returns position value of channel (will not acces hardware but return latest value)

Parameters:
  • channel – channel to get the position of

  • position – position the given channel ist at

Returns:

bool true if a valid result was requested (i.e. an existing channel)

bool getCurrent(const SVHChannel &channel, double &current)

returns current value of channel

Parameters:
  • channel – channel to get the current of

  • current – current of the given channel in [mA]

Returns:

bool true if a valid result was requested (i.e. an existing channel)

bool setAllTargetPositions(const std::vector<double> &positions)

set all target positions at once

Parameters:

positions – Vector of positions to set as targets given in [rad]. Only the first eSVH_CHANNEL_DIMENSION (9) values will be considered. If less values are given all others are set to zero

Returns:

true if a valid and wellformed Target position for all fingers was given and send to the HW (i.e. inside the bound limits etc.)

bool setTargetPosition(const SVHChannel &channel, double position, double current)

set target position of a channel

Note

CURRENTLY NOT SUPPORTED!! WILL BE IGNORED

Parameters:
  • channel – channel to set the target position for

  • position – target position in [rad]

  • current – max current to use for that position

Returns:

true if a valid target position was given and it could be sent to the hardware

bool isEnabled(const SVHChannel &channel)

returns true, if current channel has been enabled

Parameters:

channel – channel to check if it is enabled

Returns:

true if the channel is enabled, false otherwise

bool isHomed(const SVHChannel &channel)

returns true, if current channel has been resetted

Parameters:

channel

Returns:

void requestControllerState()

requests the current controller state to be updated

Note

This is a debuging function. Should not be called by users

bool getCurrentSettings(const SVHChannel &channel, SVHCurrentSettings &current_settings)

returns actual current controller settings of channel

Parameters:
  • channel – channel to get the current controller settings for

  • current_settings – settings currently active for the current controller

Returns:

true if a valid result was requested (i.e. an existing channel)

bool getPositionSettings(const SVHChannel &channel, SVHPositionSettings &position_settings)

returns actual position controller settings of channel

Parameters:
  • channel – channel to get the position settings for

  • position_settings – settings currently active for the position controller

Returns:

true if a valid result was requested (i.e. an existing channel)

bool getHomeSettings(const SVHChannel &channel, SVHHomeSettings &home_settings)

returns actual home settings of channel

Parameters:
  • channel – channel to get the position settings for

  • home_settings – settings indicating the movement range of a finger, its reset direction and idle position

Returns:

true if a valid result was requested (i.e. an existing channel)

bool getDiagnosticStatus(const SVHChannel &channel, struct DiagnosticState &diagnostic_status)

returns actual diagnostic status of channel

Parameters:
  • channel – channel to get the position settings for

  • diagnostic_status – diagnostic data of motor and encoder

Returns:

true if a valid result was requested (i.e. an existing channel)

bool setCurrentSettings(const SVHChannel &channel, const SVHCurrentSettings &current_settings)

overwrite current parameters

Parameters:
  • channel – channel to set the current settings for

  • current_settings – settings of the current controller for a specific channel

Returns:

true if a valid channel was selected

bool setPositionSettings(const SVHChannel &channel, const SVHPositionSettings &position_settings)

overwrite position parameters

Parameters:
  • channel – channel to set the positoon settings for

  • position_settings – settings of the position controller to be used

Returns:

true if a valid channel was selected

bool setHomeSettings(const SVHChannel &channel, const SVHHomeSettings &home_settings)

setHomeSettings set the home Settings which are maily used doring reset and provide the soft limit for the fingers

Parameters:
  • channel – channel to set the home settings for

  • home_settings – settings indicating the movement range of a finger, its reset direction and idle position

Returns:

true if a valid channel was selected

bool resetDiagnosticData(const SVHChannel &channel)

resetDiagnosticData reset the diagnostic data vectors

Parameters:

channel – channel to reset the data vector for

Returns:

true if a valid channel was selected

std::vector<SVHCurrentSettings> getDefaultCurrentSettings()

get default current settings. These are either values previously set from calling software or hardcoded defaults

std::vector<SVHPositionSettings> getDefaultPositionSettings(const bool &reset = false)

get default position settings. These are either values previously set from calling software or hardcoded defaults \parm reset true if the Positions settins are to be used during reset (reduced speed)

void setDefaultHomeSettings()

initialize the homing settings with hardcoded defaults. These can be overwritten by the setHomeSettings function

void setResetSpeed(const float &speed)

setResetSpeed Set the speed percentage during reset

Parameters:

speed – percent of the normal speed used during reset Allowed values 0.0-1.0

void setResetTimeout(const int &reset_timeout)

setResetTimeout Helper function to set the timout durind rest of fingers

Parameters:

resetTimeout – timeout in Seconds. Values smaler than 0 will be interpreted as 0

bool setMaxForce(float max_force)

setMaxForce set the max force / current as a persentage of the maximum possible current

Parameters:

max_force – in percent [0,1] return if valid max_force was given

float setForceLimit(const SVHChannel &channel, float force_limit)

setForceLimit set the force limit for the given channel

Parameters:
  • channel – channel to set the force limit for

  • force_limit – force limit to set

Returns:

value if ok, else 0.0

double convertmAtoN(const SVHChannel &channel, const int16_t &current)

Converts joint currents of a specific channel from current [mA] to force [N] factoring the effort_constants of the channels.

Parameters:
  • channel – Channel to Convert for (each one has different constants)

  • current – Current in [mA]

Returns:

effort The desired effort in [N] (absolut)

SVHFirmwareInfo getFirmwareInfo(const std::string &dev_name = "/dev/ttyUSB0", const unsigned int &retry_count = 3)

getFirmwareInfo Requests the firmware information from the harware, waits a bit and returns the last one read.

Note

if no connection is open and the param dev_name is given, a connection is opened and closed after the readout.

Parameters:
  • dev_name – file handle of the serial device e.g. “/dev/ttyUSB0”

  • _retry_count – The number of times a connection is tried to be established if at least one package was received

Returns:

the last firmware information read (this may not be the one currently requested)

struct DiagnosticState

Public Members

bool diagnostic_encoder_state
bool diagnostic_motor_state
double diagnostic_current_maximum
double diagnostic_current_minimum
double diagnostic_position_maximum
double diagnostic_position_minimum
double diagnostic_deadlock