ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
Diff: ros_lib/gazebo_msgs/ContactsState.h
- Revision:
- 0:020db18a476d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ros_lib/gazebo_msgs/ContactsState.h Wed Oct 30 14:59:49 2019 +0000 @@ -0,0 +1,70 @@ +#ifndef _ROS_gazebo_msgs_ContactsState_h +#define _ROS_gazebo_msgs_ContactsState_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" +#include "std_msgs/Header.h" +#include "gazebo_msgs/ContactState.h" + +namespace gazebo_msgs +{ + + class ContactsState : public ros::Msg + { + public: + typedef std_msgs::Header _header_type; + _header_type header; + uint32_t states_length; + typedef gazebo_msgs::ContactState _states_type; + _states_type st_states; + _states_type * states; + + ContactsState(): + header(), + states_length(0), states(NULL) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + offset += this->header.serialize(outbuffer + offset); + *(outbuffer + offset + 0) = (this->states_length >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->states_length >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (this->states_length >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (this->states_length >> (8 * 3)) & 0xFF; + offset += sizeof(this->states_length); + for( uint32_t i = 0; i < states_length; i++){ + offset += this->states[i].serialize(outbuffer + offset); + } + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + offset += this->header.deserialize(inbuffer + offset); + uint32_t states_lengthT = ((uint32_t) (*(inbuffer + offset))); + states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + offset += sizeof(this->states_length); + if(states_lengthT > states_length) + this->states = (gazebo_msgs::ContactState*)realloc(this->states, states_lengthT * sizeof(gazebo_msgs::ContactState)); + states_length = states_lengthT; + for( uint32_t i = 0; i < states_length; i++){ + offset += this->st_states.deserialize(inbuffer + offset); + memcpy( &(this->states[i]), &(this->st_states), sizeof(gazebo_msgs::ContactState)); + } + return offset; + } + + const char * getType(){ return "gazebo_msgs/ContactsState"; }; + const char * getMD5(){ return "acbcb1601a8e525bf72509f18e6f668d"; }; + + }; + +} +#endif