rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
pr2_mechanism_msgs/MechanismStatistics.h@0:30537dec6e0b, 2015-02-15 (annotated)
- Committer:
- akashvibhute
- Date:
- Sun Feb 15 10:53:43 2015 +0000
- Revision:
- 0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | #ifndef _ROS_pr2_mechanism_msgs_MechanismStatistics_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_pr2_mechanism_msgs_MechanismStatistics_h |
akashvibhute | 0:30537dec6e0b | 3 | |
akashvibhute | 0:30537dec6e0b | 4 | #include <stdint.h> |
akashvibhute | 0:30537dec6e0b | 5 | #include <string.h> |
akashvibhute | 0:30537dec6e0b | 6 | #include <stdlib.h> |
akashvibhute | 0:30537dec6e0b | 7 | #include "ros/msg.h" |
akashvibhute | 0:30537dec6e0b | 8 | #include "std_msgs/Header.h" |
akashvibhute | 0:30537dec6e0b | 9 | #include "pr2_mechanism_msgs/ActuatorStatistics.h" |
akashvibhute | 0:30537dec6e0b | 10 | #include "pr2_mechanism_msgs/JointStatistics.h" |
akashvibhute | 0:30537dec6e0b | 11 | #include "pr2_mechanism_msgs/ControllerStatistics.h" |
akashvibhute | 0:30537dec6e0b | 12 | |
akashvibhute | 0:30537dec6e0b | 13 | namespace pr2_mechanism_msgs |
akashvibhute | 0:30537dec6e0b | 14 | { |
akashvibhute | 0:30537dec6e0b | 15 | |
akashvibhute | 0:30537dec6e0b | 16 | class MechanismStatistics : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 17 | { |
akashvibhute | 0:30537dec6e0b | 18 | public: |
akashvibhute | 0:30537dec6e0b | 19 | std_msgs::Header header; |
akashvibhute | 0:30537dec6e0b | 20 | uint8_t actuator_statistics_length; |
akashvibhute | 0:30537dec6e0b | 21 | pr2_mechanism_msgs::ActuatorStatistics st_actuator_statistics; |
akashvibhute | 0:30537dec6e0b | 22 | pr2_mechanism_msgs::ActuatorStatistics * actuator_statistics; |
akashvibhute | 0:30537dec6e0b | 23 | uint8_t joint_statistics_length; |
akashvibhute | 0:30537dec6e0b | 24 | pr2_mechanism_msgs::JointStatistics st_joint_statistics; |
akashvibhute | 0:30537dec6e0b | 25 | pr2_mechanism_msgs::JointStatistics * joint_statistics; |
akashvibhute | 0:30537dec6e0b | 26 | uint8_t controller_statistics_length; |
akashvibhute | 0:30537dec6e0b | 27 | pr2_mechanism_msgs::ControllerStatistics st_controller_statistics; |
akashvibhute | 0:30537dec6e0b | 28 | pr2_mechanism_msgs::ControllerStatistics * controller_statistics; |
akashvibhute | 0:30537dec6e0b | 29 | |
akashvibhute | 0:30537dec6e0b | 30 | MechanismStatistics(): |
akashvibhute | 0:30537dec6e0b | 31 | header(), |
akashvibhute | 0:30537dec6e0b | 32 | actuator_statistics_length(0), actuator_statistics(NULL), |
akashvibhute | 0:30537dec6e0b | 33 | joint_statistics_length(0), joint_statistics(NULL), |
akashvibhute | 0:30537dec6e0b | 34 | controller_statistics_length(0), controller_statistics(NULL) |
akashvibhute | 0:30537dec6e0b | 35 | { |
akashvibhute | 0:30537dec6e0b | 36 | } |
akashvibhute | 0:30537dec6e0b | 37 | |
akashvibhute | 0:30537dec6e0b | 38 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 39 | { |
akashvibhute | 0:30537dec6e0b | 40 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 41 | offset += this->header.serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 42 | *(outbuffer + offset++) = actuator_statistics_length; |
akashvibhute | 0:30537dec6e0b | 43 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 44 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 45 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 46 | for( uint8_t i = 0; i < actuator_statistics_length; i++){ |
akashvibhute | 0:30537dec6e0b | 47 | offset += this->actuator_statistics[i].serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 48 | } |
akashvibhute | 0:30537dec6e0b | 49 | *(outbuffer + offset++) = joint_statistics_length; |
akashvibhute | 0:30537dec6e0b | 50 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 51 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 52 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 53 | for( uint8_t i = 0; i < joint_statistics_length; i++){ |
akashvibhute | 0:30537dec6e0b | 54 | offset += this->joint_statistics[i].serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 55 | } |
akashvibhute | 0:30537dec6e0b | 56 | *(outbuffer + offset++) = controller_statistics_length; |
akashvibhute | 0:30537dec6e0b | 57 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 58 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 59 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 60 | for( uint8_t i = 0; i < controller_statistics_length; i++){ |
akashvibhute | 0:30537dec6e0b | 61 | offset += this->controller_statistics[i].serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 62 | } |
akashvibhute | 0:30537dec6e0b | 63 | return offset; |
akashvibhute | 0:30537dec6e0b | 64 | } |
akashvibhute | 0:30537dec6e0b | 65 | |
akashvibhute | 0:30537dec6e0b | 66 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 67 | { |
akashvibhute | 0:30537dec6e0b | 68 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 69 | offset += this->header.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 70 | uint8_t actuator_statistics_lengthT = *(inbuffer + offset++); |
akashvibhute | 0:30537dec6e0b | 71 | if(actuator_statistics_lengthT > actuator_statistics_length) |
akashvibhute | 0:30537dec6e0b | 72 | this->actuator_statistics = (pr2_mechanism_msgs::ActuatorStatistics*)realloc(this->actuator_statistics, actuator_statistics_lengthT * sizeof(pr2_mechanism_msgs::ActuatorStatistics)); |
akashvibhute | 0:30537dec6e0b | 73 | offset += 3; |
akashvibhute | 0:30537dec6e0b | 74 | actuator_statistics_length = actuator_statistics_lengthT; |
akashvibhute | 0:30537dec6e0b | 75 | for( uint8_t i = 0; i < actuator_statistics_length; i++){ |
akashvibhute | 0:30537dec6e0b | 76 | offset += this->st_actuator_statistics.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 77 | memcpy( &(this->actuator_statistics[i]), &(this->st_actuator_statistics), sizeof(pr2_mechanism_msgs::ActuatorStatistics)); |
akashvibhute | 0:30537dec6e0b | 78 | } |
akashvibhute | 0:30537dec6e0b | 79 | uint8_t joint_statistics_lengthT = *(inbuffer + offset++); |
akashvibhute | 0:30537dec6e0b | 80 | if(joint_statistics_lengthT > joint_statistics_length) |
akashvibhute | 0:30537dec6e0b | 81 | this->joint_statistics = (pr2_mechanism_msgs::JointStatistics*)realloc(this->joint_statistics, joint_statistics_lengthT * sizeof(pr2_mechanism_msgs::JointStatistics)); |
akashvibhute | 0:30537dec6e0b | 82 | offset += 3; |
akashvibhute | 0:30537dec6e0b | 83 | joint_statistics_length = joint_statistics_lengthT; |
akashvibhute | 0:30537dec6e0b | 84 | for( uint8_t i = 0; i < joint_statistics_length; i++){ |
akashvibhute | 0:30537dec6e0b | 85 | offset += this->st_joint_statistics.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 86 | memcpy( &(this->joint_statistics[i]), &(this->st_joint_statistics), sizeof(pr2_mechanism_msgs::JointStatistics)); |
akashvibhute | 0:30537dec6e0b | 87 | } |
akashvibhute | 0:30537dec6e0b | 88 | uint8_t controller_statistics_lengthT = *(inbuffer + offset++); |
akashvibhute | 0:30537dec6e0b | 89 | if(controller_statistics_lengthT > controller_statistics_length) |
akashvibhute | 0:30537dec6e0b | 90 | this->controller_statistics = (pr2_mechanism_msgs::ControllerStatistics*)realloc(this->controller_statistics, controller_statistics_lengthT * sizeof(pr2_mechanism_msgs::ControllerStatistics)); |
akashvibhute | 0:30537dec6e0b | 91 | offset += 3; |
akashvibhute | 0:30537dec6e0b | 92 | controller_statistics_length = controller_statistics_lengthT; |
akashvibhute | 0:30537dec6e0b | 93 | for( uint8_t i = 0; i < controller_statistics_length; i++){ |
akashvibhute | 0:30537dec6e0b | 94 | offset += this->st_controller_statistics.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 95 | memcpy( &(this->controller_statistics[i]), &(this->st_controller_statistics), sizeof(pr2_mechanism_msgs::ControllerStatistics)); |
akashvibhute | 0:30537dec6e0b | 96 | } |
akashvibhute | 0:30537dec6e0b | 97 | return offset; |
akashvibhute | 0:30537dec6e0b | 98 | } |
akashvibhute | 0:30537dec6e0b | 99 | |
akashvibhute | 0:30537dec6e0b | 100 | const char * getType(){ return "pr2_mechanism_msgs/MechanismStatistics"; }; |
akashvibhute | 0:30537dec6e0b | 101 | const char * getMD5(){ return "b4a99069393681672c01f8c823458e04"; }; |
akashvibhute | 0:30537dec6e0b | 102 | |
akashvibhute | 0:30537dec6e0b | 103 | }; |
akashvibhute | 0:30537dec6e0b | 104 | |
akashvibhute | 0:30537dec6e0b | 105 | } |
akashvibhute | 0:30537dec6e0b | 106 | #endif |