|
sas
Modularised monitoring, logging, and control of robots.
|
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>
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_ |
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.
| sas::RobotDriverBrov2::RobotDriverBrov2 | ( | const RobotDriverBrov2Configuration & | configuration, |
| const std::shared_ptr< marinholab::sas::core::ShutdownSignaler > & | shutdown_signaler ) |
Constructor.
| configuration | The driver configuration. |
| shutdown_signaler | Shared shutdown signaler, typically shared with the ROS wrapper. |
|
overridevirtual |
Create the ROS node and the RC override publisher.
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.
|
overridevirtual |
Return the thrusters to neutral.
RobotDriverBrov2::deinitialize. For safety reasons, this MUST NOT throw exceptions.
Implements marinholab::sas::core::RobotDriver.
|
overridevirtual |
Release the ROS resources created in connect().
RobotDriverBrov2::disconnect For safety reasons, this MUST NOT throw exceptions.
Implements marinholab::sas::core::RobotDriver.
|
overridevirtual |
Get the last commanded PWM vector (there is no sensor feedback).
| std::runtime_error | if not connected or not yet commanded. |
Implements marinholab::sas::core::RobotDriver.
|
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).
| std::runtime_error | if not connected, not initialized, or not yet commanded. |
Reimplemented from marinholab::sas::core::RobotDriver.
|
overridevirtual |
Configure the autopilot servo parameters and send neutral commands.
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.
|
overridevirtual |
Not supported.
| std::runtime_error | always. Use set_target_joint_torques(). |
Implements marinholab::sas::core::RobotDriver.
|
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.
| tau | The desired 6D wrench. |
| std::runtime_error | if not connected/initialized or if tau is not 6D. |
| tau | The desired 6D wrench. |
Reimplemented from marinholab::sas::core::RobotDriver.