sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas::RobotDriverBrov2 Class Reference

SAS driver for the BlueROV2. The "joint torques" interface is a 6D wrench that is allocated to thrusters and sent as PWM through MAVROS RC override. The position interface is not supported. More...

#include <sas_robot_driver_brov2.hpp>

Inheritance diagram for sas::RobotDriverBrov2:
marinholab::sas::core::RobotDriver

Classes

class  Impl

Public Member Functions

 RobotDriverBrov2 (const RobotDriverBrov2 &)=delete
 RobotDriverBrov2 (const RobotDriverBrov2Configuration &configuration, const std::shared_ptr< marinholab::sas::core::ShutdownSignaler > &shutdown_signaler)
 Constructor.
Eigen::VectorXd get_joint_positions () override
 Get the last commanded PWM vector (there is no sensor feedback).
void set_target_joint_positions (const Eigen::VectorXd &q) override
 Not supported.
Eigen::VectorXd get_joint_torques () override
 Get the last commanded wrench.
void set_target_joint_torques (const Eigen::VectorXd &tau) override
 Command a 6D wrench, which is allocated to the thrusters and sent as PWM.
void connect () override
 Create the ROS node and the RC override publisher.
void disconnect () override
 Release the ROS resources created in connect().
void initialize () override
 Configure the autopilot servo parameters and send neutral commands.
void deinitialize () override
 Return the thrusters to neutral.
Public Member Functions inherited from marinholab::sas::core::RobotDriver
virtual ~RobotDriver ()
 Virtual destructor for RobotDriver.
virtual Eigen::VectorXd get_joint_velocities ()
 Get current joint velocities.
virtual void set_target_joint_velocities (const Eigen::VectorXd &set_target_joint_velocities)
 Set target joint velocities.
virtual std::tuple< Eigen::VectorXd, Eigen::VectorXd > get_joint_limits ()
 Get joint limits (min, max).
virtual void set_joint_limits (const std::tuple< Eigen::VectorXd, Eigen::VectorXd > &joint_limits)
 Set joint limits (min, max).
void watchdog_start (const std::chrono::nanoseconds &period)
 Start the watchdog thread with the given period.
void watchdog_trigger (const std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > &time_point_from_the_client, const std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > &time_point_from_the_server, const bool &status)
 Trigger the watchdog with timestamps from client/server and the current status.
void watchdog_set_maximum_acceptable_delay (const double &max_acceptable_delay)
 Set the maximum acceptable delay for the watchdog (seconds).
void check_for_watchdog_exceptions ()
 Check for exceptions thrown by the watchdog thread and rethrow if present.
void set_control_loop_callback (std::function< void()> callback)
 Set the control loop callback function.
void execute_control_loop_callback ()
 Execute the control loop callback if it has been set.
bool control_loop_callback_is_set ()
 Check if a control loop callback has been set.

Additional Inherited Members

Public Types inherited from marinholab::sas::core::RobotDriver
enum class  Functionality {
  None = 0 , PositionControl , VelocityControl , ForceControl ,
  Homing , ClearPositions , Watchdog
}
 Enumeration of optional driver functionalities.
Protected Member Functions inherited from marinholab::sas::core::RobotDriver
void _watchdog_thread_function ()
 RobotDriver::_watchdog_thread_function throws an exception if the elapsed time since the last trigger exceeds the specified period.
 RobotDriver (const std::shared_ptr< ShutdownSignaler > &shutdown_signaler_)
 RobotDriver (std::atomic_bool *break_loops)
 RobotDriver (const RobotDriver &)=delete
Protected Attributes inherited from marinholab::sas::core::RobotDriver
std::atomic_bool * break_loops_
std::shared_ptr< ShutdownSignaler > shutdown_signaler_
std::tuple< Eigen::VectorXd, Eigen::VectorXd > joint_limits_
Eigen::VectorXd joint_velocities_
Eigen::VectorXd joint_torques_
std::unique_ptr< marinholab::sas::core::Clock > clock_
std::unique_ptr< std::thread > watchdog_thread_
std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > time_point_from_the_client_
std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > time_point_from_the_server_
bool watchdog_status_
std::mutex mutex_watchdog_
double max_acceptable_delay_ = 0.1
double watchdog_period_
std::exception_ptr watchdog_exception_ {nullptr}
std::mutex watchdog_exception_mutex_
std::function< void()> control_loop_callback_

