S Morita / mbed-mros2

Dependents:   mbed-os-example-mros2 example-mbed-mros2-sub-pose example-mbed-mros2-pub-twist example-mbed-mros2-mturtle-teleop

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers twist.hpp Source File

twist.hpp

00001 #ifndef _GEOMETRY_MSGS_MSG_TWIST_H
00002 #define _GEOMETRY_MSGS_MSG_TWIST_H
00003 
00004 #include <iostream>
00005 #include <string>
00006 #include "geometry_msgs/msg/vector3.hpp"
00007 #include "geometry_msgs/msg/vector3.hpp"
00008 
00009 using namespace std;
00010 
00011 namespace geometry_msgs
00012 {
00013 namespace msg
00014 {
00015 class Twist
00016 {
00017 public:
00018   uint32_t cntPub = 0;
00019   uint32_t cntSub = 0;
00020 
00021     
00022   geometry_msgs::msg::Vector3 linear
00023 ;
00024     
00025   geometry_msgs::msg::Vector3 angular;
00026   
00027 
00028   uint32_t copyToBuf(uint8_t *addrPtr)
00029   {
00030     uint32_t tmpPub = 0;
00031     uint32_t arraySize;
00032     uint32_t stringSize;
00033     
00034     
00035     
00036     tmpPub = linear
00037 .copyToBuf(addrPtr);
00038     cntPub += tmpPub;
00039     addrPtr += tmpPub;
00040     
00041     
00042     
00043     
00044     
00045     tmpPub = angular.copyToBuf(addrPtr);
00046     cntPub += tmpPub;
00047     addrPtr += tmpPub;
00048     
00049     
00050     
00051 
00052     return cntPub;
00053   }
00054 
00055   uint32_t copyFromBuf(const uint8_t *addrPtr) {
00056     uint32_t tmpSub = 0;
00057     uint32_t arraySize;
00058     uint32_t stringSize;
00059 
00060     
00061     
00062     
00063     tmpSub = linear
00064 .copyFromBuf(addrPtr);
00065     cntSub += tmpSub;
00066     addrPtr += tmpSub;
00067     
00068 
00069     
00070     
00071     
00072     
00073     tmpSub = angular.copyFromBuf(addrPtr);
00074     cntSub += tmpSub;
00075     addrPtr += tmpSub;
00076     
00077 
00078     
00079     
00080 
00081     return cntSub;
00082   }
00083 
00084    void memAlign(uint8_t *addrPtr){
00085     if (cntPub%4 > 0){
00086       addrPtr += cntPub;
00087       for(int i=0; i<(4-(cntPub%4)) ; i++){
00088         *addrPtr = 0;
00089         addrPtr += 1;
00090       }
00091       cntPub += 4-(cntPub%4);
00092     }
00093     return;
00094   }
00095 
00096   uint32_t getTotalSize(){
00097     uint32_t tmpCntPub = cntPub;
00098     cntPub = 0;
00099     return tmpCntPub ;
00100   }
00101 
00102 private:
00103   std::string type_name = "geometry_msgs::msg::dds_::Twist";
00104 };
00105 };
00106 }
00107 
00108 namespace message_traits
00109 {
00110 template<>
00111 struct TypeName<geometry_msgs::msg::Twist*> {
00112   static const char* value()
00113   {
00114     return "geometry_msgs::msg::dds_::Twist_";
00115   }
00116 };
00117 }
00118 
00119 #endif