#include <algorithm>#include <string>#include <cmath>#include <boost/format.hpp>#include <stdexcept>#include <GeographicLib/Geodesic.hpp>#include <ros/ros.h>#include <tf/transform_datatypes.h>#include <tf2/utils.h>#include <tf2_ros/transform_listener.h>#include <tf2_ros/transform_broadcaster.h>#include <tf2_ros/static_transform_broadcaster.h>#include <tf2_geometry_msgs/tf2_geometry_msgs.h>#include <std_srvs/Trigger.h>#include <geometry_msgs/PoseStamped.h>#include <geometry_msgs/TwistStamped.h>#include <geometry_msgs/Vector3Stamped.h>#include <geometry_msgs/QuaternionStamped.h>#include <sensor_msgs/NavSatFix.h>#include <sensor_msgs/BatteryState.h>#include <mavros_msgs/CommandBool.h>#include <mavros_msgs/SetMode.h>#include <mavros_msgs/PositionTarget.h>#include <mavros_msgs/AttitudeTarget.h>#include <mavros_msgs/Thrust.h>#include <mavros_msgs/State.h>#include <mavros_msgs/StatusText.h>#include <mavros_msgs/ManualControl.h>#include <clover/GetTelemetry.h>#include <clover/Navigate.h>#include <clover/NavigateGlobal.h>#include <clover/SetPosition.h>#include <clover/SetVelocity.h>#include <clover/SetAttitude.h>#include <clover/SetRates.h>
Go to the source code of this file.
Macros | |
| #define | ENSURE_FINITE(var) { if (!std::isfinite(var)) throw std::runtime_error(#var " argument cannot be NaN or Inf"); } |
| #define | TIMEOUT(msg, timeout) (ros::Time::now() - msg.header.stamp > timeout) |
Enumerations | |
| enum | { YAW, YAW_RATE, TOWARDS } |
| enum | setpoint_type_t { NONE, NAVIGATE, NAVIGATE_GLOBAL, POSITION, VELOCITY, ATTITUDE, RATES } |
Functions | |
| void | checkManualControl () |
| void | checkState () |
| float | getDistance (const Point &from, const Point &to) |
| void | getNavigateSetpoint (const ros::Time &stamp, float speed, Point &nav_setpoint) |
| bool | getTelemetry (GetTelemetry::Request &req, GetTelemetry::Response &res) |
| PoseStamped | globalToLocal (double lat, double lon) |
| void | handleLocalPosition (const PoseStamped &pose) |
| template<typename T , T & STORAGE> | |
| void | handleMessage (const T &msg) |
| void | handleState (const mavros_msgs::State &s) |
| double | hypot (double x, double y, double z) |
| bool | land (std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res) |
| int | main (int argc, char **argv) |
| bool | navigate (Navigate::Request &req, Navigate::Response &res) |
| bool | navigateGlobal (NavigateGlobal::Request &req, NavigateGlobal::Response &res) |
| void | offboardAndArm () |
| void | publish (const ros::Time stamp) |
| void | publishBodyFrame () |
| void | publishSetpoint (const ros::TimerEvent &event) |
| bool | serve (enum setpoint_type_t sp_type, float x, float y, float z, float vx, float vy, float vz, float pitch, float roll, float yaw, float pitch_rate, float roll_rate, float yaw_rate, float lat, float lon, float thrust, float speed, string frame_id, bool auto_arm, uint8_t &success, string &message) |
| bool | setAttitude (SetAttitude::Request &req, SetAttitude::Response &res) |
| bool | setPosition (SetPosition::Request &req, SetPosition::Response &res) |
| bool | setRates (SetRates::Request &req, SetRates::Response &res) |
| bool | setVelocity (SetVelocity::Request &req, SetVelocity::Response &res) |
| bool | waitTransform (const string &target, const string &source, const ros::Time &stamp, const ros::Duration &timeout) |
| #define ENSURE_FINITE | ( | var | ) | { if (!std::isfinite(var)) throw std::runtime_error(#var " argument cannot be NaN or Inf"); } |
Definition at line 522 of file simple_offboard.cpp.
| #define TIMEOUT | ( | msg, | |
| timeout | |||
| ) | (ros::Time::now() - msg.header.stamp > timeout) |
Definition at line 186 of file simple_offboard.cpp.
| anonymous enum |
| Enumerator | |
|---|---|
| YAW | |
| YAW_RATE | |
| TOWARDS | |
Definition at line 122 of file simple_offboard.cpp.
| enum setpoint_type_t |
| Enumerator | |
|---|---|
| NONE | |
| NAVIGATE | |
| NAVIGATE_GLOBAL | |
| POSITION | |
| VELOCITY | |
| ATTITUDE | |
| RATES | |
Definition at line 110 of file simple_offboard.cpp.
|
inline |
Definition at line 492 of file simple_offboard.cpp.
|
inline |
Definition at line 513 of file simple_offboard.cpp.
Definition at line 334 of file simple_offboard.cpp.
Definition at line 339 of file simple_offboard.cpp.
| bool getTelemetry | ( | GetTelemetry::Request & | req, |
| GetTelemetry::Response & | res | ||
| ) |
Definition at line 188 of file simple_offboard.cpp.
| PoseStamped globalToLocal | ( | double | lat, |
| double | lon | ||
| ) |
Definition at line 355 of file simple_offboard.cpp.
| void handleLocalPosition | ( | const PoseStamped & | pose | ) |
Definition at line 165 of file simple_offboard.cpp.
| void handleMessage | ( | const T & | msg | ) |
Definition at line 135 of file simple_offboard.cpp.
| void handleState | ( | const mavros_msgs::State & | s | ) |
Definition at line 140 of file simple_offboard.cpp.
|
inline |
Definition at line 329 of file simple_offboard.cpp.
| bool land | ( | std_srvs::Trigger::Request & | req, |
| std_srvs::Trigger::Response & | res | ||
| ) |
Definition at line 800 of file simple_offboard.cpp.
Definition at line 848 of file simple_offboard.cpp.
| bool navigate | ( | Navigate::Request & | req, |
| Navigate::Response & | res | ||
| ) |
Definition at line 776 of file simple_offboard.cpp.
| bool navigateGlobal | ( | NavigateGlobal::Request & | req, |
| NavigateGlobal::Response & | res | ||
| ) |
Definition at line 780 of file simple_offboard.cpp.
| void offboardAndArm | ( | ) |
Definition at line 274 of file simple_offboard.cpp.
| void publish | ( | const ros::Time | stamp | ) |
Definition at line 383 of file simple_offboard.cpp.
|
inline |
Definition at line 149 of file simple_offboard.cpp.
| void publishSetpoint | ( | const ros::TimerEvent & | event | ) |
Definition at line 487 of file simple_offboard.cpp.
| bool serve | ( | enum setpoint_type_t | sp_type, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float | vx, | ||
| float | vy, | ||
| float | vz, | ||
| float | pitch, | ||
| float | roll, | ||
| float | yaw, | ||
| float | pitch_rate, | ||
| float | roll_rate, | ||
| float | yaw_rate, | ||
| float | lat, | ||
| float | lon, | ||
| float | thrust, | ||
| float | speed, | ||
| string | frame_id, | ||
| bool | auto_arm, | ||
| uint8_t & | success, | ||
| string & | message | ||
| ) |
Definition at line 524 of file simple_offboard.cpp.
| bool setAttitude | ( | SetAttitude::Request & | req, |
| SetAttitude::Response & | res | ||
| ) |
Definition at line 792 of file simple_offboard.cpp.
| bool setPosition | ( | SetPosition::Request & | req, |
| SetPosition::Response & | res | ||
| ) |
Definition at line 784 of file simple_offboard.cpp.
| bool setRates | ( | SetRates::Request & | req, |
| SetRates::Response & | res | ||
| ) |
Definition at line 796 of file simple_offboard.cpp.
| bool setVelocity | ( | SetVelocity::Request & | req, |
| SetVelocity::Response & | res | ||
| ) |
Definition at line 788 of file simple_offboard.cpp.
|
inline |
Definition at line 173 of file simple_offboard.cpp.
| ros::ServiceClient arming |
Definition at line 86 of file simple_offboard.cpp.
| ros::Duration arming_timeout |
Definition at line 70 of file simple_offboard.cpp.
| AttitudeTarget att_raw_msg |
Definition at line 93 of file simple_offboard.cpp.
| ros::Publisher attitude_pub |
Definition at line 83 of file simple_offboard.cpp.
| ros::Publisher attitude_raw_pub |
Definition at line 83 of file simple_offboard.cpp.
| bool auto_release |
Definition at line 78 of file simple_offboard.cpp.
| BatteryState battery |
Definition at line 131 of file simple_offboard.cpp.
| ros::Duration battery_timeout |
Definition at line 75 of file simple_offboard.cpp.
| geometry_msgs::TransformStamped body |
Definition at line 97 of file simple_offboard.cpp.
| bool busy = false |
Definition at line 106 of file simple_offboard.cpp.
| bool check_kill_switch |
Definition at line 79 of file simple_offboard.cpp.
| float default_speed |
Definition at line 77 of file simple_offboard.cpp.
| string fcu_frame |
Definition at line 65 of file simple_offboard.cpp.
| NavSatFix global_position |
Definition at line 130 of file simple_offboard.cpp.
| ros::Duration global_position_timeout |
Definition at line 74 of file simple_offboard.cpp.
| bool land_only_in_offboard |
Definition at line 79 of file simple_offboard.cpp.
| ros::Duration land_timeout |
Definition at line 69 of file simple_offboard.cpp.
| string local_frame |
Definition at line 64 of file simple_offboard.cpp.
| PoseStamped local_position |
Definition at line 128 of file simple_offboard.cpp.
| ros::Duration local_position_timeout |
Definition at line 71 of file simple_offboard.cpp.
| mavros_msgs::ManualControl manual_control |
Definition at line 127 of file simple_offboard.cpp.
| ros::Duration manual_control_timeout |
Definition at line 76 of file simple_offboard.cpp.
| bool nav_from_sp |
Definition at line 79 of file simple_offboard.cpp.
| bool nav_from_sp_flag = false |
Definition at line 108 of file simple_offboard.cpp.
| float nav_speed |
Definition at line 105 of file simple_offboard.cpp.
| PoseStamped nav_start |
Definition at line 100 of file simple_offboard.cpp.
| ros::Duration offboard_timeout |
Definition at line 68 of file simple_offboard.cpp.
| PoseStamped position_msg |
Definition at line 91 of file simple_offboard.cpp.
| ros::Publisher position_pub |
Definition at line 83 of file simple_offboard.cpp.
| PositionTarget position_raw_msg |
Definition at line 92 of file simple_offboard.cpp.
| ros::Publisher position_raw_pub |
Definition at line 83 of file simple_offboard.cpp.
| TwistStamped rates_msg |
Definition at line 95 of file simple_offboard.cpp.
| ros::Publisher rates_pub |
Definition at line 83 of file simple_offboard.cpp.
| std::map<string, string> reference_frames |
Definition at line 80 of file simple_offboard.cpp.
| ros::ServiceClient set_mode |
Definition at line 86 of file simple_offboard.cpp.
| TransformStamped setpoint |
Definition at line 96 of file simple_offboard.cpp.
| QuaternionStamped setpoint_attitude |
Definition at line 103 of file simple_offboard.cpp.
| QuaternionStamped setpoint_attitude_transformed |
Definition at line 103 of file simple_offboard.cpp.
| PoseStamped setpoint_position |
Definition at line 101 of file simple_offboard.cpp.
| PoseStamped setpoint_position_transformed |
Definition at line 101 of file simple_offboard.cpp.
| ros::Timer setpoint_timer |
Definition at line 89 of file simple_offboard.cpp.
| enum setpoint_type_t setpoint_type = NONE |
Definition at line 120 of file simple_offboard.cpp.
| Vector3Stamped setpoint_velocity |
Definition at line 102 of file simple_offboard.cpp.
| Vector3Stamped setpoint_velocity_transformed |
Definition at line 102 of file simple_offboard.cpp.
| float setpoint_yaw_rate |
Definition at line 104 of file simple_offboard.cpp.
| enum { ... } setpoint_yaw_type |
| mavros_msgs::State state |
Definition at line 125 of file simple_offboard.cpp.
| ros::Duration state_timeout |
Definition at line 72 of file simple_offboard.cpp.
| std::shared_ptr<tf2_ros::StaticTransformBroadcaster> static_transform_broadcaster |
Definition at line 61 of file simple_offboard.cpp.
| mavros_msgs::StatusText statustext |
Definition at line 126 of file simple_offboard.cpp.
| TransformStamped target |
Definition at line 96 of file simple_offboard.cpp.
| ros::Duration telemetry_transform_timeout |
Definition at line 67 of file simple_offboard.cpp.
| tf2_ros::Buffer tf_buffer |
Definition at line 59 of file simple_offboard.cpp.
| Thrust thrust_msg |
Definition at line 94 of file simple_offboard.cpp.
| ros::Publisher thrust_pub |
Definition at line 83 of file simple_offboard.cpp.
Definition at line 90 of file simple_offboard.cpp.
| std::shared_ptr<tf2_ros::TransformBroadcaster> transform_broadcaster |
Definition at line 60 of file simple_offboard.cpp.
| ros::Duration transform_timeout |
Definition at line 66 of file simple_offboard.cpp.
| TwistStamped velocity |
Definition at line 129 of file simple_offboard.cpp.
| ros::Duration velocity_timeout |
Definition at line 73 of file simple_offboard.cpp.
| bool wait_armed = false |
Definition at line 107 of file simple_offboard.cpp.