Detailed Description

SAS driver for the BlueROV2. The "joint torques" interface is a 6D wrench that is allocated to thrusters and sent as PWM through MAVROS RC override. The position interface is not supported.

Constructor & Destructor Documentation

◆ RobotDriverBrov2()

sas::RobotDriverBrov2::RobotDriverBrov2 ( const RobotDriverBrov2Configuration & configuration,
const std::shared_ptr< marinholab::sas::core::ShutdownSignaler > & shutdown_signaler )

Constructor.

Parameters
configurationThe driver configuration.
shutdown_signalerShared shutdown signaler, typically shared with the ROS wrapper.

Member Function Documentation

◆ connect()

void sas::RobotDriverBrov2::connect ( )
overridevirtual

Create the ROS node and the RC override publisher.

RobotDriverBrov2::connect.

Usually this method will connect to a given ip address. It is also common for this part of the code to stop running programs or turn the robot off. This function is expected to throw an exception of something goes wrong. For instance, if the connection is not established an exception MUST be thrown.

Implements marinholab::sas::core::RobotDriver.

◆ deinitialize()

void sas::RobotDriverBrov2::deinitialize ( )
overridevirtual

Return the thrusters to neutral.

RobotDriverBrov2::deinitialize. For safety reasons, this MUST NOT throw exceptions.

Implements marinholab::sas::core::RobotDriver.

◆ disconnect()

void sas::RobotDriverBrov2::disconnect ( )
overridevirtual

Release the ROS resources created in connect().

RobotDriverBrov2::disconnect For safety reasons, this MUST NOT throw exceptions.

Implements marinholab::sas::core::RobotDriver.

◆ get_joint_positions()

Eigen::VectorXd sas::RobotDriverBrov2::get_joint_positions ( )
overridevirtual

Get the last commanded PWM vector (there is no sensor feedback).

Returns
The last commanded PWM, one entry per thruster.
Exceptions
std::runtime_errorif not connected or not yet commanded.

Implements marinholab::sas::core::RobotDriver.

◆ get_joint_torques()

Eigen::VectorXd sas::RobotDriverBrov2::get_joint_torques ( )
overridevirtual

Get the last commanded wrench.

RobotDriverBrov2::get_joint_torques Returns the last commanded wrench. This method throws an exception if called in an invalid state (not connected, not initialized, or not yet commanded).

Returns
The last commanded 6D wrench.
Exceptions
std::runtime_errorif not connected, not initialized, or not yet commanded.
Returns
an Eigen::VectorXd with the last commanded 6D wrench.

Reimplemented from marinholab::sas::core::RobotDriver.

◆ initialize()

void sas::RobotDriverBrov2::initialize ( )
overridevirtual

Configure the autopilot servo parameters and send neutral commands.

RobotDriverBrov2::initialize.

This method is expected to turn the robot on and initialize the internal joint control loop. If there are any issues, this MUST throw an exception so that the program will finish cleanly.

After this method finishes target joint states can be received.

Implements marinholab::sas::core::RobotDriver.

◆ set_target_joint_positions()

void sas::RobotDriverBrov2::set_target_joint_positions ( const Eigen::VectorXd & q)
overridevirtual

Not supported.

Exceptions
std::runtime_erroralways. Use set_target_joint_torques().

Implements marinholab::sas::core::RobotDriver.

◆ set_target_joint_torques()

void sas::RobotDriverBrov2::set_target_joint_torques ( const Eigen::VectorXd & tau)
overridevirtual

Command a 6D wrench, which is allocated to the thrusters and sent as PWM.

RobotDriverBrov2::set_target_joint_torques Allocates the desired 6D wrench to the thrusters, converts the thruster forces to PWM, and publishes them as an RC override.

Parameters
tauThe desired 6D wrench.
Exceptions
std::runtime_errorif not connected/initialized or if tau is not 6D.
Parameters
tauThe desired 6D wrench.

Reimplemented from marinholab::sas::core::RobotDriver.


The documentation for this class was generated from the following files:
  • src/sas_robot_driver_brov2/include/sas_robot_driver_brov2/sas_robot_driver_brov2.hpp
  • src/sas_robot_driver_brov2/src/sas_robot_driver_brov2.cpp