This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.

Dependencies:  

Dependents:   rosserial_mbed robot_S2

Committer:
nucho
Date:
Wed Feb 29 23:00:21 2012 +0000
Revision:
4:684f39d0c346
Parent:
3:1cf99502f396

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 3:1cf99502f396 1 #ifndef _ROS_tf_tfMessage_h
nucho 3:1cf99502f396 2 #define _ROS_tf_tfMessage_h
nucho 0:77afd7560544 3
nucho 0:77afd7560544 4 #include <stdint.h>
nucho 0:77afd7560544 5 #include <string.h>
nucho 0:77afd7560544 6 #include <stdlib.h>
nucho 3:1cf99502f396 7 #include "ros/msg.h"
nucho 0:77afd7560544 8 #include "geometry_msgs/TransformStamped.h"
nucho 0:77afd7560544 9
nucho 0:77afd7560544 10 namespace tf
nucho 0:77afd7560544 11 {
nucho 0:77afd7560544 12
nucho 0:77afd7560544 13 class tfMessage : public ros::Msg
nucho 0:77afd7560544 14 {
nucho 0:77afd7560544 15 public:
nucho 3:1cf99502f396 16 uint8_t transforms_length;
nucho 0:77afd7560544 17 geometry_msgs::TransformStamped st_transforms;
nucho 0:77afd7560544 18 geometry_msgs::TransformStamped * transforms;
nucho 0:77afd7560544 19
nucho 3:1cf99502f396 20 virtual int serialize(unsigned char *outbuffer) const
nucho 0:77afd7560544 21 {
nucho 0:77afd7560544 22 int offset = 0;
nucho 0:77afd7560544 23 *(outbuffer + offset++) = transforms_length;
nucho 0:77afd7560544 24 *(outbuffer + offset++) = 0;
nucho 0:77afd7560544 25 *(outbuffer + offset++) = 0;
nucho 0:77afd7560544 26 *(outbuffer + offset++) = 0;
nucho 3:1cf99502f396 27 for( uint8_t i = 0; i < transforms_length; i++){
nucho 0:77afd7560544 28 offset += this->transforms[i].serialize(outbuffer + offset);
nucho 0:77afd7560544 29 }
nucho 0:77afd7560544 30 return offset;
nucho 0:77afd7560544 31 }
nucho 0:77afd7560544 32
nucho 0:77afd7560544 33 virtual int deserialize(unsigned char *inbuffer)
nucho 0:77afd7560544 34 {
nucho 0:77afd7560544 35 int offset = 0;
nucho 3:1cf99502f396 36 uint8_t transforms_lengthT = *(inbuffer + offset++);
nucho 0:77afd7560544 37 if(transforms_lengthT > transforms_length)
nucho 0:77afd7560544 38 this->transforms = (geometry_msgs::TransformStamped*)realloc(this->transforms, transforms_lengthT * sizeof(geometry_msgs::TransformStamped));
nucho 0:77afd7560544 39 offset += 3;
nucho 0:77afd7560544 40 transforms_length = transforms_lengthT;
nucho 3:1cf99502f396 41 for( uint8_t i = 0; i < transforms_length; i++){
nucho 0:77afd7560544 42 offset += this->st_transforms.deserialize(inbuffer + offset);
nucho 0:77afd7560544 43 memcpy( &(this->transforms[i]), &(this->st_transforms), sizeof(geometry_msgs::TransformStamped));
nucho 0:77afd7560544 44 }
nucho 0:77afd7560544 45 return offset;
nucho 0:77afd7560544 46 }
nucho 0:77afd7560544 47
nucho 0:77afd7560544 48 virtual const char * getType(){ return "tf/tfMessage"; };
nucho 3:1cf99502f396 49 virtual const char * getMD5(){ return "94810edda583a504dfda3829e70d7eec"; };
nucho 0:77afd7560544 50
nucho 0:77afd7560544 51 };
nucho 0:77afd7560544 52
nucho 0:77afd7560544 53 }
nucho 0:77afd7560544 54 #endif