Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ros_lib/actionlib_tutorials/AveragingResult.h@0:8f3710bfd298, 2020-09-02 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Sep 02 13:51:31 2020 +0000
- Revision:
- 0:8f3710bfd298
Resolved round not found
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irfantitok | 0:8f3710bfd298 | 1 | #ifndef _ROS_actionlib_tutorials_AveragingResult_h |
irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_actionlib_tutorials_AveragingResult_h |
irfantitok | 0:8f3710bfd298 | 3 | |
irfantitok | 0:8f3710bfd298 | 4 | #include <stdint.h> |
irfantitok | 0:8f3710bfd298 | 5 | #include <string.h> |
irfantitok | 0:8f3710bfd298 | 6 | #include <stdlib.h> |
irfantitok | 0:8f3710bfd298 | 7 | #include "ros/msg.h" |
irfantitok | 0:8f3710bfd298 | 8 | |
irfantitok | 0:8f3710bfd298 | 9 | namespace actionlib_tutorials |
irfantitok | 0:8f3710bfd298 | 10 | { |
irfantitok | 0:8f3710bfd298 | 11 | |
irfantitok | 0:8f3710bfd298 | 12 | class AveragingResult : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 13 | { |
irfantitok | 0:8f3710bfd298 | 14 | public: |
irfantitok | 0:8f3710bfd298 | 15 | typedef float _mean_type; |
irfantitok | 0:8f3710bfd298 | 16 | _mean_type mean; |
irfantitok | 0:8f3710bfd298 | 17 | typedef float _std_dev_type; |
irfantitok | 0:8f3710bfd298 | 18 | _std_dev_type std_dev; |
irfantitok | 0:8f3710bfd298 | 19 | |
irfantitok | 0:8f3710bfd298 | 20 | AveragingResult(): |
irfantitok | 0:8f3710bfd298 | 21 | mean(0), |
irfantitok | 0:8f3710bfd298 | 22 | std_dev(0) |
irfantitok | 0:8f3710bfd298 | 23 | { |
irfantitok | 0:8f3710bfd298 | 24 | } |
irfantitok | 0:8f3710bfd298 | 25 | |
irfantitok | 0:8f3710bfd298 | 26 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 27 | { |
irfantitok | 0:8f3710bfd298 | 28 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 29 | union { |
irfantitok | 0:8f3710bfd298 | 30 | float real; |
irfantitok | 0:8f3710bfd298 | 31 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 32 | } u_mean; |
irfantitok | 0:8f3710bfd298 | 33 | u_mean.real = this->mean; |
irfantitok | 0:8f3710bfd298 | 34 | *(outbuffer + offset + 0) = (u_mean.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 35 | *(outbuffer + offset + 1) = (u_mean.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 36 | *(outbuffer + offset + 2) = (u_mean.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 37 | *(outbuffer + offset + 3) = (u_mean.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 38 | offset += sizeof(this->mean); |
irfantitok | 0:8f3710bfd298 | 39 | union { |
irfantitok | 0:8f3710bfd298 | 40 | float real; |
irfantitok | 0:8f3710bfd298 | 41 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 42 | } u_std_dev; |
irfantitok | 0:8f3710bfd298 | 43 | u_std_dev.real = this->std_dev; |
irfantitok | 0:8f3710bfd298 | 44 | *(outbuffer + offset + 0) = (u_std_dev.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 45 | *(outbuffer + offset + 1) = (u_std_dev.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 46 | *(outbuffer + offset + 2) = (u_std_dev.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 47 | *(outbuffer + offset + 3) = (u_std_dev.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 48 | offset += sizeof(this->std_dev); |
irfantitok | 0:8f3710bfd298 | 49 | return offset; |
irfantitok | 0:8f3710bfd298 | 50 | } |
irfantitok | 0:8f3710bfd298 | 51 | |
irfantitok | 0:8f3710bfd298 | 52 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 53 | { |
irfantitok | 0:8f3710bfd298 | 54 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 55 | union { |
irfantitok | 0:8f3710bfd298 | 56 | float real; |
irfantitok | 0:8f3710bfd298 | 57 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 58 | } u_mean; |
irfantitok | 0:8f3710bfd298 | 59 | u_mean.base = 0; |
irfantitok | 0:8f3710bfd298 | 60 | u_mean.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 61 | u_mean.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 62 | u_mean.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 63 | u_mean.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 64 | this->mean = u_mean.real; |
irfantitok | 0:8f3710bfd298 | 65 | offset += sizeof(this->mean); |
irfantitok | 0:8f3710bfd298 | 66 | union { |
irfantitok | 0:8f3710bfd298 | 67 | float real; |
irfantitok | 0:8f3710bfd298 | 68 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 69 | } u_std_dev; |
irfantitok | 0:8f3710bfd298 | 70 | u_std_dev.base = 0; |
irfantitok | 0:8f3710bfd298 | 71 | u_std_dev.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 72 | u_std_dev.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 73 | u_std_dev.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 74 | u_std_dev.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 75 | this->std_dev = u_std_dev.real; |
irfantitok | 0:8f3710bfd298 | 76 | offset += sizeof(this->std_dev); |
irfantitok | 0:8f3710bfd298 | 77 | return offset; |
irfantitok | 0:8f3710bfd298 | 78 | } |
irfantitok | 0:8f3710bfd298 | 79 | |
irfantitok | 0:8f3710bfd298 | 80 | const char * getType(){ return "actionlib_tutorials/AveragingResult"; }; |
irfantitok | 0:8f3710bfd298 | 81 | const char * getMD5(){ return "d5c7decf6df75ffb4367a05c1bcc7612"; }; |
irfantitok | 0:8f3710bfd298 | 82 | |
irfantitok | 0:8f3710bfd298 | 83 | }; |
irfantitok | 0:8f3710bfd298 | 84 | |
irfantitok | 0:8f3710bfd298 | 85 | } |
irfantitok | 0:8f3710bfd298 | 86 | #endif |