Class qbSoftHandIndustryCommunicationHandler

Class Documentation

class qbSoftHandIndustryCommunicationHandler

The Communication Handler class is aimed to instantiate a ROS node which provides several ROS services to communicate with one - or many - qbrobotics SoftHand Industry connected to the ROS ecosystem.

Public Functions

qbSoftHandIndustryCommunicationHandler(rclcpp::Node::SharedPtr &node)

Protected Functions

virtual int activate(const bool &command, const int &max_repeats)

Activate the motors of the device. Do nothing if the device is not connected in the Communication Handler.

See also

activateCallback(), activate(const int &, const bool &, const int &), isActive()

Parameters:

max_repeats – The maximum number of consecutive repetitions to mark retrieved data as corrupted.

bool activateCallback(const std::shared_ptr<qb_softhand_industry_srvs::srv::Trigger::Request> request, std::shared_ptr<qb_softhand_industry_srvs::srv::Trigger::Response> response)

Activate the motors of the SoftHand Industry relative to the node requesting the service.

See also

activate(const int &, const int &)

Parameters:
  • request – The request of the given service (see qb_softhand_industry_srvs::srv::Trigger for details).

  • response – The response of the given service (see qb_softhand_industry_srvs::srv::Trigger for details).

Returns:

true if the call succeed (actually response.success may be false).

bool deactivateCallback(const std::shared_ptr<qb_softhand_industry_srvs::srv::Trigger::Request> request, std::shared_ptr<qb_softhand_industry_srvs::srv::Trigger::Response> response)

Deactivate the motors of the SoftHand Industry relative to the node requesting the service.

See also

activate(const int &, const int &)

Parameters:
  • request – The request of the given service (see qb_softhand_industry_srvs::srv::Trigger for details).

  • response – The response of the given service (see qb_softhand_industry_srvs::srv::Trigger for details).

Returns:

true if the call succeed (actually response.success may be false).

bool getMeasurementsCallback(const std::shared_ptr<qb_softhand_industry_srvs::srv::GetMeasurements::Request> request, std::shared_ptr<qb_softhand_industry_srvs::srv::GetMeasurements::Response> response)

Get measurements from SoftHand Industry relative to the node requesting the service.

Parameters:
  • request – The request of the given service (see qb_softhand_industry_srvs::srv::GetMeasurements for details).

  • response – The response of the given service (see qb_softhand_industry_srvs::srv::GetMeasurements for details).

Returns:

true if the call succeed (actually response.success may be false).

bool isValidCurrent(const int &current)

Validate current.

Parameters:

current – parameter to validate

Returns:

true if valid, false otherwise

bool isValidPosition(const int &position)

Validate position.

Parameters:

position – parameter to validate

Returns:

true if valid, false otherwise

bool isValidVelocity(const int &velocity)

Validate velocity.

Parameters:

velocity – parameter to validate

Returns:

true if valid, false otherwise

int setCommand(const int &command, const int &max_repeats)

Send a movement command to SoftHand Industry.

Parameters:

command – the position reference command [ticks]

Returns:

the response status

int setCommands(const int &position, const int &velocity, const int &current, const int &max_repeats)

Send a movement command to SoftHand Industry.

Parameters:
  • command – the command [ticks]

  • velocity – [ticks/s]

  • current – [mA]

Returns:

the response status

bool setCommandCallback(const std::shared_ptr<qb_softhand_industry_srvs::srv::SetCommand::Request> request, std::shared_ptr<qb_softhand_industry_srvs::srv::SetCommand::Response> response)

Send a command to SoftHand Industry.

Parameters:
  • request – The request of the given service (see qb_softhand_industry_srvs::setCommand for details).

  • response – The response of the given service (see qb_softhand_industry_srvs::setCommand for details).

Returns:

true if the call succeed (actually response.success may be false).

bool setCommandsCallback(const std::shared_ptr<qb_softhand_industry_srvs::srv::SetCommands::Request> request, std::shared_ptr<qb_softhand_industry_srvs::srv::SetCommands::Response> response)

Send a command to SoftHand Industry.

Parameters:
  • request – The request of the given service (see qb_softhand_industry_srvs::setCommands for details).

  • response – The response of the given service (see qb_softhand_industry_srvs::setCommands for details).

Returns:

true if the call succeed (actually response.success may be false).

Protected Attributes

rclcpp::Node::SharedPtr node_handle_
rclcpp::Parameter ip_
rclcpp::Parameter serial_port_name_
rclcpp::Parameter use_only_ethernet
const rclcpp::NodeOptions &options_ = (rclcpp::NodeOptions().allow_undeclared_parameters(true).automatically_declare_parameters_from_overrides(true))
std::unique_ptr<qbsofthand_industry_api::qbSoftHandIndustryAPI> api_handler_