hairo
Dependencies: mbed BufferedSerial
gazebo_msgs/SetJointProperties.h@4:bcdd99711326, 2018-12-04 (annotated)
- Committer:
- tknara
- Date:
- Tue Dec 04 00:14:32 2018 +0000
- Revision:
- 4:bcdd99711326
- Parent:
- 0:9e9b7db60fd5
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_SERVICE_SetJointProperties_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_SERVICE_SetJointProperties_h |
garyservin | 0:9e9b7db60fd5 | 3 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 4 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 7 | #include "gazebo_msgs/ODEJointProperties.h" |
garyservin | 0:9e9b7db60fd5 | 8 | |
garyservin | 0:9e9b7db60fd5 | 9 | namespace gazebo_msgs |
garyservin | 0:9e9b7db60fd5 | 10 | { |
garyservin | 0:9e9b7db60fd5 | 11 | |
garyservin | 0:9e9b7db60fd5 | 12 | static const char SETJOINTPROPERTIES[] = "gazebo_msgs/SetJointProperties"; |
garyservin | 0:9e9b7db60fd5 | 13 | |
garyservin | 0:9e9b7db60fd5 | 14 | class SetJointPropertiesRequest : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 15 | { |
garyservin | 0:9e9b7db60fd5 | 16 | public: |
garyservin | 0:9e9b7db60fd5 | 17 | typedef const char* _joint_name_type; |
garyservin | 0:9e9b7db60fd5 | 18 | _joint_name_type joint_name; |
garyservin | 0:9e9b7db60fd5 | 19 | typedef gazebo_msgs::ODEJointProperties _ode_joint_config_type; |
garyservin | 0:9e9b7db60fd5 | 20 | _ode_joint_config_type ode_joint_config; |
garyservin | 0:9e9b7db60fd5 | 21 | |
garyservin | 0:9e9b7db60fd5 | 22 | SetJointPropertiesRequest(): |
garyservin | 0:9e9b7db60fd5 | 23 | joint_name(""), |
garyservin | 0:9e9b7db60fd5 | 24 | ode_joint_config() |
garyservin | 0:9e9b7db60fd5 | 25 | { |
garyservin | 0:9e9b7db60fd5 | 26 | } |
garyservin | 0:9e9b7db60fd5 | 27 | |
garyservin | 0:9e9b7db60fd5 | 28 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 29 | { |
garyservin | 0:9e9b7db60fd5 | 30 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 31 | uint32_t length_joint_name = strlen(this->joint_name); |
garyservin | 0:9e9b7db60fd5 | 32 | varToArr(outbuffer + offset, length_joint_name); |
garyservin | 0:9e9b7db60fd5 | 33 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 34 | memcpy(outbuffer + offset, this->joint_name, length_joint_name); |
garyservin | 0:9e9b7db60fd5 | 35 | offset += length_joint_name; |
garyservin | 0:9e9b7db60fd5 | 36 | offset += this->ode_joint_config.serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 37 | return offset; |
garyservin | 0:9e9b7db60fd5 | 38 | } |
garyservin | 0:9e9b7db60fd5 | 39 | |
garyservin | 0:9e9b7db60fd5 | 40 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 41 | { |
garyservin | 0:9e9b7db60fd5 | 42 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 43 | uint32_t length_joint_name; |
garyservin | 0:9e9b7db60fd5 | 44 | arrToVar(length_joint_name, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 45 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 46 | for(unsigned int k= offset; k< offset+length_joint_name; ++k){ |
garyservin | 0:9e9b7db60fd5 | 47 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 48 | } |
garyservin | 0:9e9b7db60fd5 | 49 | inbuffer[offset+length_joint_name-1]=0; |
garyservin | 0:9e9b7db60fd5 | 50 | this->joint_name = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 51 | offset += length_joint_name; |
garyservin | 0:9e9b7db60fd5 | 52 | offset += this->ode_joint_config.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 53 | return offset; |
garyservin | 0:9e9b7db60fd5 | 54 | } |
garyservin | 0:9e9b7db60fd5 | 55 | |
garyservin | 0:9e9b7db60fd5 | 56 | const char * getType(){ return SETJOINTPROPERTIES; }; |
garyservin | 0:9e9b7db60fd5 | 57 | const char * getMD5(){ return "331fd8f35fd27e3c1421175590258e26"; }; |
garyservin | 0:9e9b7db60fd5 | 58 | |
garyservin | 0:9e9b7db60fd5 | 59 | }; |
garyservin | 0:9e9b7db60fd5 | 60 | |
garyservin | 0:9e9b7db60fd5 | 61 | class SetJointPropertiesResponse : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 62 | { |
garyservin | 0:9e9b7db60fd5 | 63 | public: |
garyservin | 0:9e9b7db60fd5 | 64 | typedef bool _success_type; |
garyservin | 0:9e9b7db60fd5 | 65 | _success_type success; |
garyservin | 0:9e9b7db60fd5 | 66 | typedef const char* _status_message_type; |
garyservin | 0:9e9b7db60fd5 | 67 | _status_message_type status_message; |
garyservin | 0:9e9b7db60fd5 | 68 | |
garyservin | 0:9e9b7db60fd5 | 69 | SetJointPropertiesResponse(): |
garyservin | 0:9e9b7db60fd5 | 70 | success(0), |
garyservin | 0:9e9b7db60fd5 | 71 | status_message("") |
garyservin | 0:9e9b7db60fd5 | 72 | { |
garyservin | 0:9e9b7db60fd5 | 73 | } |
garyservin | 0:9e9b7db60fd5 | 74 | |
garyservin | 0:9e9b7db60fd5 | 75 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 76 | { |
garyservin | 0:9e9b7db60fd5 | 77 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 78 | union { |
garyservin | 0:9e9b7db60fd5 | 79 | bool real; |
garyservin | 0:9e9b7db60fd5 | 80 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 81 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 82 | u_success.real = this->success; |
garyservin | 0:9e9b7db60fd5 | 83 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 84 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 85 | uint32_t length_status_message = strlen(this->status_message); |
garyservin | 0:9e9b7db60fd5 | 86 | varToArr(outbuffer + offset, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 87 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 88 | memcpy(outbuffer + offset, this->status_message, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 89 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 90 | return offset; |
garyservin | 0:9e9b7db60fd5 | 91 | } |
garyservin | 0:9e9b7db60fd5 | 92 | |
garyservin | 0:9e9b7db60fd5 | 93 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 94 | { |
garyservin | 0:9e9b7db60fd5 | 95 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 96 | union { |
garyservin | 0:9e9b7db60fd5 | 97 | bool real; |
garyservin | 0:9e9b7db60fd5 | 98 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 99 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 100 | u_success.base = 0; |
garyservin | 0:9e9b7db60fd5 | 101 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 102 | this->success = u_success.real; |
garyservin | 0:9e9b7db60fd5 | 103 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 104 | uint32_t length_status_message; |
garyservin | 0:9e9b7db60fd5 | 105 | arrToVar(length_status_message, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 106 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 107 | for(unsigned int k= offset; k< offset+length_status_message; ++k){ |
garyservin | 0:9e9b7db60fd5 | 108 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 109 | } |
garyservin | 0:9e9b7db60fd5 | 110 | inbuffer[offset+length_status_message-1]=0; |
garyservin | 0:9e9b7db60fd5 | 111 | this->status_message = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 112 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 113 | return offset; |
garyservin | 0:9e9b7db60fd5 | 114 | } |
garyservin | 0:9e9b7db60fd5 | 115 | |
garyservin | 0:9e9b7db60fd5 | 116 | const char * getType(){ return SETJOINTPROPERTIES; }; |
garyservin | 0:9e9b7db60fd5 | 117 | const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; }; |
garyservin | 0:9e9b7db60fd5 | 118 | |
garyservin | 0:9e9b7db60fd5 | 119 | }; |
garyservin | 0:9e9b7db60fd5 | 120 | |
garyservin | 0:9e9b7db60fd5 | 121 | class SetJointProperties { |
garyservin | 0:9e9b7db60fd5 | 122 | public: |
garyservin | 0:9e9b7db60fd5 | 123 | typedef SetJointPropertiesRequest Request; |
garyservin | 0:9e9b7db60fd5 | 124 | typedef SetJointPropertiesResponse Response; |
garyservin | 0:9e9b7db60fd5 | 125 | }; |
garyservin | 0:9e9b7db60fd5 | 126 | |
garyservin | 0:9e9b7db60fd5 | 127 | } |
garyservin | 0:9e9b7db60fd5 | 128 | #endif |