It has only one change from original one. I added robotfeedback message on it.
Dependents: RobotFeedback mobileRobotITU
Fork of ros_lib_indigo by
sensor_msgs/MultiDOFJointState.h@0:fd24f7ca9688, 2016-03-31 (annotated)
- Committer:
- garyservin
- Date:
- Thu Mar 31 14:22:59 2016 +0000
- Revision:
- 0:fd24f7ca9688
Initial commit, generated based on a clean indigo-desktop-full
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:fd24f7ca9688 | 1 | #ifndef _ROS_sensor_msgs_MultiDOFJointState_h |
garyservin | 0:fd24f7ca9688 | 2 | #define _ROS_sensor_msgs_MultiDOFJointState_h |
garyservin | 0:fd24f7ca9688 | 3 | |
garyservin | 0:fd24f7ca9688 | 4 | #include <stdint.h> |
garyservin | 0:fd24f7ca9688 | 5 | #include <string.h> |
garyservin | 0:fd24f7ca9688 | 6 | #include <stdlib.h> |
garyservin | 0:fd24f7ca9688 | 7 | #include "ros/msg.h" |
garyservin | 0:fd24f7ca9688 | 8 | #include "std_msgs/Header.h" |
garyservin | 0:fd24f7ca9688 | 9 | #include "geometry_msgs/Transform.h" |
garyservin | 0:fd24f7ca9688 | 10 | #include "geometry_msgs/Twist.h" |
garyservin | 0:fd24f7ca9688 | 11 | #include "geometry_msgs/Wrench.h" |
garyservin | 0:fd24f7ca9688 | 12 | |
garyservin | 0:fd24f7ca9688 | 13 | namespace sensor_msgs |
garyservin | 0:fd24f7ca9688 | 14 | { |
garyservin | 0:fd24f7ca9688 | 15 | |
garyservin | 0:fd24f7ca9688 | 16 | class MultiDOFJointState : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 17 | { |
garyservin | 0:fd24f7ca9688 | 18 | public: |
garyservin | 0:fd24f7ca9688 | 19 | std_msgs::Header header; |
garyservin | 0:fd24f7ca9688 | 20 | uint8_t joint_names_length; |
garyservin | 0:fd24f7ca9688 | 21 | char* st_joint_names; |
garyservin | 0:fd24f7ca9688 | 22 | char* * joint_names; |
garyservin | 0:fd24f7ca9688 | 23 | uint8_t transforms_length; |
garyservin | 0:fd24f7ca9688 | 24 | geometry_msgs::Transform st_transforms; |
garyservin | 0:fd24f7ca9688 | 25 | geometry_msgs::Transform * transforms; |
garyservin | 0:fd24f7ca9688 | 26 | uint8_t twist_length; |
garyservin | 0:fd24f7ca9688 | 27 | geometry_msgs::Twist st_twist; |
garyservin | 0:fd24f7ca9688 | 28 | geometry_msgs::Twist * twist; |
garyservin | 0:fd24f7ca9688 | 29 | uint8_t wrench_length; |
garyservin | 0:fd24f7ca9688 | 30 | geometry_msgs::Wrench st_wrench; |
garyservin | 0:fd24f7ca9688 | 31 | geometry_msgs::Wrench * wrench; |
garyservin | 0:fd24f7ca9688 | 32 | |
garyservin | 0:fd24f7ca9688 | 33 | MultiDOFJointState(): |
garyservin | 0:fd24f7ca9688 | 34 | header(), |
garyservin | 0:fd24f7ca9688 | 35 | joint_names_length(0), joint_names(NULL), |
garyservin | 0:fd24f7ca9688 | 36 | transforms_length(0), transforms(NULL), |
garyservin | 0:fd24f7ca9688 | 37 | twist_length(0), twist(NULL), |
garyservin | 0:fd24f7ca9688 | 38 | wrench_length(0), wrench(NULL) |
garyservin | 0:fd24f7ca9688 | 39 | { |
garyservin | 0:fd24f7ca9688 | 40 | } |
garyservin | 0:fd24f7ca9688 | 41 | |
garyservin | 0:fd24f7ca9688 | 42 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 43 | { |
garyservin | 0:fd24f7ca9688 | 44 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 45 | offset += this->header.serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 46 | *(outbuffer + offset++) = joint_names_length; |
garyservin | 0:fd24f7ca9688 | 47 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 48 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 49 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 50 | for( uint8_t i = 0; i < joint_names_length; i++){ |
garyservin | 0:fd24f7ca9688 | 51 | uint32_t length_joint_namesi = strlen(this->joint_names[i]); |
garyservin | 0:fd24f7ca9688 | 52 | memcpy(outbuffer + offset, &length_joint_namesi, sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 53 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 54 | memcpy(outbuffer + offset, this->joint_names[i], length_joint_namesi); |
garyservin | 0:fd24f7ca9688 | 55 | offset += length_joint_namesi; |
garyservin | 0:fd24f7ca9688 | 56 | } |
garyservin | 0:fd24f7ca9688 | 57 | *(outbuffer + offset++) = transforms_length; |
garyservin | 0:fd24f7ca9688 | 58 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 59 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 60 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 61 | for( uint8_t i = 0; i < transforms_length; i++){ |
garyservin | 0:fd24f7ca9688 | 62 | offset += this->transforms[i].serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 63 | } |
garyservin | 0:fd24f7ca9688 | 64 | *(outbuffer + offset++) = twist_length; |
garyservin | 0:fd24f7ca9688 | 65 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 66 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 67 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 68 | for( uint8_t i = 0; i < twist_length; i++){ |
garyservin | 0:fd24f7ca9688 | 69 | offset += this->twist[i].serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 70 | } |
garyservin | 0:fd24f7ca9688 | 71 | *(outbuffer + offset++) = wrench_length; |
garyservin | 0:fd24f7ca9688 | 72 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 73 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 74 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 75 | for( uint8_t i = 0; i < wrench_length; i++){ |
garyservin | 0:fd24f7ca9688 | 76 | offset += this->wrench[i].serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 77 | } |
garyservin | 0:fd24f7ca9688 | 78 | return offset; |
garyservin | 0:fd24f7ca9688 | 79 | } |
garyservin | 0:fd24f7ca9688 | 80 | |
garyservin | 0:fd24f7ca9688 | 81 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 82 | { |
garyservin | 0:fd24f7ca9688 | 83 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 84 | offset += this->header.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 85 | uint8_t joint_names_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 86 | if(joint_names_lengthT > joint_names_length) |
garyservin | 0:fd24f7ca9688 | 87 | this->joint_names = (char**)realloc(this->joint_names, joint_names_lengthT * sizeof(char*)); |
garyservin | 0:fd24f7ca9688 | 88 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 89 | joint_names_length = joint_names_lengthT; |
garyservin | 0:fd24f7ca9688 | 90 | for( uint8_t i = 0; i < joint_names_length; i++){ |
garyservin | 0:fd24f7ca9688 | 91 | uint32_t length_st_joint_names; |
garyservin | 0:fd24f7ca9688 | 92 | memcpy(&length_st_joint_names, (inbuffer + offset), sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 93 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 94 | for(unsigned int k= offset; k< offset+length_st_joint_names; ++k){ |
garyservin | 0:fd24f7ca9688 | 95 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:fd24f7ca9688 | 96 | } |
garyservin | 0:fd24f7ca9688 | 97 | inbuffer[offset+length_st_joint_names-1]=0; |
garyservin | 0:fd24f7ca9688 | 98 | this->st_joint_names = (char *)(inbuffer + offset-1); |
garyservin | 0:fd24f7ca9688 | 99 | offset += length_st_joint_names; |
garyservin | 0:fd24f7ca9688 | 100 | memcpy( &(this->joint_names[i]), &(this->st_joint_names), sizeof(char*)); |
garyservin | 0:fd24f7ca9688 | 101 | } |
garyservin | 0:fd24f7ca9688 | 102 | uint8_t transforms_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 103 | if(transforms_lengthT > transforms_length) |
garyservin | 0:fd24f7ca9688 | 104 | this->transforms = (geometry_msgs::Transform*)realloc(this->transforms, transforms_lengthT * sizeof(geometry_msgs::Transform)); |
garyservin | 0:fd24f7ca9688 | 105 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 106 | transforms_length = transforms_lengthT; |
garyservin | 0:fd24f7ca9688 | 107 | for( uint8_t i = 0; i < transforms_length; i++){ |
garyservin | 0:fd24f7ca9688 | 108 | offset += this->st_transforms.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 109 | memcpy( &(this->transforms[i]), &(this->st_transforms), sizeof(geometry_msgs::Transform)); |
garyservin | 0:fd24f7ca9688 | 110 | } |
garyservin | 0:fd24f7ca9688 | 111 | uint8_t twist_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 112 | if(twist_lengthT > twist_length) |
garyservin | 0:fd24f7ca9688 | 113 | this->twist = (geometry_msgs::Twist*)realloc(this->twist, twist_lengthT * sizeof(geometry_msgs::Twist)); |
garyservin | 0:fd24f7ca9688 | 114 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 115 | twist_length = twist_lengthT; |
garyservin | 0:fd24f7ca9688 | 116 | for( uint8_t i = 0; i < twist_length; i++){ |
garyservin | 0:fd24f7ca9688 | 117 | offset += this->st_twist.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 118 | memcpy( &(this->twist[i]), &(this->st_twist), sizeof(geometry_msgs::Twist)); |
garyservin | 0:fd24f7ca9688 | 119 | } |
garyservin | 0:fd24f7ca9688 | 120 | uint8_t wrench_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 121 | if(wrench_lengthT > wrench_length) |
garyservin | 0:fd24f7ca9688 | 122 | this->wrench = (geometry_msgs::Wrench*)realloc(this->wrench, wrench_lengthT * sizeof(geometry_msgs::Wrench)); |
garyservin | 0:fd24f7ca9688 | 123 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 124 | wrench_length = wrench_lengthT; |
garyservin | 0:fd24f7ca9688 | 125 | for( uint8_t i = 0; i < wrench_length; i++){ |
garyservin | 0:fd24f7ca9688 | 126 | offset += this->st_wrench.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 127 | memcpy( &(this->wrench[i]), &(this->st_wrench), sizeof(geometry_msgs::Wrench)); |
garyservin | 0:fd24f7ca9688 | 128 | } |
garyservin | 0:fd24f7ca9688 | 129 | return offset; |
garyservin | 0:fd24f7ca9688 | 130 | } |
garyservin | 0:fd24f7ca9688 | 131 | |
garyservin | 0:fd24f7ca9688 | 132 | const char * getType(){ return "sensor_msgs/MultiDOFJointState"; }; |
garyservin | 0:fd24f7ca9688 | 133 | const char * getMD5(){ return "690f272f0640d2631c305eeb8301e59d"; }; |
garyservin | 0:fd24f7ca9688 | 134 | |
garyservin | 0:fd24f7ca9688 | 135 | }; |
garyservin | 0:fd24f7ca9688 | 136 | |
garyservin | 0:fd24f7ca9688 | 137 | } |
garyservin | 0:fd24f7ca9688 | 138 | #endif |