-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_UROS: add micro-ROS client #25154
base: master
Are you sure you want to change the base?
Conversation
41dd963
to
74efad2
Compare
Factor out common code
This PR demonstrates the approach. The templates for type access are in // string accessor templates
template <typename S>
const char* string_data(const S* str);
template <typename S>
const char* string_data(const S& str);
// sequence accessor templates
// see: https://stackoverflow.com/questions/15911890/overriding-return-type-in-function-template-specialization
template <typename T>
uint32_t transforms_size(const T& msg);
template <typename T>
struct transforms_type{ typedef T* type; };
template <typename T>
typename transforms_type<T>::type transforms_data(const T& msg); With example usage in for (size_t i = 0; i < transforms_size<TFMessage>(msg); i++) {
const auto& ros_transform_stamped = transforms_data<TFMessage>(msg)[i];
if (!is_odometry_frame(ros_transform_stamped)) {
continue;
} and for strings: template <typename TransformStamped>
bool AP_ROS_External_Odom::is_odometry_frame(const TransformStamped& msg)
{
char odom_parent[] = "odom";
char odom_child[] = "base_link";
// Assume the frame ID's are null terminated.
return (strcmp(string_data(msg.header.frame_id), odom_parent) == 0) &&
(strcmp(string_data(msg.child_frame_id), odom_child) == 0);
} |
6903a47
to
57fcf4d
Compare
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]> modules: update ardupliot_uros - Added mode_switch service interface for esp32 - Added mode_switch service interface for stm32. Signed-off-by: Rhys Mainwaring <[email protected]>
- Add option --enable-uros. - Add define AP_UROS_ENABLED. Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]> Tools: ros2: disable DSS in colcon build Signed-off-by: Rhys Mainwaring <[email protected]> Tools: ros2: update README Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
AP_UROS: search for micro-ROS client library in ardupilot_uros module Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add vector3 subscriber example - PoC - will only work for SITL / POSIX (must add use custom transport) Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: move init and create code into respective functions - Make rcl objects member variables. - Update checks macros to report to GCS. - Move rcl initialisation to init(). - Move subscriber creation to create(). Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add custom transport - Adapt UDP custom transport from AP_DDS. Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: enable custom transport Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add publisher example Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add publisher example - Send message to GCS. Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: include additional ROS message types Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add time publisher - Add time publisher. - Rename node to 'ardupilot_uros'. - Change timer period to 1 ms Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add publishers for local pose and twist Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add publishers for battery, clock, nav sat, static tf Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: clarify number of handles calculation Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: implement topic writers using code from AP_DDS - Strings and sequence values are not populated as memory must be allocated. Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add code for static transform from AP_DDS - Strings and sequence values are not populated as memory must be allocated. Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: manage memory for topic strings and sequences Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: only update nav sat fix on new data to match AP_DDS Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add subscriber to sensor_msgs/msg/Joy Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: remove demo subscriber to geometry_msgs/msg/Vector3 Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: update @todo formatting Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add function declarations for Ubuntu build Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: disable tf2_msgs for esp32 dev Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: move global variables into AP_UROS_Client class - Make singleton. - Make update_topic member function. - Add trampoline for thread task. - Move thread to core 1 and adjust priority. - Customise initialisation. Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: fix initialisation of local twist publisher Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: publish geopose, static_tf, and subscribe to tf Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: use trampoline functions for timer and message callbacks Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add arm motors service Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add parameter server Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add README Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: display parameter changes in GCS Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: implementation of custom serial transport - Note this is ESP32 specific. - Requires micro-ROS client library to be built for custom transport. - UART_NUM_2 not managed by AP_HAL - Return if publisher or subscriber initialisation fails Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: call uros_port->begin(0) to ensure thread owns port Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: support build for stm32 - disable param server Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: support both esp32 and stm32 Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add compile option for param server Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: update macros for debug and error messages Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: fix bug introduced into entity handle count Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: update print format specifier for TF message Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: enable UDP transport for SITL Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: update print format specifier for TF message Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add microros library distro options to wscript Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: fix library paths in wscript Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add stubs for mode switch service Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: implement arming service Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: implement mode switch service Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add stub for velocity control subscriber Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: add classes adapted from AP_DDS to manage external control - Functions are stubs only. Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: adapt external control functions to micro-ROS message types Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: enable external odom in uros client Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: update GCS messages for services - Add UROS: prefix. Signed-off-by: Rhys Mainwaring <[email protected]> AP_UROS: update README Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
ff9b7a2
to
eb1652d
Compare
A draft PR to investigate using the micro-ROS client library directly as an alternative to AP_DDS.
See: #23424 and the comment on the micro-ROS PoC.
Dependencies
The PR adds a module containing pre-built instances of the micro-ROS client library for various target platforms.
This is to separate out the fairly complex process of configuring and building the client libraries. Including this step directly in the
waf
build would add a dependency oncolcon
andROS
.Features
The
AP_UROS
library is feature compatible withAP_DDS
. This means it can be used as a drop in replacement forAP_DDS
for external control.AP_DDS
In addition there is a prototype parameter server. This is not yet integrated with ArduPilot's parameter system.
micro-ROS links
The following micro-ROS tutorials describe the process of creating the client libraries:
Tasks
AP_UROS
wscript
.AP_DDS
.ardupilot_sitl
CMakeLists.txt
.Notes
DDS
andUROS
are not compatible, so only one of--enable-dds
or--enable-uros
may be selected at a time (you would not want to use them concurrently in any case).DDS
andUROS
are almost compatible, except for the treatment of strings and arrays. This means it should be possible to factor out common code for responding to services requests and publishing and subscribing to topics.Testing
See the library README for build instructions.
The off-board navigation example described in ArduPilot/ardupilot_ros#11 may be run using
AP_UROS
instead ofAP_DDS
.Figure: MAVProxy console output from SITL running with
--enable-uros
.Flash
Flash usage for
MatekH743
in different configurations (expand for details)Scripting disabled: