It has only one change from original one. I added robotfeedback message on it.

Dependencies:   BufferedSerial

Dependents:   RobotFeedback mobileRobotITU

Fork of ros_lib_indigo by Gary Servin

Committer:
randalthor
Date:
Sat Mar 04 14:07:56 2017 +0000
Revision:
4:80d9bee5079a
Parent:
0:fd24f7ca9688
fatih

Who changed what in which revision?

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