PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
Loading...
Searching...
No Matches
direct_actuators.hpp
1/****************************************************************************
2 * Copyright (c) 2023 PX4 Development Team.
3 * SPDX-License-Identifier: BSD-3-Clause
4 ****************************************************************************/
5
6#pragma once
7
8#include <px4_msgs/msg/actuator_motors.hpp>
9#include <px4_msgs/msg/actuator_servos.hpp>
10#include <Eigen/Core>
11
12#include <px4_ros2/common/setpoint_base.hpp>
13
14namespace px4_ros2
15{
24{
25public:
26 explicit DirectActuatorsSetpointType(Context & context);
27
28 static constexpr int kMaxNumMotors = px4_msgs::msg::ActuatorMotors::NUM_CONTROLS;
29 static constexpr int kMaxNumServos = px4_msgs::msg::ActuatorServos::NUM_CONTROLS;
30
31 ~DirectActuatorsSetpointType() override = default;
32
33 Configuration getConfiguration() override;
34 float desiredUpdateRateHz() override {return 200.f;}
35
41 void updateServos(const Eigen::Matrix<float, kMaxNumServos, 1> & servo_commands);
42
49 void updateMotors(const Eigen::Matrix<float, kMaxNumMotors, 1> & motor_commands);
50
51private:
52 rclcpp::Node & _node;
53 rclcpp::Publisher<px4_msgs::msg::ActuatorMotors>::SharedPtr _actuator_motors_pub;
54 rclcpp::Publisher<px4_msgs::msg::ActuatorServos>::SharedPtr _actuator_servos_pub;
55};
56
58} /* namespace px4_ros2 */
Definition context.hpp:20
Setpoint type for direct actuator control (servos and/or motors)
Definition direct_actuators.hpp:24
void updateMotors(const Eigen::Matrix< float, kMaxNumMotors, 1 > &motor_commands)
void updateServos(const Eigen::Matrix< float, kMaxNumServos, 1 > &servo_commands)
Definition setpoint_base.hpp:20
Definition setpoint_base.hpp:25