PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
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
14
namespace
px4_ros2
15
{
23
class
DirectActuatorsSetpointType
:
public
SetpointBase
24
{
25
public
:
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
51
private
:
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 */
px4_ros2::Context
Definition:
context.hpp:20
px4_ros2::DirectActuatorsSetpointType
Setpoint type for direct actuator control (servos and/or motors)
Definition:
direct_actuators.hpp:24
px4_ros2::DirectActuatorsSetpointType::updateMotors
void updateMotors(const Eigen::Matrix< float, kMaxNumMotors, 1 > &motor_commands)
px4_ros2::DirectActuatorsSetpointType::updateServos
void updateServos(const Eigen::Matrix< float, kMaxNumServos, 1 > &servo_commands)
px4_ros2::SetpointBase
Definition:
setpoint_base.hpp:20
px4_ros2::SetpointBase::Configuration
Definition:
setpoint_base.hpp:25
px4_ros2_cpp
include
px4_ros2
control
setpoint_types
direct_actuators.hpp
Generated by
1.9.1