Class SVHController

Class Documentation

class SVHController

This class controls the the SCHUNK five finger hand.

The controller manages all calls to the hardware and receives every feedback. All data is interpreted and stored in the apropriate objects that can be queried by others.

Note

Be carefull what you change in here as it interfaces directly with the hardware

Public Functions

SVHController()

Constructs a controller class for the SCHUNK five finger hand.

~SVHController()

SCHUNK five finger hand destructor Destructor, disable the serial device and shut down hand as far as possible

bool connect(const std::string &dev_name)

Open serial device connection.

Parameters:

dev_name – System handle (filename in linux) to the device

Returns:

true if connect was successfull

void disconnect()

disconnect serial device

void setControllerTarget(const SVHChannel &channel, const int32_t &position)

Set new position target for finger index.

Parameters:
  • channel – Motorchanel to set the target for

  • position – Target position for the channel given in encoder Ticks

void setControllerTargetAllChannels(const std::vector<int32_t> &positions)

Setting new position controller target for all fingers.

Parameters:

positions – Target positions for all fingers, Only the first nine values will be evaluated

void enableChannel(const SVHChannel &channel)

Enable one or all motor channels.

Parameters:

channel – Motor to activate

void disableChannel(const SVHChannel &channel)

Disable one or all motor channels.

Parameters:

channel – Motor to deactivate

void requestControllerState()

Request current controller state (mainly usefull for debug purposes)

void requestControllerFeedback(const SVHChannel &channel)

request feedback (position and current) to a specific channel

Parameters:

channel – Motorchannel the feedback should be provided for

void requestPositionSettings(const SVHChannel &channel)

request the settings of the position controller for a specific channel

Parameters:

channel – Motor to request the settings for

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

activate a new set of position controller settings for a specific channel

Parameters:
  • channel – Motor the new position controller settings will be applied to

  • position_settings – new settings of the position controller

void requestCurrentSettings(const SVHChannel &channel)

request the settings of the current controller for a specific channel

Parameters:

channel – Motor to request the settings for

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

activate a new set of current controller settings for a specific channel

Parameters:
  • channel – Motor the new current controller settings will be applied to

  • current_settings – new settings of the current controller

void requestEncoderValues()

read out the mutipliers for the encoders from the hardware

void setEncoderValues(const SVHEncoderSettings &encoder_settings)

sends a new set of encodervalues to the hardware

Parameters:

encoder_settings – to set (prescalers)

void requestFirmwareInfo()

request a transmission of formware information

void receivedPacketCallback(const SVHSerialPacket &packet, unsigned int packet_count)

callback function for interpretation of packages

Parameters:
  • packet – SerialPacket containing the raw data, integrity should have been checked by SerialInterface

  • packet_count – count of received packets

bool getControllerFeedback(const SVHChannel &channel, SVHControllerFeedback &controller_feedback)

request the latest stored controllerfeedback (current, position) from the controller.

Controllerfeedback (crurrent,channel) is stored/updated in the controller once it is send by the hardware. This is the case once a controlCommand has been send or the feedback has specifically been requested by using the getControllerFeedback() function

Parameters:
  • channel – Motor to get the latest feedback to

  • ControllerFeedback – (current, encoder position) of the specified channel

Returns:

true if the feedback could be read, false otherwise

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

request the latest stored positionsettings from the controller

Parameters:
  • channel – Motor to get the positionsettings for

  • position_settings – position settings to be returned

Returns:

true if the request was succesfull false otherwise

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

request the latest stored currentsettings from the controller

Parameters:
  • channel – Motor to get the currentsettings for

  • position_settings – current settings to be returned

Returns:

true if the request was succesfull false otherwise

SVHFirmwareInfo getFirmwareInfo()

get the latest stored Firmware information from the controller (NOT THE HARDWARE)

Returns:

the Firmware information

unsigned int getSentPackageCount()

requests the number of sent packages. Request ist transferred to the serial interface that knows about this count

Returns:

number of packages correctly sent

unsigned int getReceivedPackageCount()

request the number of correctly received packages. This number is refreshed every time the serialinterace calls the receivedPacket callback

Returns:

number of packages correctly received

void resetPackageCounts()

resetPackageCounts sets the sent and reveived package counts to zero

bool isEnabled(const SVHChannel &channel)

Check if a channel was enabled.

Parameters:

channel – to check

Returns:

True if an enable has been send to the hardware

void getControllerFeedbackAllChannels(SVHControllerFeedbackAllChannels &controller_feedback)

Get all currently available controllerfeedbacks.

Public Static Attributes

static const char *m_channel_description[]

Description values to get the corresponding string value to a channel enum.

static const float CHANNEL_EFFORT_CONSTANTS[9][2]

Effort multipliers to calculate the torque of the motors for the individual channels.