aerostack2
-
struct Acro_command
-
class ACROMotion : public as2::motionReferenceHandlers::BasicMotionReferenceHandler
- #include <acro_motion.hpp>
The ACROMotion class is a motion reference handler that moves the robot to a given acro.
Public Functions
-
explicit ACROMotion(as2::Node *node_ptr, const std::string &ns = "")
ACROMotion Constructor.
- Parameters:
node – as2::Node pointer.
-
inline ~ACROMotion()
ACROMotion Destructor.
-
bool sendACRO(const as2_msgs::msg::Thrust &thrust, const geometry_msgs::msg::Vector3 &angular_rates)
sendACRO sends a acro to the robot.
Using the time stamp and frame id from the thrust message. Frame id should be base_link.
- Parameters:
thrust – as2_msgs::msg::Thrust to be sent.
angular_rates – geometry_msgs::msg::Vector3 to be sent.
- Returns:
true if the command was sent successfully, false otherwise.
-
explicit ACROMotion(as2::Node *node_ptr, const std::string &ns = "")
-
class AerialPlatform : public as2::Node
- #include <aerial_platform.hpp>
Base class for all Aerial platforms. It provides the basic functionality for the platform. It is responsible for handling the platform state machine and the platform status. It also handles the command subscriptions and the basic platform services.
Subclassed by as2_platform_multirotor_simulator::MultirotorSimulatorPlatform, gazebo_platform::GazeboPlatform
Public Functions
-
explicit AerialPlatform(const rclcpp::NodeOptions &options = rclcpp::NodeOptions())
Construct a new Aerial Platform object, with default parameters.
-
AerialPlatform(const std::string &ns, const rclcpp::NodeOptions &options = rclcpp::NodeOptions())
Construct a new Aerial Platform object, with default parameters.
-
inline ~AerialPlatform()
-
virtual void configureSensors() = 0
Configures the platform sensors.
-
virtual bool ownSendCommand() = 0
Handles how a command must be sended in the concrete platform.
- Returns:
true command is sended successfully.
- Returns:
false command is not sended.
-
virtual bool ownSetArmingState(bool state) = 0
Handles how arming state has to be settled in the concrete platform.
- Parameters:
state – true for arming the platform, false to disarm.
- Returns:
true Arming state is settled successfully.
- Returns:
false Arming state is not settled.
-
virtual bool ownSetOffboardControl(bool offboard) = 0
Handles how offboard mode has to be settled in the concrete platform.
- Parameters:
offboard – true if offboard mode is enabled.
- Returns:
true Offboard mode is settled successfully.
- Returns:
false Offboard mode is not settled.
-
virtual bool ownSetPlatformControlMode(const as2_msgs::msg::ControlMode &msg) = 0
Handles how the control mode has to be settled in the concrete platform.
- Parameters:
control_mode – as2_msgs::msg::PlatformControlMode with the new control mode.
- Returns:
true Control mode is settled successfully.
- Returns:
false Control mode is not settled.
-
inline virtual bool ownTakeoff()
Handles the platform takeoff command.
- Returns:
true Takeoff command is sended successfully.
- Returns:
false Takeoff command is not sended.
-
inline virtual bool ownLand()
Handles the platform landing command.
- Returns:
true Landing command is sended successfully.
- Returns:
false Landing command is not sended.
-
virtual void ownKillSwitch() = 0
Handles the platform emergency kill switch command. This means stop the motors inmediately, this cannot be reversed. USE WITH CAUTION.
-
virtual void ownStopPlatform() = 0
Handles the platform emergency stop command. STOP means to hover as best as possible. This hover is different from the hover in the platform control mode. And when it is activated the platform will stop hearing commands from AS2. USE WITH CAUTION.
-
inline bool handleStateMachineEvent(const as2_msgs::msg::PlatformStateMachineEvent &event)
Set the State Machine Event object.
- Parameters:
event – Event to
- Returns:
true
- Returns:
false
-
inline bool handleStateMachineEvent(const int8_t &event)
-
inline bool getArmingState() const
Get whether the platform is armed or not.
- Returns:
true Armed
- Returns:
false Disarmed
-
inline bool getConnectedStatus() const
Get wheter the connection is established or not.
- Returns:
true Connection active
- Returns:
false Connection not active
-
inline bool getOffboardMode() const
Get whether offboard mode is active or not.
- Returns:
true Offboard mode enabled
- Returns:
false Offboard mode disabled
-
inline as2_msgs::msg::ControlMode &getControlMode()
Get current platform control mode.
- Returns:
as2_msgs::msg::PlatformControlMode current platform control mode
-
inline bool isControlModeSettled() const
Get whether a control mode is active or not.
- Returns:
true Control mode set and valid
- Returns:
false Control mode unset
Protected Functions
-
bool setArmingState(bool state)
Set the arm state of the platform.
- Parameters:
state – True to arm the platform, false to disarm it.
- Returns:
true Armimg state setted successfully.
- Returns:
false Armimg state not setted successfully.
-
bool setOffboardControl(bool offboard)
Set the offboard control mode.
- Parameters:
offboard – True if the offboard control mode is enabled.
- Returns:
true if the offboard control mode is setted properly
- Returns:
false if the offboard control mode could not be setted.
-
bool setPlatformControlMode(const as2_msgs::msg::ControlMode &msg)
Set the control mode of the platform.
- Parameters:
msg – as2_msgs::msg::ControlMode message with the new control mode desired.
- Returns:
true If the control mode is set properly.
- Returns:
false If the control mode could not be set properly.
-
bool takeoff()
Handles the platform takeoff command.
- Returns:
true Takeoff command is sended successfully.
- Returns:
false Takeoff command is not sended.
-
bool land()
Handles the platform landing command.
- Returns:
true Landing command is sended successfully.
- Returns:
false Landing command is not sended.
-
void alertEvent(const as2_msgs::msg::AlertEvent &msg)
Handles the platform emergency event.
- Parameters:
msg – as2_msgs::msg::AlertEvent message with the emergency event.
-
virtual void sendCommand()
Send command to the platform.
Protected Attributes
-
float cmd_freq_
-
float info_freq_
-
as2_msgs::msg::TrajectorySetpoints command_trajectory_msg_
-
geometry_msgs::msg::PoseStamped command_pose_msg_
-
geometry_msgs::msg::TwistStamped command_twist_msg_
-
as2_msgs::msg::Thrust command_thrust_msg_
-
as2_msgs::msg::PlatformInfo platform_info_msg_
-
bool has_new_references_ = false
Private Functions
-
void initialize()
-
inline void publishPlatformInfo()
Publishes the platform info message.
Set Aircraft Control Mode Service Callback.
- Parameters:
request –
response –
Set Aircraft Arming State Service Callback.
- Parameters:
request –
response –
Set Aircraft Offboard Mode Service Callback.
- Parameters:
request –
response –
Takeoff Service Callback.
- Parameters:
request –
response –
Land Service Callback.
- Parameters:
request –
response –
get list of available Control Modes Service Callback
- Parameters:
request –
response –
-
explicit AerialPlatform(const rclcpp::NodeOptions &options = rclcpp::NodeOptions())
-
class AlphanumericViewer : public as2::Node
Public Types
-
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
Public Functions
-
AlphanumericViewer()
-
void run()
-
void setupNode()
-
void printSummaryMenu()
-
void printSensorMenu()
-
void printPlatformMenu()
-
void printStream(double var, bool aux)
-
void printStream3(float var, bool aux)
-
void printStream(float var, bool aux)
-
void printSummaryValues()
-
void printSensorValues()
-
void printPlatformValues()
-
void printBattery()
-
void printQuadrotorState()
-
void printControlModeInYaw()
-
void printControlModeInControl()
-
void printControlModeInFrame()
-
void printControlModeOutYaw()
-
void printControlModeOutControl()
-
void printControlModeOutFrame()
-
void printPlatformStatus(int line)
-
void clearValues()
-
virtual CallbackReturn on_configure(const rclcpp_lifecycle::State&) override
Callback for the configure state.
- Parameters:
state –
- Returns:
CallbackReturn
-
virtual CallbackReturn on_deactivate(const rclcpp_lifecycle::State&) override
Callback for the deactivate state.
- Parameters:
state –
- Returns:
CallbackReturn
-
virtual CallbackReturn on_shutdown(const rclcpp_lifecycle::State&) override
Callback for the shutdown state.
- Parameters:
state –
- Returns:
CallbackReturn
Private Functions
Private Members
-
geometry_msgs::msg::PoseStamped self_localization_pose_
-
geometry_msgs::msg::TwistStamped self_localization_twist_
-
sensor_msgs::msg::BatteryState battery_status_
-
sensor_msgs::msg::Imu imu_
-
as2_msgs::msg::PlatformInfo platform_info_
-
geometry_msgs::msg::PoseStamped actuator_pose_
-
as2_msgs::msg::Thrust actuator_thrust_
-
geometry_msgs::msg::TwistStamped actuator_twist_
-
as2_msgs::msg::ControllerInfo controller_info_
-
geometry_msgs::msg::PoseStamped reference_pose_
-
geometry_msgs::msg::TwistStamped reference_twist_
-
sensor_msgs::msg::NavSatFix gps_
-
int battery_mode_ = 0
-
bool battery_aux = false
-
bool altitude_aux = false
-
bool altitude_sea_level_aux = false
-
bool ground_speed_aux = false
-
bool imu_aux = false
-
bool temperature_aux = false
-
bool platform_info_aux = false
-
bool current_speed_reference_aux = false
-
bool current_pose_reference_aux = false
-
bool current_trajectory_reference_aux = false
-
bool actuator_command_pose_aux = false
-
bool actuator_command_twist_aux = false
-
bool actuator_command_thrust_aux = false
-
bool current_pose_aux = false
-
bool current_speed_aux = false
-
bool controller_info_aux = false
-
bool gps_aux = false
-
bool thrust_aux = false
-
int last_received_yaw_mode
-
int last_received_control_mode
-
int last_received_reference_frame
-
char command = 0
-
int window = 0
-
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
-
class ArmService : public nav2_behavior_tree::BtServiceNode<std_srvs::srv::SetBool>
-
class As2ExternalObjectToTf : public as2::Node
Public Types
-
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
Public Functions
-
As2ExternalObjectToTf()
-
void setupNode()
-
void cleanupNode()
-
void run()
-
virtual CallbackReturn on_configure(const rclcpp_lifecycle::State&) override
Callback for the configure state.
- Parameters:
state –
- Returns:
CallbackReturn
-
virtual CallbackReturn on_deactivate(const rclcpp_lifecycle::State&) override
Callback for the deactivate state.
- Parameters:
state –
- Returns:
CallbackReturn
-
virtual CallbackReturn on_shutdown(const rclcpp_lifecycle::State&) override
Callback for the shutdown state.
- Parameters:
state –
- Returns:
CallbackReturn
Private Functions
-
void setupGPS()
-
geometry_msgs::msg::Quaternion azimuthPitchToQuaternion(const float azimuth, const float pitch)
Private Members
-
bool origin_set_ = false
-
bool use_sim_time = false
-
geographic_msgs::msg::GeoPoint::UniquePtr origin_
-
std::vector<rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr> objects_subscriptions_
-
std::unique_ptr<as2::gps::GpsHandler> gps_handler
-
std::map<std::string, gps_object> gps_poses
-
using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
-
class AStarPlanner
Public Functions
-
inline AStarPlanner()
-
inline void setOcuppancyGrid(const cv::Mat &mat)
-
inline void setOriginPoint(const cv::Point2i &point)
-
inline void setGoal(const cv::Point2i &point)
Private Functions
-
inline AStarPlanner()
-
class AStarSearcher : public GraphSearcher<cv::Mat>
Public Functions
Update the occupancy grid.
- Parameters:
occ_grid – occupancy grid
drone_pose – drone pose in cell coordinates
safety_distance – safety distance in meters
-
cv::Point2i cellToPixel(Point2i cell, int rows, int cols)
Convert cell coordinates to pixel coordinates.
- Parameters:
cell – cell coordinates
rows – number of rows
cols – number of columns
-
cv::Point2i cellToPixel(Point2i cell, cv::Mat map)
Convert cell coordinates to pixel coordinates.
- Parameters:
cell – cell coordinates
map – map
Convert cell coordinates to pixel coordinates.
- Parameters:
cell – cell coordinates
map_info – map metadata
Convert pixel coordinates to cell coordinates.
- Parameters:
pixel – pixel coordinates
map_info – map metadata
Occupancy grid to binary image
- Parameters:
occ_grid – occupancy grid
thresh – threshold value
unknown_as_free – if true, unknown cells are considered free
- Returns:
: binary image
-
nav_msgs::msg::OccupancyGrid imgToGrid(const cv::Mat img, const std_msgs::msg::Header &header, double grid_resolution)
Binary image to occupancy grid
- Parameters:
img – binary image
header – header of the occupancy grid
grid_resolution – resolution of the occupancy grid
- Returns:
: occupancy grid
Protected Functions
Protected Attributes
-
bool use_heuristic_ = true
-
class AzimuthBridge : public rclcpp::Node
Public Functions
-
AzimuthBridge()
Private Static Functions
-
static void ignitionGroundTruthCallback(const gz::msgs::Odometry &ign_msg, const gz::transport::MessageInfo &msg_info)
-
static float toEulerYaw(Quaternion q)
-
static float toAzimuth(float yaw)
-
AzimuthBridge()
-
template<class MessageT>
class BasicBehavior : public as2::Node, public as2::Node Public Types
-
using GoalHandleAction = rclcpp_action::ServerGoalHandle<MessageT>
Public Functions
-
inline explicit BasicBehavior(const std::string &name)
-
virtual rclcpp_action::GoalResponse onAccepted(const std::shared_ptr<const typename MessageT::Goal> goal) = 0
-
virtual rclcpp_action::CancelResponse onCancel(const std::shared_ptr<GoalHandleAction> goal_handle) = 0
-
virtual void onExecute(const std::shared_ptr<GoalHandleAction> goal_handle) = 0
Private Functions
-
inline rclcpp_action::GoalResponse handleGoal(const rclcpp_action::GoalUUID &uuid, std::shared_ptr<const typename MessageT::Goal> goal)
-
inline rclcpp_action::CancelResponse handleCancel(const std::shared_ptr<GoalHandleAction> goal_handle)
-
inline void handleAccepted(const std::shared_ptr<GoalHandleAction> goal_handle)
-
using GoalHandleAction = rclcpp_action::ServerGoalHandle<MessageT>
-
class BasicMotionReferenceHandler
Subclassed by as2::motionReferenceHandlers::ACROMotion, as2::motionReferenceHandlers::HoverMotion, as2::motionReferenceHandlers::PositionMotion, as2::motionReferenceHandlers::SpeedInAPlaneMotion, as2::motionReferenceHandlers::SpeedMotion, as2::motionReferenceHandlers::TrajectoryMotion
Public Functions
-
~BasicMotionReferenceHandler()
Protected Functions
-
bool sendThrustCommand()
-
bool sendPoseCommand()
-
bool sendTwistCommand()
-
bool sendTrajectoryCommand()
-
bool checkMode()
Protected Attributes
-
as2_msgs::msg::TrajectorySetpoints command_trajectory_msg_
-
geometry_msgs::msg::PoseStamped command_pose_msg_
-
geometry_msgs::msg::TwistStamped command_twist_msg_
-
as2_msgs::msg::Thrust command_thrust_msg_
-
as2_msgs::msg::ControlMode desired_control_mode_
Private Functions
-
bool setMode(const as2_msgs::msg::ControlMode &mode)
Private Static Attributes
-
static int number_of_instances_ = 0
-
static rclcpp::Subscription<as2_msgs::msg::ControllerInfo>::SharedPtr controller_info_sub_ = nullptr
-
static as2_msgs::msg::ControlMode current_mode_ = as2_msgs::msg::ControlMode()
-
~BasicMotionReferenceHandler()
-
template<typename actionT>
class BehaviorServer : public as2::Node Public Types
-
using BehaviorStatus = as2_msgs::msg::BehaviorStatus
Public Functions
-
void register_action()
-
BehaviorServer(const std::string &name, const rclcpp::NodeOptions &options = rclcpp::NodeOptions())
-
inline virtual void on_execution_end(const ExecutionStatus &state)
-
inline void timer_callback()
-
void publish_behavior_status()
Public Members
-
std::shared_ptr<GoalHandleAction> goal_handle_
-
as2_msgs::msg::BehaviorStatus behavior_status_
Private Functions
-
void register_service_servers()
-
void register_publishers()
-
void register_timers()
-
void register_run_timer()
-
void cleanup_run_timer(const ExecutionStatus &status)
Private Members
-
rclcpp::Service<modify_srv>::SharedPtr modify_srv_
-
rclcpp::Publisher<feedback_msg>::SharedPtr feedback_pub_
-
rclcpp::Publisher<goal_status_msg>::SharedPtr goal_status_pub_
-
rclcpp::Publisher<BehaviorStatus>::SharedPtr behavior_status_pub_
-
using BehaviorStatus = as2_msgs::msg::BehaviorStatus
- #include <bt_action_node.hpp>
Abstract class representing an action based BT node.
- Template Parameters:
ActionT – Type of action
Public Functions
A nav2_behavior_tree::BtActionNode constructor.
- Parameters:
xml_tag_name – Name for the XML tag for this node
action_name – Action name this node creates a client for
conf – BT node configuration
Create instance of an action client.
- Parameters:
action_name – Action name to create client for
Function to perform some user-defined operation on tick Could do dynamic checks, such as getting updates to values on the blackboard.
Function to perform some user-defined operation after a timeout waiting for a result that hasn’t been received yet. Also provides access to the latest feedback message from the action server. Feedback will be nullptr in subsequent calls to this function if no new feedback is received while waiting for a result.
- Parameters:
feedback – shared_ptr to latest feedback message, nullptr if no new feedback was received
Function to perform some user-defined operation upon successful completion of the action. Could put a value on the blackboard.
- Returns:
BT::NodeStatus Returns SUCCESS by default, user may override return another value
Function to perform some user-defined operation whe the action is aborted.
- Returns:
BT::NodeStatus Returns FAILURE by default, user may override return another value
Function to perform some user-defined operation when the action is cancelled.
- Returns:
BT::NodeStatus Returns SUCCESS by default, user may override return another value
The main override required by a BT action.
- Returns:
BT::NodeStatus Status of tick execution
The other (optional) override required by a BT action. In this case, we make sure to cancel the ROS2 action if it is still running.
Public Static Functions
Any subclass of BtActionNode that accepts parameters must provide a providedPorts method and call providedBasicPorts in it.
- Parameters:
addition – Additional ports to add to BT port list
- Returns:
BT::PortsList Containing basic ports along with node-specific ports
Creates list of BT ports.
- Returns:
BT::PortsList Containing basic ports along with node-specific ports
Protected Functions
Function to check if current goal should be cancelled.
- Returns:
bool True if current goal should be cancelled, false otherwise
Function to send new goal to action server.
Function to check if the action server acknowledged a new goal.
- Parameters:
elapsed – Duration since the last goal was sent and future goal handle has not completed. After waiting for the future to complete, this value is incremented with the timeout value.
- Returns:
boolean True if future_goal_handle_ returns SUCCESS, False otherwise
Function to increment recovery count on blackboard if this node wraps a recovery.
Protected Attributes
- #include <bt_service_node.hpp>
Abstract class representing a service based BT node.
- Template Parameters:
ServiceT – Type of service
Public Functions
A nav2_behavior_tree::BtServiceNode constructor.
- Parameters:
service_node_name – Service name this node creates a client for
conf – BT node configuration
The main override required by a BT service.
- Returns:
BT::NodeStatus Status of tick execution
The other (optional) override required by a BT service.
Function to perform some user-defined operation on tick Fill in service request with information if necessary.
Function to perform some user-defined operation upon successful completion of the service. Could put a value on the blackboard.
- Parameters:
response – can be used to get the result of the service call in the BT Node.
- Returns:
BT::NodeStatus Returns SUCCESS by default, user may override to return another value
Check the future and decide the status of BT.
- Returns:
BT::NodeStatus SUCCESS if future complete before timeout, FAILURE otherwise
Function to perform some user-defined operation after a timeout waiting for a result that hasn’t been received yet.
Public Static Functions
Any subclass of BtServiceNode that accepts parameters must provide a providedPorts method and call providedBasicPorts in it.
- Parameters:
addition – Additional ports to add to BT port list
- Returns:
BT::PortsList Containing basic ports along with node-specific ports
Creates list of BT ports.
- Returns:
BT::PortsList Containing basic ports along with node-specific ports
Protected Functions
Function to increment recovery count on blackboard if this node wraps a recovery.
Protected Attributes
-
template<typename T>
class BucketPrioQueue - #include <bucketedqueue.h>
Priority queue for integer coordinates with squared distances as priority.
A priority queue that uses buckets to group elements with the same priority. The individual buckets are unsorted, which increases efficiency if these groups are large. The elements are assumed to be integer coordinates, and the priorities are assumed to be squared Euclidean distances (integers).
Public Functions
-
BucketPrioQueue()
Standard constructor.
Standard constructor. When called for the first time it creates a look up table that maps square distances to bucket numbers, which might take some time…
-
inline void clear()
-
bool empty()
Checks whether the Queue is empty.
-
inline int size()
-
inline int getNumBuckets()
-
inline int getTopPriority()
-
BucketPrioQueue()
-
class Camera : public as2::sensors::TFStatic, protected as2::sensors::GenericSensor
- #include <sensor.hpp>
Class to handle the camera sensor.
Public Functions
-
Camera(as2::Node *node_ptr, const std::string &prefix = "", const float pub_freq = -1.0f, bool add_sensor_measurements_base = true, const std::string &camera_link = "camera_link")
Construct a new Camera object.
- Parameters:
node_ptr – Pointer to the node
prefix – ROS 2 parameter prefix. If not using ROS 2 parameters, give the camera name (e.g. “camera_front”)
pub_freq – Frequency to publish the data (-1 to publish every time updateData is called)
add_sensor_measurements_base – Add “sensor_measurements” to the topic name
info_name – Name of the camera info topic. Default is “camera_info”
camera_link – Name of the camera link frame id. Default is “camera_link”
-
inline Camera(const std::string &prefix, as2::Node *node_ptr, const float pub_freq = -1.0f, bool add_sensor_measurements_base = true, const std::string &camera_link = "camera_link")
Construct a new Camera object. DEPRECATED.
- Parameters:
prefix – ROS 2 parameter prefix. If not using ROS 2 parameters, give the camera name (e.g. “camera_front”)
node_ptr – Pointer to the node
pub_freq – Frequency to publish the data (-1 to publish every time updateData is called)
add_sensor_measurements_base – Add “sensor_measurements” to the topic name
info_name – Name of the camera info topic. Default is “camera_info”
camera_link – Name of the camera link frame id. Default is “camera_link”
-
inline void setParameters(const sensor_msgs::msg::CameraInfo &camera_info, const std::string &encoding, const std::string &camera_model = "pinhole")
Set Camera parameters. DEPRECATED.
-
void updateData(const sensor_msgs::msg::Image &img)
Update the data of the camera.
- Parameters:
img – Image message
-
void updateData(const cv::Mat &img)
Update the data of the camera.
- Parameters:
img – Image message
-
void setCameraInfo(const sensor_msgs::msg::CameraInfo &camera_info)
Set camera info parameters.
- Parameters:
camera_info – Camera info message
-
void setCameraLinkTransform(const std::string &parent_frame_id, const float x, const float y, const float z, const float roll, const float pitch, const float yaw)
Set camera link frame transformation relative to the parent frame.
- Parameters:
parent_frame_id – Parent frame ID (e.g. base_link)
x – X position (m)
y – Y position (m)
z – Z position (m)
roll – Roll (rad)
pitch – Pitch (rad)
yaw – Yaw (rad)
-
void setEncoding(const std::string &encoding)
Set camera encoding.
- Parameters:
encoding – Encoding of the camera
Private Functions
-
void setup()
Setup the camera info.
-
virtual void publishData()
Publish the data in a topic.
-
Camera(as2::Node *node_ptr, const std::string &prefix = "", const float pub_freq = -1.0f, bool add_sensor_measurements_base = true, const std::string &camera_link = "camera_link")
-
class CellNode
- #include <cell_node.hpp>
CellNode class, a node in a grid.
Public Functions
-
inline CellNode(const Point2i &coordinates, const CellNodePtr &parent_ptr, double g_cost, double h_cost = 0)
Constructor for CellNode class.
- Parameters:
coordinates – coordinates of the cell
parent_ptr – parent node
g_cost – cost to reach this node
h_cost – heuristic cost to reach the goal
-
inline void set_g_cost(double g_cost)
-
inline int x()
-
inline int y()
-
inline CellNodePtr parent_ptr()
-
inline double get_g_cost()
-
inline double get_h_cost()
-
inline double get_total_cost()
-
inline CellNode(const Point2i &coordinates, const CellNodePtr &parent_ptr, double g_cost, double h_cost = 0)
-
struct Control_flags
-
struct Control_flags
Public Members
-
bool state_received = false
-
bool ref_received = false
-
bool plugin_parameters_read = false
-
bool position_controller_parameters_read = false
-
bool velocity_controller_parameters_read = false
-
bool speed_in_a_plane_controller_parameters_read = false
-
bool trajectory_controller_parameters_read = false
-
bool yaw_controller_parameters_read = false
-
bool state_received = false
-
class ControllerBase
Subclassed by differential_flatness_controller::Plugin, pid_speed_controller::Plugin
Public Functions
-
inline ControllerBase()
-
inline virtual void ownInitialize()
-
virtual void updateState(const geometry_msgs::msg::PoseStamped &pose_msg, const geometry_msgs::msg::TwistStamped &twist_msg) = 0
-
inline virtual void updateReference(const geometry_msgs::msg::PoseStamped &ref)
-
inline virtual void updateReference(const geometry_msgs::msg::TwistStamped &ref)
-
inline virtual void updateReference(const as2_msgs::msg::TrajectorySetpoints &ref)
-
inline virtual void updateReference(const as2_msgs::msg::Thrust &ref)
-
virtual bool computeOutput(double dt, geometry_msgs::msg::PoseStamped &pose, geometry_msgs::msg::TwistStamped &twist, as2_msgs::msg::Thrust &thrust) = 0
-
virtual bool setMode(const as2_msgs::msg::ControlMode &mode_in, const as2_msgs::msg::ControlMode &mode_out) = 0
-
virtual void reset() = 0
-
inline virtual ~ControllerBase()
-
inline ControllerBase()
-
class ControllerHandler
Public Functions
-
inline virtual ~ControllerHandler()
-
rcl_interfaces::msg::SetParametersResult parametersCallback(const std::vector<rclcpp::Parameter> ¶meters)
-
void getMode(as2_msgs::msg::ControlMode &mode_in, as2_msgs::msg::ControlMode &mode_out)
-
void reset()
Private Functions
-
bool listPlatformAvailableControlModes()
-
void controlTimerCallback()
-
bool findSuitableOutputControlModeForPlatformInputMode(uint8_t &output_mode, const uint8_t input_mode)
-
bool checkSuitabilityInputMode(uint8_t &input_mode, const uint8_t output_mode)
-
bool setPlatformControlMode(const as2_msgs::msg::ControlMode &mode)
-
bool findSuitableControlModes(uint8_t &input_mode, uint8_t &output_mode)
-
bool trySetPlatformHover()
-
bool tryToBypassController(const uint8_t input_mode, uint8_t &output_mode)
-
void sendCommand()
-
void publishCommand()
Private Members
-
as2::SynchronousServiceClient<as2_msgs::srv::SetControlMode>::SharedPtr set_control_mode_client_
-
as2::SynchronousServiceClient<as2_msgs::srv::ListControlModes>::SharedPtr list_control_modes_client_
-
bool control_mode_established_ = false
-
bool motion_reference_adquired_ = false
-
bool state_adquired_ = false
-
bool use_bypass_ = false
-
bool bypass_controller_ = false
-
uint8_t prefered_output_mode_ = 0b00000000
-
as2_msgs::msg::PlatformInfo platform_info_
-
as2_msgs::msg::ControlMode control_mode_in_
-
as2_msgs::msg::ControlMode control_mode_out_
-
geometry_msgs::msg::PoseStamped state_pose_
-
geometry_msgs::msg::TwistStamped state_twist_
-
geometry_msgs::msg::PoseStamped ref_pose_
-
geometry_msgs::msg::TwistStamped ref_twist_
-
as2_msgs::msg::TrajectorySetpoints ref_traj_
-
as2_msgs::msg::Thrust ref_thrust_
-
geometry_msgs::msg::PoseStamped command_pose_
-
geometry_msgs::msg::TwistStamped command_twist_
-
as2_msgs::msg::Thrust command_thrust_
-
std::shared_ptr<as2_motion_controller_plugin_base::ControllerBase> controller_ptr_
-
inline virtual ~ControllerHandler()
-
class ControllerManager : public as2::Node
Public Functions
-
~ControllerManager()
Public Members
-
double cmd_freq_
Private Functions
-
void modeTimerCallback()
Private Members
-
double info_freq_
-
std::shared_ptr<pluginlib::ClassLoader<as2_motion_controller_plugin_base::ControllerBase>> loader_
-
std::shared_ptr<controller_handler::ControllerHandler> controller_handler_
-
std::shared_ptr<as2_motion_controller_plugin_base::ControllerBase> controller_
-
~ControllerManager()
-
struct dataCell
-
class DetectArucoMarkersBehavior : public as2_behavior::BehaviorServer<as2_msgs::action::DetectArucoMarkers>
Public Functions
-
DetectArucoMarkersBehavior()
Construct a new Aruco Detector object.
-
inline ~DetectArucoMarkersBehavior()
Destroy the Aruco Detector object.
Private Functions
-
void loadParameters()
-
void setup()
-
void setCameraParameters(const sensor_msgs::msg::CameraInfo &_camera_info)
-
bool checkIdIsTarget(const int _id)
As2 Behavior methods
-
virtual void on_execution_end(const as2_behavior::ExecutionStatus &state) override
-
DetectArucoMarkersBehavior()
-
class DisarmService : public nav2_behavior_tree::BtServiceNode<std_srvs::srv::SetBool>
-
class DynamicPolynomialTrajectoryGenerator : public as2_behavior::BehaviorServer<as2_msgs::action::GeneratePolynomialTrajectory>
Public Functions
-
inline ~DynamicPolynomialTrajectoryGenerator()
Private Functions
As2 Behavior methods
-
virtual void on_execution_end(const as2_behavior::ExecutionStatus &state) override
Topic Callbacks
For faster waypoint modified
-
void setup()
Trajectory generator functions
-
bool evaluateTrajectory(double eval_time)
-
bool evaluateSetpoint(double eval_time, as2_msgs::msg::TrajectoryPoint &trajectory_command)
-
double computeYawAnglePathFacing(double vx, double vy)
-
void plotTrajectory()
Debug functions
-
void plotTrajectoryThread()
-
void plotRefTrajPoint()
Private Members
-
std::shared_ptr<dynamic_traj_generator::DynamicTrajectory> trajectory_generator_
Dynamic trajectory generator library
-
as2::motionReferenceHandlers::HoverMotion hover_motion_handler_
Handlers
-
as2::motionReferenceHandlers::TrajectoryMotion trajectory_motion_handler_
-
int sampling_n_ = 1
-
double sampling_dt_ = 0.0
-
as2_msgs::msg::YawMode yaw_mode_
-
as2_msgs::action::GeneratePolynomialTrajectory::Goal goal_
-
as2_msgs::action::GeneratePolynomialTrajectory::Feedback feedback_
-
as2_msgs::action::GeneratePolynomialTrajectory::Result result_
-
bool has_yaw_from_topic_ = false
-
float yaw_from_topic_ = 0.0f
-
float init_yaw_angle_ = 0.0f
-
Eigen::Vector3d current_position_
-
double current_yaw_
-
as2_msgs::msg::TrajectorySetpoints trajectory_command_
-
bool first_run_ = false
-
bool has_odom_ = false
-
bool enable_debug_ = true
-
inline ~DynamicPolynomialTrajectoryGenerator()
-
class DynamicVoronoi
- #include <dynamicvoronoi.h>
A DynamicVoronoi object computes and updates a distance map and Voronoi diagram.
Public Functions
-
DynamicVoronoi()
-
~DynamicVoronoi()
-
void initializeEmpty(int _sizeX, int _sizeY, bool initGridMap = true)
Initialization with an empty map.
-
void initializeMap(int _sizeX, int _sizeY, bool **_gridMap)
Initialization with a given binary map (false==free, true==occupied)
-
void occupyCell(int x, int y)
add an obstacle at the specified cell coordinate
-
void clearCell(int x, int y)
remove an obstacle at the specified cell coordinate
-
void exchangeObstacles(std::vector<INTPOINT> &newObstacles)
remove old dynamic obstacles and add the new ones
-
void update(bool updateRealDist = true)
update distance map and Voronoi diagram to reflect the changes
-
void prune()
prune the Voronoi diagram
-
void updateAlternativePrunedDiagram()
prune the Voronoi diagram by globally revisiting all Voronoi nodes. Takes more time but gives a more sparsely pruned Voronoi graph. You need to call this after every call to udpate()
-
inline int **alternativePrunedDiagram()
retrieve the alternatively pruned diagram. see updateAlternativePrunedDiagram()
-
int getNumVoronoiNeighborsAlternative(int x, int y)
retrieve the number of neighbors that are Voronoi nodes (4-connected)
-
bool isVoronoiAlternative(int x, int y)
returns whether the specified cell is part of the alternatively pruned diagram. See updateAlternativePrunedDiagram.
-
float getDistance(int x, int y)
returns the obstacle distance at the specified location
-
bool isVoronoi(int x, int y)
returns whether the specified cell is part of the (pruned) Voronoi graph
-
bool isOccupied(int x, int y)
checks whether the specficied location is occupied
-
void visualize(const char *filename = "result.ppm")
write the current distance map and voronoi diagram as ppm file
-
inline unsigned int getSizeX()
returns the horizontal size of the workspace/map
-
inline unsigned int getSizeY()
returns the vertical size of the workspace/map
Private Types
-
enum State
Values:
-
enumerator voronoiKeep
-
enumerator freeQueued
-
enumerator voronoiRetry
-
enumerator voronoiPrune
-
enumerator free
-
enumerator occupied
-
enumerator voronoiKeep
Private Functions
-
void setObstacle(int x, int y)
-
void removeObstacle(int x, int y)
-
void recheckVoro()
-
void commitAndColorize(bool updateRealDist = true)
-
inline void reviveVoroNeighbors(int &x, int &y)
-
inline markerMatchResult markerMatch(int x, int y)
-
inline bool markerMatchAlternative(int x, int y)
-
inline int getVoronoiPruneValence(int x, int y)
-
DynamicVoronoi()
-
struct follow_path_plugin_params
-
class FollowPathAction : public nav2_behavior_tree::BtActionNode<as2_msgs::action::FollowPath>
Public Functions
-
inline virtual void on_tick()
Function to perform some user-defined operation on tick Could do dynamic checks, such as getting updates to values on the blackboard.
-
inline virtual void on_tick()
-
class FollowPathBase
Subclassed by follow_path_plugin_position::Plugin, follow_path_plugin_trajectory::Plugin
Public Types
-
using GoalHandleFollowPath = rclcpp_action::ServerGoalHandle<as2_msgs::action::FollowPath>
Public Functions
-
inline FollowPathBase()
-
inline virtual ~FollowPathBase()
-
inline virtual void state_callback(geometry_msgs::msg::PoseStamped &pose_msg, geometry_msgs::msg::TwistStamped &twist_msg)
-
inline void on_execution_end(const as2_behavior::ExecutionStatus &state)
-
using GoalHandleFollowPath = rclcpp_action::ServerGoalHandle<as2_msgs::action::FollowPath>