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.
Dependencies: mbed pca9685 ros_lib_kinetic ads1015
s_rov_control_esc.h
00001 #ifndef _ROS_s_rov_msgs_s_rov_control_esc_h 00002 #define _ROS_s_rov_msgs_s_rov_control_esc_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace s_rov_msgs 00010 { 00011 00012 class s_rov_control_esc : public ros::Msg 00013 { 00014 public: 00015 float escPWM[4]; 00016 bool escSwitch; 00017 00018 s_rov_control_esc(): 00019 escPWM(), 00020 escSwitch(0) 00021 { 00022 } 00023 00024 virtual int serialize(unsigned char *outbuffer) const 00025 { 00026 int offset = 0; 00027 for( uint32_t i = 0; i < 4; i++){ 00028 union { 00029 float real; 00030 uint32_t base; 00031 } u_escPWMi; 00032 u_escPWMi.real = this->escPWM[i]; 00033 *(outbuffer + offset + 0) = (u_escPWMi.base >> (8 * 0)) & 0xFF; 00034 *(outbuffer + offset + 1) = (u_escPWMi.base >> (8 * 1)) & 0xFF; 00035 *(outbuffer + offset + 2) = (u_escPWMi.base >> (8 * 2)) & 0xFF; 00036 *(outbuffer + offset + 3) = (u_escPWMi.base >> (8 * 3)) & 0xFF; 00037 offset += sizeof(this->escPWM[i]); 00038 } 00039 union { 00040 bool real; 00041 uint8_t base; 00042 } u_escSwitch; 00043 u_escSwitch.real = this->escSwitch; 00044 *(outbuffer + offset + 0) = (u_escSwitch.base >> (8 * 0)) & 0xFF; 00045 offset += sizeof(this->escSwitch); 00046 return offset; 00047 } 00048 00049 virtual int deserialize(unsigned char *inbuffer) 00050 { 00051 int offset = 0; 00052 for( uint32_t i = 0; i < 4; i++){ 00053 union { 00054 float real; 00055 uint32_t base; 00056 } u_escPWMi; 00057 u_escPWMi.base = 0; 00058 u_escPWMi.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00059 u_escPWMi.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00060 u_escPWMi.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00061 u_escPWMi.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00062 this->escPWM[i] = u_escPWMi.real; 00063 offset += sizeof(this->escPWM[i]); 00064 } 00065 union { 00066 bool real; 00067 uint8_t base; 00068 } u_escSwitch; 00069 u_escSwitch.base = 0; 00070 u_escSwitch.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00071 this->escSwitch = u_escSwitch.real; 00072 offset += sizeof(this->escSwitch); 00073 return offset; 00074 } 00075 00076 const char * getType(){ return "s_rov_msgs/s_rov_control_esc"; }; 00077 const char * getMD5(){ return "29b94efb4e96b7ab876134acfa0a6e69"; }; 00078 00079 }; 00080 00081 } 00082 #endif
Generated on Tue Jul 12 2022 20:17:24 by
