hairo

Dependencies:   mbed BufferedSerial

Committer:
tknara
Date:
Tue Dec 04 00:14:32 2018 +0000
Revision:
4:bcdd99711326
Parent:
0:9e9b7db60fd5
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_SERVICE_SetJointTrajectory_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_SERVICE_SetJointTrajectory_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 "trajectory_msgs/JointTrajectory.h"
garyservin 0:9e9b7db60fd5 8 #include "geometry_msgs/Pose.h"
garyservin 0:9e9b7db60fd5 9
garyservin 0:9e9b7db60fd5 10 namespace gazebo_msgs
garyservin 0:9e9b7db60fd5 11 {
garyservin 0:9e9b7db60fd5 12
garyservin 0:9e9b7db60fd5 13 static const char SETJOINTTRAJECTORY[] = "gazebo_msgs/SetJointTrajectory";
garyservin 0:9e9b7db60fd5 14
garyservin 0:9e9b7db60fd5 15 class SetJointTrajectoryRequest : public ros::Msg
garyservin 0:9e9b7db60fd5 16 {
garyservin 0:9e9b7db60fd5 17 public:
garyservin 0:9e9b7db60fd5 18 typedef const char* _model_name_type;
garyservin 0:9e9b7db60fd5 19 _model_name_type model_name;
garyservin 0:9e9b7db60fd5 20 typedef trajectory_msgs::JointTrajectory _joint_trajectory_type;
garyservin 0:9e9b7db60fd5 21 _joint_trajectory_type joint_trajectory;
garyservin 0:9e9b7db60fd5 22 typedef geometry_msgs::Pose _model_pose_type;
garyservin 0:9e9b7db60fd5 23 _model_pose_type model_pose;
garyservin 0:9e9b7db60fd5 24 typedef bool _set_model_pose_type;
garyservin 0:9e9b7db60fd5 25 _set_model_pose_type set_model_pose;
garyservin 0:9e9b7db60fd5 26 typedef bool _disable_physics_updates_type;
garyservin 0:9e9b7db60fd5 27 _disable_physics_updates_type disable_physics_updates;
garyservin 0:9e9b7db60fd5 28
garyservin 0:9e9b7db60fd5 29 SetJointTrajectoryRequest():
garyservin 0:9e9b7db60fd5 30 model_name(""),
garyservin 0:9e9b7db60fd5 31 joint_trajectory(),
garyservin 0:9e9b7db60fd5 32 model_pose(),
garyservin 0:9e9b7db60fd5 33 set_model_pose(0),
garyservin 0:9e9b7db60fd5 34 disable_physics_updates(0)
garyservin 0:9e9b7db60fd5 35 {
garyservin 0:9e9b7db60fd5 36 }
garyservin 0:9e9b7db60fd5 37
garyservin 0:9e9b7db60fd5 38 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 39 {
garyservin 0:9e9b7db60fd5 40 int offset = 0;
garyservin 0:9e9b7db60fd5 41 uint32_t length_model_name = strlen(this->model_name);
garyservin 0:9e9b7db60fd5 42 varToArr(outbuffer + offset, length_model_name);
garyservin 0:9e9b7db60fd5 43 offset += 4;
garyservin 0:9e9b7db60fd5 44 memcpy(outbuffer + offset, this->model_name, length_model_name);
garyservin 0:9e9b7db60fd5 45 offset += length_model_name;
garyservin 0:9e9b7db60fd5 46 offset += this->joint_trajectory.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 47 offset += this->model_pose.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 48 union {
garyservin 0:9e9b7db60fd5 49 bool real;
garyservin 0:9e9b7db60fd5 50 uint8_t base;
garyservin 0:9e9b7db60fd5 51 } u_set_model_pose;
garyservin 0:9e9b7db60fd5 52 u_set_model_pose.real = this->set_model_pose;
garyservin 0:9e9b7db60fd5 53 *(outbuffer + offset + 0) = (u_set_model_pose.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 54 offset += sizeof(this->set_model_pose);
garyservin 0:9e9b7db60fd5 55 union {
garyservin 0:9e9b7db60fd5 56 bool real;
garyservin 0:9e9b7db60fd5 57 uint8_t base;
garyservin 0:9e9b7db60fd5 58 } u_disable_physics_updates;
garyservin 0:9e9b7db60fd5 59 u_disable_physics_updates.real = this->disable_physics_updates;
garyservin 0:9e9b7db60fd5 60 *(outbuffer + offset + 0) = (u_disable_physics_updates.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 61 offset += sizeof(this->disable_physics_updates);
garyservin 0:9e9b7db60fd5 62 return offset;
garyservin 0:9e9b7db60fd5 63 }
garyservin 0:9e9b7db60fd5 64
garyservin 0:9e9b7db60fd5 65 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 66 {
garyservin 0:9e9b7db60fd5 67 int offset = 0;
garyservin 0:9e9b7db60fd5 68 uint32_t length_model_name;
garyservin 0:9e9b7db60fd5 69 arrToVar(length_model_name, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 70 offset += 4;
garyservin 0:9e9b7db60fd5 71 for(unsigned int k= offset; k< offset+length_model_name; ++k){
garyservin 0:9e9b7db60fd5 72 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 73 }
garyservin 0:9e9b7db60fd5 74 inbuffer[offset+length_model_name-1]=0;
garyservin 0:9e9b7db60fd5 75 this->model_name = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 76 offset += length_model_name;
garyservin 0:9e9b7db60fd5 77 offset += this->joint_trajectory.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 78 offset += this->model_pose.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 79 union {
garyservin 0:9e9b7db60fd5 80 bool real;
garyservin 0:9e9b7db60fd5 81 uint8_t base;
garyservin 0:9e9b7db60fd5 82 } u_set_model_pose;
garyservin 0:9e9b7db60fd5 83 u_set_model_pose.base = 0;
garyservin 0:9e9b7db60fd5 84 u_set_model_pose.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 85 this->set_model_pose = u_set_model_pose.real;
garyservin 0:9e9b7db60fd5 86 offset += sizeof(this->set_model_pose);
garyservin 0:9e9b7db60fd5 87 union {
garyservin 0:9e9b7db60fd5 88 bool real;
garyservin 0:9e9b7db60fd5 89 uint8_t base;
garyservin 0:9e9b7db60fd5 90 } u_disable_physics_updates;
garyservin 0:9e9b7db60fd5 91 u_disable_physics_updates.base = 0;
garyservin 0:9e9b7db60fd5 92 u_disable_physics_updates.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 93 this->disable_physics_updates = u_disable_physics_updates.real;
garyservin 0:9e9b7db60fd5 94 offset += sizeof(this->disable_physics_updates);
garyservin 0:9e9b7db60fd5 95 return offset;
garyservin 0:9e9b7db60fd5 96 }
garyservin 0:9e9b7db60fd5 97
garyservin 0:9e9b7db60fd5 98 const char * getType(){ return SETJOINTTRAJECTORY; };
garyservin 0:9e9b7db60fd5 99 const char * getMD5(){ return "649dd2eba5ffd358069238825f9f85ab"; };
garyservin 0:9e9b7db60fd5 100
garyservin 0:9e9b7db60fd5 101 };
garyservin 0:9e9b7db60fd5 102
garyservin 0:9e9b7db60fd5 103 class SetJointTrajectoryResponse : public ros::Msg
garyservin 0:9e9b7db60fd5 104 {
garyservin 0:9e9b7db60fd5 105 public:
garyservin 0:9e9b7db60fd5 106 typedef bool _success_type;
garyservin 0:9e9b7db60fd5 107 _success_type success;
garyservin 0:9e9b7db60fd5 108 typedef const char* _status_message_type;
garyservin 0:9e9b7db60fd5 109 _status_message_type status_message;
garyservin 0:9e9b7db60fd5 110
garyservin 0:9e9b7db60fd5 111 SetJointTrajectoryResponse():
garyservin 0:9e9b7db60fd5 112 success(0),
garyservin 0:9e9b7db60fd5 113 status_message("")
garyservin 0:9e9b7db60fd5 114 {
garyservin 0:9e9b7db60fd5 115 }
garyservin 0:9e9b7db60fd5 116
garyservin 0:9e9b7db60fd5 117 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 118 {
garyservin 0:9e9b7db60fd5 119 int offset = 0;
garyservin 0:9e9b7db60fd5 120 union {
garyservin 0:9e9b7db60fd5 121 bool real;
garyservin 0:9e9b7db60fd5 122 uint8_t base;
garyservin 0:9e9b7db60fd5 123 } u_success;
garyservin 0:9e9b7db60fd5 124 u_success.real = this->success;
garyservin 0:9e9b7db60fd5 125 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 126 offset += sizeof(this->success);
garyservin 0:9e9b7db60fd5 127 uint32_t length_status_message = strlen(this->status_message);
garyservin 0:9e9b7db60fd5 128 varToArr(outbuffer + offset, length_status_message);
garyservin 0:9e9b7db60fd5 129 offset += 4;
garyservin 0:9e9b7db60fd5 130 memcpy(outbuffer + offset, this->status_message, length_status_message);
garyservin 0:9e9b7db60fd5 131 offset += length_status_message;
garyservin 0:9e9b7db60fd5 132 return offset;
garyservin 0:9e9b7db60fd5 133 }
garyservin 0:9e9b7db60fd5 134
garyservin 0:9e9b7db60fd5 135 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 136 {
garyservin 0:9e9b7db60fd5 137 int offset = 0;
garyservin 0:9e9b7db60fd5 138 union {
garyservin 0:9e9b7db60fd5 139 bool real;
garyservin 0:9e9b7db60fd5 140 uint8_t base;
garyservin 0:9e9b7db60fd5 141 } u_success;
garyservin 0:9e9b7db60fd5 142 u_success.base = 0;
garyservin 0:9e9b7db60fd5 143 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 144 this->success = u_success.real;
garyservin 0:9e9b7db60fd5 145 offset += sizeof(this->success);
garyservin 0:9e9b7db60fd5 146 uint32_t length_status_message;
garyservin 0:9e9b7db60fd5 147 arrToVar(length_status_message, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 148 offset += 4;
garyservin 0:9e9b7db60fd5 149 for(unsigned int k= offset; k< offset+length_status_message; ++k){
garyservin 0:9e9b7db60fd5 150 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 151 }
garyservin 0:9e9b7db60fd5 152 inbuffer[offset+length_status_message-1]=0;
garyservin 0:9e9b7db60fd5 153 this->status_message = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 154 offset += length_status_message;
garyservin 0:9e9b7db60fd5 155 return offset;
garyservin 0:9e9b7db60fd5 156 }
garyservin 0:9e9b7db60fd5 157
garyservin 0:9e9b7db60fd5 158 const char * getType(){ return SETJOINTTRAJECTORY; };
garyservin 0:9e9b7db60fd5 159 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
garyservin 0:9e9b7db60fd5 160
garyservin 0:9e9b7db60fd5 161 };
garyservin 0:9e9b7db60fd5 162
garyservin 0:9e9b7db60fd5 163 class SetJointTrajectory {
garyservin 0:9e9b7db60fd5 164 public:
garyservin 0:9e9b7db60fd5 165 typedef SetJointTrajectoryRequest Request;
garyservin 0:9e9b7db60fd5 166 typedef SetJointTrajectoryResponse Response;
garyservin 0:9e9b7db60fd5 167 };
garyservin 0:9e9b7db60fd5 168
garyservin 0:9e9b7db60fd5 169 }
garyservin 0:9e9b7db60fd5 170 #endif