Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-os-example-mros2 example-mbed-mros2-sub-pose example-mbed-mros2-pub-twist example-mbed-mros2-mturtle-teleop
Revision 7:c80f65422d99, committed 2022-03-19
- Comitter:
- smoritaemb
- Date:
- Sat Mar 19 09:23:37 2022 +0900
- Parent:
- 2:159877d749c2
- Parent:
- 6:de187e431bef
- Commit message:
- Merge test_assortment_of_msgs branch.
Changed in this revision
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/Point.msg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/Point.msg Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,3 @@ +float64 x +float64 y +float64 z \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/Pose.msg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/Pose.msg Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,2 @@ +geometry_msgs/msg/Point position +geometry_msgs/msg/Quaternion orientation \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/Quaternion.msg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/Quaternion.msg Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,4 @@ +float64 x +float64 y +float64 z +float64 w \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/Twist.msg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/Twist.msg Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,2 @@ +geometry_msgs/msg/Vector3 linear +geometry_msgs/msg/Vector3 angular \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/Vector3.msg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/Vector3.msg Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,3 @@ +float64 x +float64 y +float64 z \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/point.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/point.hpp Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,178 @@ +#ifndef _GEOMETRY_MSGS_MSG_POINT_H +#define _GEOMETRY_MSGS_MSG_POINT_H + +#include <iostream> +#include <string> + +using namespace std; + +namespace geometry_msgs +{ +namespace msg +{ +class Point +{ +public: + uint32_t cntPub = 0; + uint32_t cntSub = 0; + + + double x +; + + double y +; + + double z; + + + uint32_t copyToBuf(uint8_t *addrPtr) + { + uint32_t tmpPub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&x +,8); + addrPtr += 8; + cntPub += 8; + + + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&y +,8); + addrPtr += 8; + cntPub += 8; + + + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&z,8); + addrPtr += 8; + cntPub += 8; + + + + + return cntPub; + } + + uint32_t copyFromBuf(const uint8_t *addrPtr) { + uint32_t tmpSub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&x +,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&y +,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&z,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + return cntSub; + } + + void memAlign(uint8_t *addrPtr){ + if (cntPub%4 > 0){ + addrPtr += cntPub; + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + return; + } + + uint32_t getTotalSize(){ + uint32_t tmpCntPub = cntPub; + cntPub = 0; + return tmpCntPub ; + } + +private: + std::string type_name = "geometry_msgs::msg::dds_::Point"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName<geometry_msgs::msg::Point*> { + static const char* value() + { + return "geometry_msgs::msg::dds_::Point_"; + } +}; +} + +#endif \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/pose.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/pose.hpp Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,119 @@ +#ifndef _GEOMETRY_MSGS_MSG_POSE_H +#define _GEOMETRY_MSGS_MSG_POSE_H + +#include <iostream> +#include <string> +#include "geometry_msgs/msg/point.hpp" +#include "geometry_msgs/msg/quaternion.hpp" + +using namespace std; + +namespace geometry_msgs +{ +namespace msg +{ +class Pose +{ +public: + uint32_t cntPub = 0; + uint32_t cntSub = 0; + + + geometry_msgs::msg::Point position +; + + geometry_msgs::msg::Quaternion orientation; + + + uint32_t copyToBuf(uint8_t *addrPtr) + { + uint32_t tmpPub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + tmpPub = position +.copyToBuf(addrPtr); + cntPub += tmpPub; + addrPtr += tmpPub; + + + + + + tmpPub = orientation.copyToBuf(addrPtr); + cntPub += tmpPub; + addrPtr += tmpPub; + + + + + return cntPub; + } + + uint32_t copyFromBuf(const uint8_t *addrPtr) { + uint32_t tmpSub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + + tmpSub = position +.copyFromBuf(addrPtr); + cntSub += tmpSub; + addrPtr += tmpSub; + + + + + + + tmpSub = orientation.copyFromBuf(addrPtr); + cntSub += tmpSub; + addrPtr += tmpSub; + + + + + + return cntSub; + } + + void memAlign(uint8_t *addrPtr){ + if (cntPub%4 > 0){ + addrPtr += cntPub; + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + return; + } + + uint32_t getTotalSize(){ + uint32_t tmpCntPub = cntPub; + cntPub = 0; + return tmpCntPub ; + } + +private: + std::string type_name = "geometry_msgs::msg::dds_::Pose"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName<geometry_msgs::msg::Pose*> { + static const char* value() + { + return "geometry_msgs::msg::dds_::Pose_"; + } +}; +} + +#endif \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/quaternion.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/quaternion.hpp Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,213 @@ +#ifndef _GEOMETRY_MSGS_MSG_QUATERNION_H +#define _GEOMETRY_MSGS_MSG_QUATERNION_H + +#include <iostream> +#include <string> + +using namespace std; + +namespace geometry_msgs +{ +namespace msg +{ +class Quaternion +{ +public: + uint32_t cntPub = 0; + uint32_t cntSub = 0; + + + double x +; + + double y +; + + double z +; + + double w; + + + uint32_t copyToBuf(uint8_t *addrPtr) + { + uint32_t tmpPub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&x +,8); + addrPtr += 8; + cntPub += 8; + + + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&y +,8); + addrPtr += 8; + cntPub += 8; + + + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&z +,8); + addrPtr += 8; + cntPub += 8; + + + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&w,8); + addrPtr += 8; + cntPub += 8; + + + + + return cntPub; + } + + uint32_t copyFromBuf(const uint8_t *addrPtr) { + uint32_t tmpSub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&x +,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&y +,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&z +,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&w,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + return cntSub; + } + + void memAlign(uint8_t *addrPtr){ + if (cntPub%4 > 0){ + addrPtr += cntPub; + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + return; + } + + uint32_t getTotalSize(){ + uint32_t tmpCntPub = cntPub; + cntPub = 0; + return tmpCntPub ; + } + +private: + std::string type_name = "geometry_msgs::msg::dds_::Quaternion"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName<geometry_msgs::msg::Quaternion*> { + static const char* value() + { + return "geometry_msgs::msg::dds_::Quaternion_"; + } +}; +} + +#endif \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/twist.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/twist.hpp Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,119 @@ +#ifndef _GEOMETRY_MSGS_MSG_TWIST_H +#define _GEOMETRY_MSGS_MSG_TWIST_H + +#include <iostream> +#include <string> +#include "geometry_msgs/msg/vector3.hpp" +#include "geometry_msgs/msg/vector3.hpp" + +using namespace std; + +namespace geometry_msgs +{ +namespace msg +{ +class Twist +{ +public: + uint32_t cntPub = 0; + uint32_t cntSub = 0; + + + geometry_msgs::msg::Vector3 linear +; + + geometry_msgs::msg::Vector3 angular; + + + uint32_t copyToBuf(uint8_t *addrPtr) + { + uint32_t tmpPub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + tmpPub = linear +.copyToBuf(addrPtr); + cntPub += tmpPub; + addrPtr += tmpPub; + + + + + + tmpPub = angular.copyToBuf(addrPtr); + cntPub += tmpPub; + addrPtr += tmpPub; + + + + + return cntPub; + } + + uint32_t copyFromBuf(const uint8_t *addrPtr) { + uint32_t tmpSub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + + tmpSub = linear +.copyFromBuf(addrPtr); + cntSub += tmpSub; + addrPtr += tmpSub; + + + + + + + tmpSub = angular.copyFromBuf(addrPtr); + cntSub += tmpSub; + addrPtr += tmpSub; + + + + + + return cntSub; + } + + void memAlign(uint8_t *addrPtr){ + if (cntPub%4 > 0){ + addrPtr += cntPub; + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + return; + } + + uint32_t getTotalSize(){ + uint32_t tmpCntPub = cntPub; + cntPub = 0; + return tmpCntPub ; + } + +private: + std::string type_name = "geometry_msgs::msg::dds_::Twist"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName<geometry_msgs::msg::Twist*> { + static const char* value() + { + return "geometry_msgs::msg::dds_::Twist_"; + } +}; +} + +#endif \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 custom_msgs/geometry_msgs/msg/vector3.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/custom_msgs/geometry_msgs/msg/vector3.hpp Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,178 @@ +#ifndef _GEOMETRY_MSGS_MSG_VECTOR3_H +#define _GEOMETRY_MSGS_MSG_VECTOR3_H + +#include <iostream> +#include <string> + +using namespace std; + +namespace geometry_msgs +{ +namespace msg +{ +class Vector3 +{ +public: + uint32_t cntPub = 0; + uint32_t cntSub = 0; + + + double x +; + + double y +; + + double z; + + + uint32_t copyToBuf(uint8_t *addrPtr) + { + uint32_t tmpPub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&x +,8); + addrPtr += 8; + cntPub += 8; + + + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&y +,8); + addrPtr += 8; + cntPub += 8; + + + + + + if (cntPub%8 > 0){ + for(int i=0; i<(8-(cntPub%8)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 8-(cntPub%8); + } + + memcpy(addrPtr,&z,8); + addrPtr += 8; + cntPub += 8; + + + + + return cntPub; + } + + uint32_t copyFromBuf(const uint8_t *addrPtr) { + uint32_t tmpSub = 0; + uint32_t arraySize; + uint32_t stringSize; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&x +,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&y +,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + + if (cntSub%8 > 0){ + for(int i=0; i<(8-(cntSub%8)) ; i++){ + addrPtr += 1; + } + cntSub += 8-(cntSub%8); + } + + memcpy(&z,addrPtr,8); + addrPtr += 8; + cntSub += 8; + + + + return cntSub; + } + + void memAlign(uint8_t *addrPtr){ + if (cntPub%4 > 0){ + addrPtr += cntPub; + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + return; + } + + uint32_t getTotalSize(){ + uint32_t tmpCntPub = cntPub; + cntPub = 0; + return tmpCntPub ; + } + +private: + std::string type_name = "geometry_msgs::msg::dds_::Vector3"; +}; +}; +} + +namespace message_traits +{ +template<> +struct TypeName<geometry_msgs::msg::Vector3*> { + static const char* value() + { + return "geometry_msgs::msg::dds_::Vector3_"; + } +}; +} + +#endif \ No newline at end of file
diff -r 159877d749c2 -r c80f65422d99 include/templates.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/templates.hpp Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,95 @@ +#include "std_msgs/msg/u_int8.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::UInt8*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::UInt8>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::UInt8>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::UInt8 &msg); + +#include "std_msgs/msg/u_int16.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::UInt16*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::UInt16>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::UInt16>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::UInt16 &msg); + +#include "std_msgs/msg/u_int32.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::UInt32*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::UInt32>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::UInt32>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::UInt32 &msg); + +#include "std_msgs/msg/u_int64.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::UInt64*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::UInt64>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::UInt64>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::UInt64 &msg); + +#include "std_msgs/msg/int8.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Int8*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Int8>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Int8>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Int8 &msg); + +#include "std_msgs/msg/int16.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Int16*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Int16>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Int16>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Int16 &msg); + +#include "std_msgs/msg/int32.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Int32*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Int32>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Int32>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Int32 &msg); + +#include "std_msgs/msg/int64.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Int64*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Int64>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Int64>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Int64 &msg); + +#include "std_msgs/msg/float32.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Float32*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Float32>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Float32>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Float32 &msg); + +#include "std_msgs/msg/float64.hpp" +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Float64*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Float64>(void *callee, const rtps::ReaderCacheChange &cacheChange); +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Float64>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Float64 &msg); + +#include "std_msgs/msg/char.hpp" +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Char>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Char &msg); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Char*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Char>(void *callee, const rtps::ReaderCacheChange &cacheChange); + +#include "std_msgs/msg/bool.hpp" +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Bool>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Bool &msg); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Bool*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Bool>(void *callee, const rtps::ReaderCacheChange &cacheChange); + +#include "std_msgs/msg/byte.hpp" +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::Byte>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::Byte &msg); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::Byte*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::Byte>(void *callee, const rtps::ReaderCacheChange &cacheChange); + +#include "std_msgs/msg/string.hpp" +template mros2::Publisher mros2::Node::create_publisher<std_msgs::msg::String>(std::string topic_name, int qos); +template void mros2::Publisher::publish(std_msgs::msg::String &msg); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(std_msgs::msg::String*)); +template void mros2::Subscriber::callback_handler<std_msgs::msg::String>(void *callee, const rtps::ReaderCacheChange &cacheChange); + +#include "geometry_msgs/msg/twist.hpp" +template mros2::Publisher mros2::Node::create_publisher<geometry_msgs::msg::Twist>(std::string topic_name, int qos); +template void mros2::Publisher::publish( geometry_msgs::msg::Twist &msg); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(geometry_msgs::msg::Twist*)); +template void mros2::Subscriber::callback_handler<geometry_msgs::msg::Twist>(void *callee, const rtps::ReaderCacheChange &cacheChange); + +#include "geometry_msgs/msg/pose.hpp" +template mros2::Publisher mros2::Node::create_publisher<geometry_msgs::msg::Pose>(std::string topic_name, int qos); +template void mros2::Publisher::publish( geometry_msgs::msg::Pose &msg); +template mros2::Subscriber mros2::Node::create_subscription(std::string topic_name, int qos, void (*fp)(geometry_msgs::msg::Pose*)); +template void mros2::Subscriber::callback_handler<geometry_msgs::msg::Pose>(void *callee, const rtps::ReaderCacheChange &cacheChange);
diff -r 159877d749c2 -r c80f65422d99 mros2_msgs/std_msgs/msg/header.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mros2_msgs/std_msgs/msg/header.hpp Sat Mar 19 09:23:37 2022 +0900 @@ -0,0 +1,80 @@ +#include <string> + +namespace std_msgs +{ +namespace msg +{ +class Header +{ +public: + std::string getTypeName(); + int32_t sec; + uint32_t nanosec; + std::string frame_id; + uint8_t cntPub = 0; + uint32_t pubSize; + uint32_t subSize; + + void copyToBuf(uint8_t *addrPtr) + { + memcpy(addrPtr, &sec, 4); + addrPtr += 4; + cntPub += 4; + memcpy(addrPtr, &nanosec, 4); + addrPtr += 4; + cntPub += 4; + pubSize = frame_id.size(); + memcpy(addrPtr, &pubSize, 4); + addrPtr += 4; + cntPub += 4; + memcpy(addrPtr, frame_id.c_str(),pubSize); + addrPtr += pubSize; + cntPub += pubSize; + } + + void copyFromBuf(const uint8_t *addrPtr) + { + memcpy(&sec, addrPtr, 4); + addrPtr += 4; + memcpy(&nanosec, addrPtr, 4); + addrPtr += 4; + memcpy(&subSize, addrPtr, 4); + addrPtr += 4; + frame_id.resize(subSize); + memcpy(&frame_id[0], addrPtr, subSize); + } + + void memAlign(uint8_t *addrPtr){ + if (cntPub%4 > 0){ + addrPtr += cntPub; + for(int i=0; i<(4-(cntPub%4)) ; i++){ + *addrPtr = 0; + addrPtr += 1; + } + cntPub += 4-(cntPub%4); + } + return; + } + + uint8_t getTotalSize() + { + return cntPub; + } +private: + std::string type_name = "std_msgs::msg::dds_::Header"; +}; +}//namspace msg +}//namespace std_msgs + +namespace message_traits +{ + +template<> +struct TypeName<std_msgs::msg::Header*> { + static const char* value() + { + return "std_msgs::msg::dds_::Header_"; + } +}; + +}