-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from mROS-base/readme
Improve README for custom MsgType
- Loading branch information
Showing
17 changed files
with
1,220 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "../workspace/sub_pose/templates.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
#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(){ | ||
return cntPub ; | ||
} | ||
|
||
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 |
Oops, something went wrong.