10#ifndef _ACTUATOR_RP2040_DRIVER_HPP
11#define _ACTUATOR_RP2040_DRIVER_HPP
13#include <driver_msgs/msg/actuator.hpp>
14#include <geometry_msgs/msg/wrench_stamped.hpp>
15#include <proto_files/conversion_driver_msgs__Actuator.hpp>
16#include <protolink/client.hpp>
17#include <rclcpp/rclcpp.hpp>
18#include <std_msgs/msg/bool.hpp>
41 static constexpr size_t NUM_THRUSTERS = 6;
46 static constexpr float theta_h = 30.0f * M_PI / 180.0f;
47 static constexpr float theta_v = 30.0f * M_PI / 180.0f;
48 static constexpr float dist_hx = 0.19f;
49 static constexpr float dist_hy = 0.14f;
50 static constexpr float dist_vy = 0.19f;
51 static constexpr float dist_vz = 0.14f;
54 const float f_x_scale;
55 const float f_y_scale;
56 const float f_z_scale;
57 const float t_x_scale;
58 const float t_z_scale;
61 bool heartbeat{
false};
63 std::shared_ptr<timer::Timeout> timeout_;
66 protolink::IoContext io_context_;
67 std::shared_ptr<protolink::serial_protocol::port> port_;
68 using ProtoActuator = protolink__driver_msgs__Actuator::driver_msgs__Actuator;
69 std::shared_ptr<protolink::serial_protocol::Publisher<ProtoActuator>> protolink_publisher_;
71 driver_msgs::msg::Actuator msg_buffer_;
74 rclcpp::Publisher<driver_msgs::msg::Thruster>::SharedPtr thruster_pub_;
75 rclcpp::Subscription<geometry_msgs::msg::WrenchStamped>::SharedPtr wrench_sub_;
76 rclcpp::Subscription<driver_msgs::msg::LED>::SharedPtr led_sub_;
77 rclcpp::Subscription<std_msgs::msg::Bool>::SharedPtr heartbeat_sub_;
80 void wrench_callback(geometry_msgs::msg::WrenchStamped::SharedPtr _msg);
81 void led_callback(driver_msgs::msg::LED::SharedPtr _msg);
82 void heartbeat_callback(std_msgs::msg::Bool::SharedPtr _msg);
85 std::array<float, NUM_THRUSTERS> _wrench2thrusts(
86 float f_x,
float f_y,
float f_z,
float t_x,
float t_z);
88 float _restrict_thrust(std::array<float, NUM_THRUSTERS> & thrusts);
actuator class with thruster mixing logic
Definition: actuator_rp2040_driver.hpp:28
Definition: actuator_rp2040_driver.hpp:22