PX4 ROS2 msg conformity and explicit topics

- .msg files are PascalCase
 - topics are still either per msg or explicitly listed in TOPICS
 - compatible structs are still generated (eg struct msg_s), but ROS2 style px4::msg::Msg is also available
This commit is contained in:
Daniel Agar
2022-01-21 09:32:30 -05:00
parent 7cb8ed3a1f
commit 56de0e27d8
395 changed files with 5601 additions and 1517 deletions
+1 -1
View File
@@ -43,7 +43,7 @@
#include <uORB/uORB.h>
#include "uORBManager.hpp"
#include <uORB/topics/uORBTopics.hpp>
#include <uORBTopics.hpp>
namespace uORB
{
+5 -1
View File
@@ -39,7 +39,7 @@
#pragma once
#include <uORB/uORB.h>
#include <uORB/topics/uORBTopics.hpp>
#include <uORBTopics.hpp>
#include <px4_platform_common/defines.h>
#include <lib/mathlib/mathlib.h>
@@ -160,6 +160,10 @@ public:
unsigned get_last_generation() const { return _last_generation; }
orb_id_t get_topic() const { return get_orb_meta(_orb_id); }
ORB_ID get_topic_enum() const { return _orb_id; }
size_t get_topic_size() const { return get_orb_meta(_orb_id)->o_size; }
protected:
friend class SubscriptionCallback;
@@ -140,6 +140,9 @@ public:
unsigned get_last_generation() const { return _subscription.get_last_generation(); }
orb_id_t get_topic() const { return _subscription.get_topic(); }
ORB_ID get_topic_enum() const { return _subscription.get_topic_enum(); }
size_t get_topic_size() const { return _subscription.get_topic_size(); }
/**
* Set the interval in microseconds
* @param interval The interval in microseconds.
+8 -2
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -251,10 +251,16 @@ void orb_print_message_internal(const struct orb_metadata *meta, const void *dat
__END_DECLS
/* Diverse uORB header defines */ //XXX: move to better location
#define ORB_ID_VEHICLE_ATTITUDE_CONTROLS ORB_ID(actuator_controls_0)
typedef uint8_t arming_state_t;
typedef uint8_t main_state_t;
typedef uint8_t hil_state_t;
typedef uint8_t navigation_state_t;
typedef uint8_t switch_pos_t;
#ifdef __cplusplus
#include <uORBTopics.hpp>
#endif // __cplusplus
@@ -100,8 +100,6 @@ public:
virtual int16_t add_subscription(const char *messageName, int32_t msgRateInHz) = 0;
/**
* @brief Interface to notify the remote entity of removal of a subscription
*
@@ -116,13 +114,11 @@ public:
virtual int16_t remove_subscription(const char *messageName) = 0;
/**
* Register Message Handler. This is internal for the IChannel implementer*
*/
virtual int16_t register_handler(uORBCommunicator::IChannelRxHandler *handler) = 0;
//=========================================================================
// INTERFACES FOR Data messages
//=========================================================================
@@ -143,7 +139,6 @@ public:
*/
virtual int16_t send_message(const char *messageName, int32_t length, uint8_t *data) = 0;
};
/**
@@ -153,7 +148,6 @@ public:
class uORBCommunicator::IChannelRxHandler
{
public:
/**
* Interface to process a received topic from remote.
* @param topic_name
@@ -184,7 +178,6 @@ public:
virtual int16_t process_add_subscription(const char *messageName, int32_t msgRateInHz) = 0;
/**
* Interface to process a received control msg to remove subscription
* @param messageName
@@ -198,7 +191,6 @@ public:
virtual int16_t process_remove_subscription(const char *messageName) = 0;
/**
* Interface to process the received data message.
* @param messageName
@@ -215,7 +207,6 @@ public:
*/
virtual int16_t process_received_message(const char *messageName, int32_t length, uint8_t *data) = 0;
};
#endif /* _uORBCommunicator_hpp_ */
+1 -1
View File
@@ -36,7 +36,7 @@
#include <stdint.h>
#include "uORBCommon.hpp"
#include <uORB/topics/uORBTopics.hpp>
#include <uORBTopics.hpp>
#include <px4_platform_common/posix.h>
@@ -38,4 +38,13 @@ px4_add_module(
SRCS
uORB_tests_main.cpp
uORBTest_UnitTest.cpp
PUBLICATIONS
"px4::msg::OrbTest /orb_test"
"px4::msg::OrbTest /orb_multitest"
"px4::msg::OrbTestMedium /orb_test_medium"
"px4::msg::OrbTestMedium /orb_test_medium_multi"
"px4::msg::OrbTestMedium /orb_test_medium_queue"
"px4::msg::OrbTestMedium /orb_test_medium_queue_poll"
"px4::msg::OrbTestMedium /orb_test_medium_wrap_around"
"px4::msg::OrbTestLarge /orb_test_large"
)