ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.
Revision 2:65cba0dcf634, committed 2022-01-27
- Comitter:
- gosari
- Date:
- Thu Jan 27 11:36:16 2022 +0000
- Parent:
- 1:a849bf78d77f
- Commit message:
- for message communication with mbed
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hero_msgs/hero_flipper_command.h Thu Jan 27 11:36:16 2022 +0000 @@ -0,0 +1,213 @@ +#ifndef _ROS_hero_msgs_hero_flipper_command_h +#define _ROS_hero_msgs_hero_flipper_command_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" + +namespace hero_msgs +{ + + class hero_flipper_command : public ros::Msg + { + public: + typedef uint8_t _RobotMode_type; + _RobotMode_type RobotMode; + typedef int16_t _SweepA_type; + _SweepA_type SweepA; + typedef int16_t _SweepB_type; + _SweepB_type SweepB; + typedef int16_t _WalkDelay_type; + _WalkDelay_type WalkDelay; + typedef int16_t _WalkWait_type; + _WalkWait_type WalkWait; + typedef uint8_t _StepCount_type; + _StepCount_type StepCount; + typedef int16_t _WalkHeading_type; + _WalkHeading_type WalkHeading; + typedef uint8_t _Amplitude_type; + _Amplitude_type Amplitude; + typedef float _Period_type; + _Period_type Period; + typedef uint8_t _iteration_type; + _iteration_type iteration; + typedef uint8_t _OffsetAngle_type; + _OffsetAngle_type OffsetAngle; + typedef uint8_t _LegSwingPart_type; + _LegSwingPart_type LegSwingPart; + typedef uint16_t _LegSwingDelay_type; + _LegSwingDelay_type LegSwingDelay; + + hero_flipper_command(): + RobotMode(0), + SweepA(0), + SweepB(0), + WalkDelay(0), + WalkWait(0), + StepCount(0), + WalkHeading(0), + Amplitude(0), + Period(0), + iteration(0), + OffsetAngle(0), + LegSwingPart(0), + LegSwingDelay(0) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + *(outbuffer + offset + 0) = (this->RobotMode >> (8 * 0)) & 0xFF; + offset += sizeof(this->RobotMode); + union { + int16_t real; + uint16_t base; + } u_SweepA; + u_SweepA.real = this->SweepA; + *(outbuffer + offset + 0) = (u_SweepA.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_SweepA.base >> (8 * 1)) & 0xFF; + offset += sizeof(this->SweepA); + union { + int16_t real; + uint16_t base; + } u_SweepB; + u_SweepB.real = this->SweepB; + *(outbuffer + offset + 0) = (u_SweepB.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_SweepB.base >> (8 * 1)) & 0xFF; + offset += sizeof(this->SweepB); + union { + int16_t real; + uint16_t base; + } u_WalkDelay; + u_WalkDelay.real = this->WalkDelay; + *(outbuffer + offset + 0) = (u_WalkDelay.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_WalkDelay.base >> (8 * 1)) & 0xFF; + offset += sizeof(this->WalkDelay); + union { + int16_t real; + uint16_t base; + } u_WalkWait; + u_WalkWait.real = this->WalkWait; + *(outbuffer + offset + 0) = (u_WalkWait.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_WalkWait.base >> (8 * 1)) & 0xFF; + offset += sizeof(this->WalkWait); + *(outbuffer + offset + 0) = (this->StepCount >> (8 * 0)) & 0xFF; + offset += sizeof(this->StepCount); + union { + int16_t real; + uint16_t base; + } u_WalkHeading; + u_WalkHeading.real = this->WalkHeading; + *(outbuffer + offset + 0) = (u_WalkHeading.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_WalkHeading.base >> (8 * 1)) & 0xFF; + offset += sizeof(this->WalkHeading); + *(outbuffer + offset + 0) = (this->Amplitude >> (8 * 0)) & 0xFF; + offset += sizeof(this->Amplitude); + union { + float real; + uint32_t base; + } u_Period; + u_Period.real = this->Period; + *(outbuffer + offset + 0) = (u_Period.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_Period.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_Period.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_Period.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->Period); + *(outbuffer + offset + 0) = (this->iteration >> (8 * 0)) & 0xFF; + offset += sizeof(this->iteration); + *(outbuffer + offset + 0) = (this->OffsetAngle >> (8 * 0)) & 0xFF; + offset += sizeof(this->OffsetAngle); + *(outbuffer + offset + 0) = (this->LegSwingPart >> (8 * 0)) & 0xFF; + offset += sizeof(this->LegSwingPart); + *(outbuffer + offset + 0) = (this->LegSwingDelay >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (this->LegSwingDelay >> (8 * 1)) & 0xFF; + offset += sizeof(this->LegSwingDelay); + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + this->RobotMode = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->RobotMode); + union { + int16_t real; + uint16_t base; + } u_SweepA; + u_SweepA.base = 0; + u_SweepA.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_SweepA.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->SweepA = u_SweepA.real; + offset += sizeof(this->SweepA); + union { + int16_t real; + uint16_t base; + } u_SweepB; + u_SweepB.base = 0; + u_SweepB.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_SweepB.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->SweepB = u_SweepB.real; + offset += sizeof(this->SweepB); + union { + int16_t real; + uint16_t base; + } u_WalkDelay; + u_WalkDelay.base = 0; + u_WalkDelay.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_WalkDelay.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->WalkDelay = u_WalkDelay.real; + offset += sizeof(this->WalkDelay); + union { + int16_t real; + uint16_t base; + } u_WalkWait; + u_WalkWait.base = 0; + u_WalkWait.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_WalkWait.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->WalkWait = u_WalkWait.real; + offset += sizeof(this->WalkWait); + this->StepCount = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->StepCount); + union { + int16_t real; + uint16_t base; + } u_WalkHeading; + u_WalkHeading.base = 0; + u_WalkHeading.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_WalkHeading.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); + this->WalkHeading = u_WalkHeading.real; + offset += sizeof(this->WalkHeading); + this->Amplitude = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->Amplitude); + union { + float real; + uint32_t base; + } u_Period; + u_Period.base = 0; + u_Period.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_Period.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_Period.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_Period.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->Period = u_Period.real; + offset += sizeof(this->Period); + this->iteration = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->iteration); + this->OffsetAngle = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->OffsetAngle); + this->LegSwingPart = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->LegSwingPart); + this->LegSwingDelay = ((uint16_t) (*(inbuffer + offset))); + this->LegSwingDelay |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); + offset += sizeof(this->LegSwingDelay); + return offset; + } + + const char * getType(){ return "hero_msgs/hero_flipper_command"; }; + const char * getMD5(){ return "5fbfca8fff5085fed6726f12aa490760"; }; + + }; + +} +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hero_msgs/hero_flipper_state.h Thu Jan 27 11:36:16 2022 +0000 @@ -0,0 +1,254 @@ +#ifndef _ROS_hero_msgs_hero_flipper_state_h +#define _ROS_hero_msgs_hero_flipper_state_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" + +namespace hero_msgs +{ + + class hero_flipper_state : public ros::Msg + { + public: + typedef float _Depth_type; + _Depth_type Depth; + typedef float _Roll_type; + _Roll_type Roll; + typedef float _Pitch_type; + _Pitch_type Pitch; + typedef float _Yaw_type; + _Yaw_type Yaw; + typedef float _velBtmX_type; + _velBtmX_type velBtmX; + typedef float _velBtmY_type; + _velBtmY_type velBtmY; + typedef float _velBtmZ_type; + _velBtmZ_type velBtmZ; + typedef float _Altitude_type; + _Altitude_type Altitude; + typedef float _Checksum_type; + _Checksum_type Checksum; + + hero_flipper_state(): + Depth(0), + Roll(0), + Pitch(0), + Yaw(0), + velBtmX(0), + velBtmY(0), + velBtmZ(0), + Altitude(0), + Checksum(0) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + union { + float real; + uint32_t base; + } u_Depth; + u_Depth.real = this->Depth; + *(outbuffer + offset + 0) = (u_Depth.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_Depth.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_Depth.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_Depth.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->Depth); + union { + float real; + uint32_t base; + } u_Roll; + u_Roll.real = this->Roll; + *(outbuffer + offset + 0) = (u_Roll.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_Roll.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_Roll.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_Roll.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->Roll); + union { + float real; + uint32_t base; + } u_Pitch; + u_Pitch.real = this->Pitch; + *(outbuffer + offset + 0) = (u_Pitch.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_Pitch.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_Pitch.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_Pitch.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->Pitch); + union { + float real; + uint32_t base; + } u_Yaw; + u_Yaw.real = this->Yaw; + *(outbuffer + offset + 0) = (u_Yaw.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_Yaw.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_Yaw.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_Yaw.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->Yaw); + union { + float real; + uint32_t base; + } u_velBtmX; + u_velBtmX.real = this->velBtmX; + *(outbuffer + offset + 0) = (u_velBtmX.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_velBtmX.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_velBtmX.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_velBtmX.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->velBtmX); + union { + float real; + uint32_t base; + } u_velBtmY; + u_velBtmY.real = this->velBtmY; + *(outbuffer + offset + 0) = (u_velBtmY.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_velBtmY.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_velBtmY.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_velBtmY.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->velBtmY); + union { + float real; + uint32_t base; + } u_velBtmZ; + u_velBtmZ.real = this->velBtmZ; + *(outbuffer + offset + 0) = (u_velBtmZ.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_velBtmZ.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_velBtmZ.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_velBtmZ.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->velBtmZ); + union { + float real; + uint32_t base; + } u_Altitude; + u_Altitude.real = this->Altitude; + *(outbuffer + offset + 0) = (u_Altitude.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_Altitude.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_Altitude.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_Altitude.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->Altitude); + union { + float real; + uint32_t base; + } u_Checksum; + u_Checksum.real = this->Checksum; + *(outbuffer + offset + 0) = (u_Checksum.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_Checksum.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_Checksum.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_Checksum.base >> (8 * 3)) & 0xFF; + offset += sizeof(this->Checksum); + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + union { + float real; + uint32_t base; + } u_Depth; + u_Depth.base = 0; + u_Depth.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_Depth.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_Depth.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_Depth.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->Depth = u_Depth.real; + offset += sizeof(this->Depth); + union { + float real; + uint32_t base; + } u_Roll; + u_Roll.base = 0; + u_Roll.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_Roll.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_Roll.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_Roll.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->Roll = u_Roll.real; + offset += sizeof(this->Roll); + union { + float real; + uint32_t base; + } u_Pitch; + u_Pitch.base = 0; + u_Pitch.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_Pitch.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_Pitch.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_Pitch.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->Pitch = u_Pitch.real; + offset += sizeof(this->Pitch); + union { + float real; + uint32_t base; + } u_Yaw; + u_Yaw.base = 0; + u_Yaw.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_Yaw.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_Yaw.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_Yaw.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->Yaw = u_Yaw.real; + offset += sizeof(this->Yaw); + union { + float real; + uint32_t base; + } u_velBtmX; + u_velBtmX.base = 0; + u_velBtmX.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_velBtmX.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_velBtmX.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_velBtmX.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->velBtmX = u_velBtmX.real; + offset += sizeof(this->velBtmX); + union { + float real; + uint32_t base; + } u_velBtmY; + u_velBtmY.base = 0; + u_velBtmY.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_velBtmY.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_velBtmY.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_velBtmY.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->velBtmY = u_velBtmY.real; + offset += sizeof(this->velBtmY); + union { + float real; + uint32_t base; + } u_velBtmZ; + u_velBtmZ.base = 0; + u_velBtmZ.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_velBtmZ.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_velBtmZ.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_velBtmZ.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->velBtmZ = u_velBtmZ.real; + offset += sizeof(this->velBtmZ); + union { + float real; + uint32_t base; + } u_Altitude; + u_Altitude.base = 0; + u_Altitude.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_Altitude.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_Altitude.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_Altitude.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->Altitude = u_Altitude.real; + offset += sizeof(this->Altitude); + union { + float real; + uint32_t base; + } u_Checksum; + u_Checksum.base = 0; + u_Checksum.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_Checksum.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_Checksum.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_Checksum.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); + this->Checksum = u_Checksum.real; + offset += sizeof(this->Checksum); + return offset; + } + + const char * getType(){ return "hero_msgs/hero_flipper_state"; }; + const char * getMD5(){ return "3966e56c0419a7687728b66479964a92"; }; + + }; + +} +#endif \ No newline at end of file
--- a/ros/node_handle.h Sat Dec 31 00:59:58 2016 +0000 +++ b/ros/node_handle.h Thu Jan 27 11:36:16 2022 +0000 @@ -91,10 +91,10 @@ /* Node Handle */ template<class Hardware, - int MAX_SUBSCRIBERS=25, - int MAX_PUBLISHERS=25, - int INPUT_SIZE=512, - int OUTPUT_SIZE=512> + int MAX_SUBSCRIBERS=6, // default: 25, 12 (~22.01.12) + int MAX_PUBLISHERS=6, // default: 25, 12 (~22.01.12) + int INPUT_SIZE=256, // default: 512, 256 (~22.01.12), 128 (~22.01.26) + int OUTPUT_SIZE=256> // default: 512, 256 (~22.01.12), 128 (~22.01.26) class NodeHandle_ : public NodeHandleBase_ { protected: