capstone_finish
Dependencies: BufferedSerial motor_sn7544
sensor_msgs/SetCameraInfo.h@10:ca4e4062701a, 2019-11-26 (annotated)
- Committer:
- Jeonghoon
- Date:
- Tue Nov 26 15:30:27 2019 +0000
- Revision:
- 10:ca4e4062701a
- Parent:
- 3:2a3664dc6634
capstone finish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeonghoon | 3:2a3664dc6634 | 1 | #ifndef _ROS_SERVICE_SetCameraInfo_h |
Jeonghoon | 3:2a3664dc6634 | 2 | #define _ROS_SERVICE_SetCameraInfo_h |
Jeonghoon | 3:2a3664dc6634 | 3 | #include <stdint.h> |
Jeonghoon | 3:2a3664dc6634 | 4 | #include <string.h> |
Jeonghoon | 3:2a3664dc6634 | 5 | #include <stdlib.h> |
Jeonghoon | 3:2a3664dc6634 | 6 | #include "ros/msg.h" |
Jeonghoon | 3:2a3664dc6634 | 7 | #include "sensor_msgs/CameraInfo.h" |
Jeonghoon | 3:2a3664dc6634 | 8 | |
Jeonghoon | 3:2a3664dc6634 | 9 | namespace sensor_msgs |
Jeonghoon | 3:2a3664dc6634 | 10 | { |
Jeonghoon | 3:2a3664dc6634 | 11 | |
Jeonghoon | 3:2a3664dc6634 | 12 | static const char SETCAMERAINFO[] = "sensor_msgs/SetCameraInfo"; |
Jeonghoon | 3:2a3664dc6634 | 13 | |
Jeonghoon | 3:2a3664dc6634 | 14 | class SetCameraInfoRequest : public ros::Msg |
Jeonghoon | 3:2a3664dc6634 | 15 | { |
Jeonghoon | 3:2a3664dc6634 | 16 | public: |
Jeonghoon | 3:2a3664dc6634 | 17 | typedef sensor_msgs::CameraInfo _camera_info_type; |
Jeonghoon | 3:2a3664dc6634 | 18 | _camera_info_type camera_info; |
Jeonghoon | 3:2a3664dc6634 | 19 | |
Jeonghoon | 3:2a3664dc6634 | 20 | SetCameraInfoRequest(): |
Jeonghoon | 3:2a3664dc6634 | 21 | camera_info() |
Jeonghoon | 3:2a3664dc6634 | 22 | { |
Jeonghoon | 3:2a3664dc6634 | 23 | } |
Jeonghoon | 3:2a3664dc6634 | 24 | |
Jeonghoon | 3:2a3664dc6634 | 25 | virtual int serialize(unsigned char *outbuffer) const |
Jeonghoon | 3:2a3664dc6634 | 26 | { |
Jeonghoon | 3:2a3664dc6634 | 27 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 28 | offset += this->camera_info.serialize(outbuffer + offset); |
Jeonghoon | 3:2a3664dc6634 | 29 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 30 | } |
Jeonghoon | 3:2a3664dc6634 | 31 | |
Jeonghoon | 3:2a3664dc6634 | 32 | virtual int deserialize(unsigned char *inbuffer) |
Jeonghoon | 3:2a3664dc6634 | 33 | { |
Jeonghoon | 3:2a3664dc6634 | 34 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 35 | offset += this->camera_info.deserialize(inbuffer + offset); |
Jeonghoon | 3:2a3664dc6634 | 36 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 37 | } |
Jeonghoon | 3:2a3664dc6634 | 38 | |
Jeonghoon | 3:2a3664dc6634 | 39 | const char * getType(){ return SETCAMERAINFO; }; |
Jeonghoon | 3:2a3664dc6634 | 40 | const char * getMD5(){ return "ee34be01fdeee563d0d99cd594d5581d"; }; |
Jeonghoon | 3:2a3664dc6634 | 41 | |
Jeonghoon | 3:2a3664dc6634 | 42 | }; |
Jeonghoon | 3:2a3664dc6634 | 43 | |
Jeonghoon | 3:2a3664dc6634 | 44 | class SetCameraInfoResponse : public ros::Msg |
Jeonghoon | 3:2a3664dc6634 | 45 | { |
Jeonghoon | 3:2a3664dc6634 | 46 | public: |
Jeonghoon | 3:2a3664dc6634 | 47 | typedef bool _success_type; |
Jeonghoon | 3:2a3664dc6634 | 48 | _success_type success; |
Jeonghoon | 3:2a3664dc6634 | 49 | typedef const char* _status_message_type; |
Jeonghoon | 3:2a3664dc6634 | 50 | _status_message_type status_message; |
Jeonghoon | 3:2a3664dc6634 | 51 | |
Jeonghoon | 3:2a3664dc6634 | 52 | SetCameraInfoResponse(): |
Jeonghoon | 3:2a3664dc6634 | 53 | success(0), |
Jeonghoon | 3:2a3664dc6634 | 54 | status_message("") |
Jeonghoon | 3:2a3664dc6634 | 55 | { |
Jeonghoon | 3:2a3664dc6634 | 56 | } |
Jeonghoon | 3:2a3664dc6634 | 57 | |
Jeonghoon | 3:2a3664dc6634 | 58 | virtual int serialize(unsigned char *outbuffer) const |
Jeonghoon | 3:2a3664dc6634 | 59 | { |
Jeonghoon | 3:2a3664dc6634 | 60 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 61 | union { |
Jeonghoon | 3:2a3664dc6634 | 62 | bool real; |
Jeonghoon | 3:2a3664dc6634 | 63 | uint8_t base; |
Jeonghoon | 3:2a3664dc6634 | 64 | } u_success; |
Jeonghoon | 3:2a3664dc6634 | 65 | u_success.real = this->success; |
Jeonghoon | 3:2a3664dc6634 | 66 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 67 | offset += sizeof(this->success); |
Jeonghoon | 3:2a3664dc6634 | 68 | uint32_t length_status_message = strlen(this->status_message); |
Jeonghoon | 3:2a3664dc6634 | 69 | varToArr(outbuffer + offset, length_status_message); |
Jeonghoon | 3:2a3664dc6634 | 70 | offset += 4; |
Jeonghoon | 3:2a3664dc6634 | 71 | memcpy(outbuffer + offset, this->status_message, length_status_message); |
Jeonghoon | 3:2a3664dc6634 | 72 | offset += length_status_message; |
Jeonghoon | 3:2a3664dc6634 | 73 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 74 | } |
Jeonghoon | 3:2a3664dc6634 | 75 | |
Jeonghoon | 3:2a3664dc6634 | 76 | virtual int deserialize(unsigned char *inbuffer) |
Jeonghoon | 3:2a3664dc6634 | 77 | { |
Jeonghoon | 3:2a3664dc6634 | 78 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 79 | union { |
Jeonghoon | 3:2a3664dc6634 | 80 | bool real; |
Jeonghoon | 3:2a3664dc6634 | 81 | uint8_t base; |
Jeonghoon | 3:2a3664dc6634 | 82 | } u_success; |
Jeonghoon | 3:2a3664dc6634 | 83 | u_success.base = 0; |
Jeonghoon | 3:2a3664dc6634 | 84 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Jeonghoon | 3:2a3664dc6634 | 85 | this->success = u_success.real; |
Jeonghoon | 3:2a3664dc6634 | 86 | offset += sizeof(this->success); |
Jeonghoon | 3:2a3664dc6634 | 87 | uint32_t length_status_message; |
Jeonghoon | 3:2a3664dc6634 | 88 | arrToVar(length_status_message, (inbuffer + offset)); |
Jeonghoon | 3:2a3664dc6634 | 89 | offset += 4; |
Jeonghoon | 3:2a3664dc6634 | 90 | for(unsigned int k= offset; k< offset+length_status_message; ++k){ |
Jeonghoon | 3:2a3664dc6634 | 91 | inbuffer[k-1]=inbuffer[k]; |
Jeonghoon | 3:2a3664dc6634 | 92 | } |
Jeonghoon | 3:2a3664dc6634 | 93 | inbuffer[offset+length_status_message-1]=0; |
Jeonghoon | 3:2a3664dc6634 | 94 | this->status_message = (char *)(inbuffer + offset-1); |
Jeonghoon | 3:2a3664dc6634 | 95 | offset += length_status_message; |
Jeonghoon | 3:2a3664dc6634 | 96 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 97 | } |
Jeonghoon | 3:2a3664dc6634 | 98 | |
Jeonghoon | 3:2a3664dc6634 | 99 | const char * getType(){ return SETCAMERAINFO; }; |
Jeonghoon | 3:2a3664dc6634 | 100 | const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; }; |
Jeonghoon | 3:2a3664dc6634 | 101 | |
Jeonghoon | 3:2a3664dc6634 | 102 | }; |
Jeonghoon | 3:2a3664dc6634 | 103 | |
Jeonghoon | 3:2a3664dc6634 | 104 | class SetCameraInfo { |
Jeonghoon | 3:2a3664dc6634 | 105 | public: |
Jeonghoon | 3:2a3664dc6634 | 106 | typedef SetCameraInfoRequest Request; |
Jeonghoon | 3:2a3664dc6634 | 107 | typedef SetCameraInfoResponse Response; |
Jeonghoon | 3:2a3664dc6634 | 108 | }; |
Jeonghoon | 3:2a3664dc6634 | 109 | |
Jeonghoon | 3:2a3664dc6634 | 110 | } |
Jeonghoon | 3:2a3664dc6634 | 111 | #endif |