Class qbSoftHandIndustryAPI

Class Documentation

class qbSoftHandIndustryAPI

Public Functions

qbSoftHandIndustryAPI()

Initialize the qb SoftHand Industry API handler by opening the proper UDP socket or, if any Elmo device is found, by serial port and test its communication. The constructor try to connect to the qb SoftHand Industry for at most 2 seconds and then returns. Through the method ‘isInitialized()’ is possible to test whether the initialization succeeded or not. The default IPv4 address used for the UDP socket connection is 192.168.1.110.

explicit qbSoftHandIndustryAPI(const bool &debug_serial)

Initialize the qb SoftHand Industry API handler by opening, if any Elmo device is found, a serial port and test its communication. Debug messages are printed on terminal. If serial fails, constructor tries default UDP connection.

explicit qbSoftHandIndustryAPI(const std::string &serial_port_name)

Initialize the qb SoftHand Industry API handler by opening, at the name indicated, a serial port and tests its communication. If serial fails, constructor tries default UDP connection.

explicit qbSoftHandIndustryAPI(const std::string &device_ip, const int &max_timeout)

Initialize the qb SoftHand Industry API handler by opening the proper UDP socket and by testing its communication. With the explicit definition of IP address, this method skips the search for serial connection. The constructor try to connect to the qb SoftHand Industry for at most max_timeout seconds and then returns. Through the method ‘isInitialized()’ is possible to test whether the initialization succeeded or not.

Parameters:
  • device_ip – The IPv4 address used for the UDP socket connection. It must be a valid IPv4 address.

  • max_timeout – Time interval for connection in seconds.

virtual ~qbSoftHandIndustryAPI()

Close the UDP socket and perform the proper shutdown procedures.

double getCurrent()

Get the actual qb SoftHand Industry motor torque in percent value w.r.t. the maximum value.

double getVoltage()

Get the Elmo input Voltage [V].

int getDigitalInputPosition(const int &index)

Get the position reference sent to the motor when the digital input is triggered.

Parameters:

index – The index of the digital input (3, 4 or 5).

int getDigitalInputVelocity(const int &index)

Get the velocity reference sent to the motor when the digital input is triggered.

Parameters:

index – The index of the digital input (3, 4 or 5).

int getDigitalInputCurrent(const int &index)

Get the current reference sent to the motor when the digital input is triggered.

Parameters:

index – The index of the digital input (3, 4 or 5).

double getPosition()

Get the actual qb SoftHand Industry motor position in percent value w.r.t. the maximum value.

double getVelocity()

Get the actual qb SoftHand Industry motor velocity in percent value w.r.t. the maximum value.

std::string getStatistics()

Get the qb SoftHand Industry device information.

std::string getStatisticsFull()

Get the qb SoftHand Industry full device information.

std::string getSerialNumber()

Get the qb SoftHand Industry Serial Number.

std::string getDeviceSerialNumber()

Get the Elmo Driver Serial Number.

std::string getFirmwareVersion()

Get the qb SoftHand Industry FW version.

std::string getIPAddress()

Get the qb SoftHand Industry IP address for UDP connection.

std::string getNetMask()

Get the qb SoftHand Industry netmask for UDP connection.

std::string getGateWayAddress()

Get the qb SoftHand Industry Gateway address for UDP connection.

int getMaxCurrentThreshold()

Get the maximum absorbed current from qb SoftHand Industry.

bool getWaitForStableGrasp()

Get the parameter that defines whether or not the device waits for the stable grasp .

bool getEthercatConnection()

Get the connection mode: 1 for Ethercat, 42330 for Ethernet.

int getHandSide()

Get the SoftHand Industry model configuration: 1 for Righ-Hand, 0 for Left-Side.

int setHandSide(const bool &is_right)

Set the SoftHand Industry model configuration.

Parameters:

conftrue for Righ-Hand, false for Left-Side.

Returns:

0 on success; -1 if the position is out of range; -3 if communication is lost.

int setEthercatConnection(const bool &mode)

Set the connection mode.

Parameters:

modetrue for Ethercat, false for Ethernet.

Returns:

0 on success; -1 if the position is out of range; -3 if communication is lost.

bool isInitialized()

Return true if the initialization procedure has succeeded.

Returns:

true on success.

void saveParams()

saves non-volatile parameters from the RAM to the flash memory

int setClosure(const float &position)

Send the given percent-position closure command reference to the qb SoftHand Industry.

Parameters:

position – The percent-position command reference, in range [0, 100]% where 0 is the fully open configuration, and 100 is the fully closed.

Returns:

0 on success; -1 if the position is out of range; -3 if communication is lost.

int setClosure(const float &position, const float &velocity, const float &current)

Send the given percent-position closure command reference to the qb SoftHand Industry, together with the speed reference command and the maximum force that should be applied during the grasp. This is the most complete command to send a reference to the qb SoftHand and should be used for special cases. In normal usage, the simpler version above should be preferred. All the parameters are expressed in percent w.r.t. the maximum possible value.

Parameters:
  • position – The percent-position command reference, in range [0, 100]% where 0 is the fully open configuration, and 100 is the fully closed.

  • velocity – The speed command reference, in range [12.5, 100]% where 12.5 is the minimum velocity of the closure, and 100 is full speed.

  • current – The current threshold for the motor, in range [62.5, 100]% where 62.5 is the minimum force that the hand can apply, and 100 is the maximum.

Returns:

0 on success; -1 if at least one of the percent values is out of range; -3 if communication is lost.

int setIP(const std::string &net_ip, const std::string &net_mask, const std::string &net_gateway)

Change the qb SoftHand Industry IPv4 address, network mask and gateway of the device. It is worth noticing that the device should be connected first to use this command.

Parameters:
  • net_ip – The device network IP address, e.g. 192.168.1.110.

  • net_mask – The device network mask, e.g. 255.255.255.0.

  • net_gateway – The device network gateway, e.g. 192.168.1.1.

Returns:

0 on success; -1 if at least one of the given IPv4-format addresses is wrong.

int setDigitalInputParams(const int &index, const int &position, const int &velocity, const int &current)

Set the position, velocity and current references to send to the motor when the digital input is triggered.

Parameters:
  • index – The index of the digital input (3, 4 or 5).

  • position – The reference position for the motor [0, 3800].

  • velocity – The reference velocity for the motor [400, 3200].

  • position – The reference current for the motor [250, 450].

int setWaitForStableGrasp(const bool &wait)

Set the parameter that blocks receiving new commands until the motor is stationary.

Parameters:

wait – if true, the device waits until the motor is stationary, false othewise.

Returns:

0 on success.

int waitForTargetReached()

Wait until the qb SoftHand Industry has reached the commanded position. This method should be called after a setClosure one, to wait for the action to be completed.

Returns:

0 on success; -3 if communication is lost.

int sendRawCommand(const std::string &command, const int &max_repeats)

Send a command to qbSoftHand Industry for max_repeats attempts.

Parameters:
  • command – the command to be exectuted

  • max_repeats – the attempts to be performed

Returns:

the response status