PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
Loading...
Searching...
No Matches
goto.hpp
1/****************************************************************************
2 * Copyright (c) 2023 PX4 Development Team.
3 * SPDX-License-Identifier: BSD-3-Clause
4 ****************************************************************************/
5
6#pragma once
7
8#include <Eigen/Eigen>
9#include <optional>
10#include <px4_msgs/msg/goto_setpoint.hpp>
11#include <px4_ros2/common/setpoint_base.hpp>
12#include <px4_ros2/utils/geodesic.hpp>
13
14namespace px4_ros2 {
23 public:
24 explicit MulticopterGotoSetpointType(Context& context);
25
26 ~MulticopterGotoSetpointType() override = default;
27
28 SetpointType getSetpointType() override
29 {
30 return px4_msgs::msg::SetpointConfig::TYPE_MULTICOPTER_GOTO;
31 }
32
44 void update(const Eigen::Vector3f& position, const std::optional<float>& heading = {},
45 const std::optional<float>& max_horizontal_speed = {},
46 const std::optional<float>& max_vertical_speed = {},
47 const std::optional<float>& max_heading_rate = {});
48
49 float desiredUpdateRateHz() override { return 30.f; }
50
51 private:
52 rclcpp::Node& _node;
53 rclcpp::Publisher<px4_msgs::msg::GotoSetpoint>::SharedPtr _goto_setpoint_pub;
54};
55
60 public:
62
64
76 void update(const Eigen::Vector3d& global_position, const std::optional<float>& heading = {},
77 const std::optional<float>& max_horizontal_speed = {},
78 const std::optional<float>& max_vertical_speed = {},
79 const std::optional<float>& max_heading_rate = {});
80
81 private:
82 rclcpp::Node& _node;
83 std::unique_ptr<MapProjection> _map_projection;
84 std::shared_ptr<MulticopterGotoSetpointType> _goto_setpoint;
85};
86
88} /* namespace px4_ros2 */
Definition context.hpp:18
Setpoint type for smooth global position and heading control.
Definition goto.hpp:59
void update(const Eigen::Vector3d &global_position, const std::optional< float > &heading={}, const std::optional< float > &max_horizontal_speed={}, const std::optional< float > &max_vertical_speed={}, const std::optional< float > &max_heading_rate={})
Go-to global setpoint update.
Setpoint type for smooth position and heading control.
Definition goto.hpp:22
SetpointType getSetpointType() override
Definition goto.hpp:28
void update(const Eigen::Vector3f &position, const std::optional< float > &heading={}, const std::optional< float > &max_horizontal_speed={}, const std::optional< float > &max_vertical_speed={}, const std::optional< float > &max_heading_rate={})
Go-to setpoint update.
Definition setpoint_base.hpp:20