Skip to content

Commit

Permalink
updat
Browse files Browse the repository at this point in the history
  • Loading branch information
sktometometo committed Oct 8, 2024
1 parent a50263f commit dc8aba3
Show file tree
Hide file tree
Showing 29 changed files with 3,467 additions and 1 deletion.
394 changes: 394 additions & 0 deletions ros_lib/ros_lib/sensor_msgs/BatteryState.h

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions ros_lib/ros_lib/sensor_msgs/CameraInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#ifndef _ROS_sensor_msgs_CameraInfo_h
#define _ROS_sensor_msgs_CameraInfo_h

#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "std_msgs/Header.h"
#include "sensor_msgs/RegionOfInterest.h"

namespace sensor_msgs
{

class CameraInfo : public ros::Msg
{
public:
typedef std_msgs::Header _header_type;
_header_type header;
typedef uint32_t _height_type;
_height_type height;
typedef uint32_t _width_type;
_width_type width;
typedef const char* _distortion_model_type;
_distortion_model_type distortion_model;
uint32_t D_length;
typedef float _D_type;
_D_type st_D;
_D_type * D;
float K[9];
float R[9];
float P[12];
typedef uint32_t _binning_x_type;
_binning_x_type binning_x;
typedef uint32_t _binning_y_type;
_binning_y_type binning_y;
typedef sensor_msgs::RegionOfInterest _roi_type;
_roi_type roi;

CameraInfo():
header(),
height(0),
width(0),
distortion_model(""),
D_length(0), st_D(), D(nullptr),
K(),
R(),
P(),
binning_x(0),
binning_y(0),
roi()
{
}

virtual int serialize(unsigned char *outbuffer) const override
{
int offset = 0;
offset += this->header.serialize(outbuffer + offset);
*(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF;
offset += sizeof(this->height);
*(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF;
offset += sizeof(this->width);
uint32_t length_distortion_model = strlen(this->distortion_model);
varToArr(outbuffer + offset, length_distortion_model);
offset += 4;
memcpy(outbuffer + offset, this->distortion_model, length_distortion_model);
offset += length_distortion_model;
*(outbuffer + offset + 0) = (this->D_length >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (this->D_length >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (this->D_length >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (this->D_length >> (8 * 3)) & 0xFF;
offset += sizeof(this->D_length);
for( uint32_t i = 0; i < D_length; i++){
offset += serializeAvrFloat64(outbuffer + offset, this->D[i]);
}
for( uint32_t i = 0; i < 9; i++){
offset += serializeAvrFloat64(outbuffer + offset, this->K[i]);
}
for( uint32_t i = 0; i < 9; i++){
offset += serializeAvrFloat64(outbuffer + offset, this->R[i]);
}
for( uint32_t i = 0; i < 12; i++){
offset += serializeAvrFloat64(outbuffer + offset, this->P[i]);
}
*(outbuffer + offset + 0) = (this->binning_x >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (this->binning_x >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (this->binning_x >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (this->binning_x >> (8 * 3)) & 0xFF;
offset += sizeof(this->binning_x);
*(outbuffer + offset + 0) = (this->binning_y >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (this->binning_y >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (this->binning_y >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (this->binning_y >> (8 * 3)) & 0xFF;
offset += sizeof(this->binning_y);
offset += this->roi.serialize(outbuffer + offset);
return offset;
}

virtual int deserialize(unsigned char *inbuffer) override
{
int offset = 0;
offset += this->header.deserialize(inbuffer + offset);
this->height = ((uint32_t) (*(inbuffer + offset)));
this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
offset += sizeof(this->height);
this->width = ((uint32_t) (*(inbuffer + offset)));
this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
offset += sizeof(this->width);
uint32_t length_distortion_model;
arrToVar(length_distortion_model, (inbuffer + offset));
offset += 4;
for(unsigned int k= offset; k< offset+length_distortion_model; ++k){
inbuffer[k-1]=inbuffer[k];
}
inbuffer[offset+length_distortion_model-1]=0;
this->distortion_model = (char *)(inbuffer + offset-1);
offset += length_distortion_model;
uint32_t D_lengthT = ((uint32_t) (*(inbuffer + offset)));
D_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
D_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
D_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
offset += sizeof(this->D_length);
if(D_lengthT > D_length)
this->D = (float*)realloc(this->D, D_lengthT * sizeof(float));
D_length = D_lengthT;
for( uint32_t i = 0; i < D_length; i++){
offset += deserializeAvrFloat64(inbuffer + offset, &(this->st_D));
memcpy( &(this->D[i]), &(this->st_D), sizeof(float));
}
for( uint32_t i = 0; i < 9; i++){
offset += deserializeAvrFloat64(inbuffer + offset, &(this->K[i]));
}
for( uint32_t i = 0; i < 9; i++){
offset += deserializeAvrFloat64(inbuffer + offset, &(this->R[i]));
}
for( uint32_t i = 0; i < 12; i++){
offset += deserializeAvrFloat64(inbuffer + offset, &(this->P[i]));
}
this->binning_x = ((uint32_t) (*(inbuffer + offset)));
this->binning_x |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
this->binning_x |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
this->binning_x |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
offset += sizeof(this->binning_x);
this->binning_y = ((uint32_t) (*(inbuffer + offset)));
this->binning_y |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
this->binning_y |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
this->binning_y |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
offset += sizeof(this->binning_y);
offset += this->roi.deserialize(inbuffer + offset);
return offset;
}

virtual const char * getType() override { return "sensor_msgs/CameraInfo"; };
virtual const char * getMD5() override { return "c9a58c1b0b154e0e6da7578cb991d214"; };

};

}
#endif
99 changes: 99 additions & 0 deletions ros_lib/ros_lib/sensor_msgs/ChannelFloat32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#ifndef _ROS_sensor_msgs_ChannelFloat32_h
#define _ROS_sensor_msgs_ChannelFloat32_h

#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"

namespace sensor_msgs
{

class ChannelFloat32 : public ros::Msg
{
public:
typedef const char* _name_type;
_name_type name;
uint32_t values_length;
typedef float _values_type;
_values_type st_values;
_values_type * values;

ChannelFloat32():
name(""),
values_length(0), st_values(), values(nullptr)
{
}

virtual int serialize(unsigned char *outbuffer) const override
{
int offset = 0;
uint32_t length_name = strlen(this->name);
varToArr(outbuffer + offset, length_name);
offset += 4;
memcpy(outbuffer + offset, this->name, length_name);
offset += length_name;
*(outbuffer + offset + 0) = (this->values_length >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (this->values_length >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (this->values_length >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (this->values_length >> (8 * 3)) & 0xFF;
offset += sizeof(this->values_length);
for( uint32_t i = 0; i < values_length; i++){
union {
float real;
uint32_t base;
} u_valuesi;
u_valuesi.real = this->values[i];
*(outbuffer + offset + 0) = (u_valuesi.base >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (u_valuesi.base >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (u_valuesi.base >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (u_valuesi.base >> (8 * 3)) & 0xFF;
offset += sizeof(this->values[i]);
}
return offset;
}

virtual int deserialize(unsigned char *inbuffer) override
{
int offset = 0;
uint32_t length_name;
arrToVar(length_name, (inbuffer + offset));
offset += 4;
for(unsigned int k= offset; k< offset+length_name; ++k){
inbuffer[k-1]=inbuffer[k];
}
inbuffer[offset+length_name-1]=0;
this->name = (char *)(inbuffer + offset-1);
offset += length_name;
uint32_t values_lengthT = ((uint32_t) (*(inbuffer + offset)));
values_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
values_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
values_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
offset += sizeof(this->values_length);
if(values_lengthT > values_length)
this->values = (float*)realloc(this->values, values_lengthT * sizeof(float));
values_length = values_lengthT;
for( uint32_t i = 0; i < values_length; i++){
union {
float real;
uint32_t base;
} u_st_values;
u_st_values.base = 0;
u_st_values.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
u_st_values.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
u_st_values.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
u_st_values.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
this->st_values = u_st_values.real;
offset += sizeof(this->st_values);
memcpy( &(this->values[i]), &(this->st_values), sizeof(float));
}
return offset;
}

virtual const char * getType() override { return "sensor_msgs/ChannelFloat32"; };
virtual const char * getMD5() override { return "3d40139cdd33dfedcb71ffeeeb42ae7f"; };

};

}
#endif
88 changes: 88 additions & 0 deletions ros_lib/ros_lib/sensor_msgs/CompressedImage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#ifndef _ROS_sensor_msgs_CompressedImage_h
#define _ROS_sensor_msgs_CompressedImage_h

#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "std_msgs/Header.h"

namespace sensor_msgs
{

class CompressedImage : public ros::Msg
{
public:
typedef std_msgs::Header _header_type;
_header_type header;
typedef const char* _format_type;
_format_type format;
uint32_t data_length;
typedef uint8_t _data_type;
_data_type st_data;
_data_type * data;

CompressedImage():
header(),
format(""),
data_length(0), st_data(), data(nullptr)
{
}

virtual int serialize(unsigned char *outbuffer) const override
{
int offset = 0;
offset += this->header.serialize(outbuffer + offset);
uint32_t length_format = strlen(this->format);
varToArr(outbuffer + offset, length_format);
offset += 4;
memcpy(outbuffer + offset, this->format, length_format);
offset += length_format;
*(outbuffer + offset + 0) = (this->data_length >> (8 * 0)) & 0xFF;
*(outbuffer + offset + 1) = (this->data_length >> (8 * 1)) & 0xFF;
*(outbuffer + offset + 2) = (this->data_length >> (8 * 2)) & 0xFF;
*(outbuffer + offset + 3) = (this->data_length >> (8 * 3)) & 0xFF;
offset += sizeof(this->data_length);
for( uint32_t i = 0; i < data_length; i++){
*(outbuffer + offset + 0) = (this->data[i] >> (8 * 0)) & 0xFF;
offset += sizeof(this->data[i]);
}
return offset;
}

virtual int deserialize(unsigned char *inbuffer) override
{
int offset = 0;
offset += this->header.deserialize(inbuffer + offset);
uint32_t length_format;
arrToVar(length_format, (inbuffer + offset));
offset += 4;
for(unsigned int k= offset; k< offset+length_format; ++k){
inbuffer[k-1]=inbuffer[k];
}
inbuffer[offset+length_format-1]=0;
this->format = (char *)(inbuffer + offset-1);
offset += length_format;
uint32_t data_lengthT = ((uint32_t) (*(inbuffer + offset)));
data_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
data_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
data_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
offset += sizeof(this->data_length);
if(data_lengthT > data_length)
this->data = (uint8_t*)realloc(this->data, data_lengthT * sizeof(uint8_t));
data_length = data_lengthT;
for( uint32_t i = 0; i < data_length; i++){
this->st_data = ((uint8_t) (*(inbuffer + offset)));
offset += sizeof(this->st_data);
memcpy( &(this->data[i]), &(this->st_data), sizeof(uint8_t));
}
return offset;
}

virtual const char * getType() override { return "sensor_msgs/CompressedImage"; };
virtual const char * getMD5() override { return "8f7a12909da2c9d3332d540a0977563f"; };

};

}
#endif
Loading

0 comments on commit dc8aba3

Please sign in to comment.