[57] | 1 | #ifndef _SENSORSAPPLICATIONSTRUCTURES_H_
|
---|
| 2 | #define _SENSORSAPPLICATIONSTRUCTURES_H_
|
---|
| 3 |
|
---|
| 4 | #include "Pacpus/kernel/cstdint.h"
|
---|
| 5 | #include "Pacpus/kernel/road_time.h"
|
---|
| 6 |
|
---|
| 7 | #include "../StdDbtPlayerComponents/ImageBaseStructure.h"
|
---|
| 8 |
|
---|
| 9 | // some constants defined for the Alasca component
|
---|
| 10 | static const uint32_t MAX_SENSOR_POINTS = 500;
|
---|
| 11 | static const uint32_t MAX_GRID_POINTS = 360;
|
---|
| 12 | static const uint32_t MAX_SENSOR_GRID_POINTS = (uint32_t)(500*500);
|
---|
| 13 |
|
---|
| 14 | //----------------- Sensor Occupancy Grid Properties -------------
|
---|
| 15 | typedef struct
|
---|
| 16 | {
|
---|
| 17 | //------------------------- Default parameters --------------------------------------
|
---|
| 18 | std::string sensors_name; // sensor input name
|
---|
| 19 | int type; // sensor reading type: 0 = laser; 1 = stereo camera like laser; 2 = generic sensor
|
---|
| 20 | double x; // sensor pose related to the robot frame
|
---|
| 21 | double y; // sensor pose related to the robot frame
|
---|
| 22 | double theta; // sensor pose related to the robot frame
|
---|
| 23 |
|
---|
| 24 | //------------------------ Specifique parameters ------------------------------------
|
---|
| 25 | int num_readings; // number of readings
|
---|
| 26 | double sigma_zt; // standard deviantion in distance. For the camera = s_div*2.0 (2 meters)
|
---|
| 27 | double sigma_thetat; // standard deviation in angle. For the camera = CV_PI*(camera_FOV/num_readings)/180.0
|
---|
| 28 | double max_range; // maximum range of the sensor
|
---|
| 29 | int mMaxSensorInputSize; // size of the input data of sensor
|
---|
| 30 | bool use_udp; // if the data is from the udp connection
|
---|
| 31 |
|
---|
| 32 | //--------------------------- UDP parameters ----------------------------------------
|
---|
| 33 | std::string host_address; // IP address to receive the data
|
---|
| 34 | unsigned int port; // communication port
|
---|
| 35 | } s_properties; // Sensor properties
|
---|
| 36 |
|
---|
| 37 | //----------------- Camera Obstacle Data -------------------------
|
---|
| 38 | // Camera obstacle data as laser readings
|
---|
| 39 | typedef struct
|
---|
| 40 | {
|
---|
| 41 | int num_readings; // number of readings
|
---|
| 42 | double radius[MAX_SENSOR_POINTS]; // distance measurements
|
---|
| 43 | double angle[MAX_SENSOR_POINTS]; // angle of each measurement
|
---|
| 44 | } camera_occ_data; // Sensor properties
|
---|
| 45 |
|
---|
| 46 | typedef struct
|
---|
| 47 | {
|
---|
| 48 | road_time_t time;
|
---|
| 49 | road_timerange_t timerange;
|
---|
| 50 | camera_occ_data data;
|
---|
| 51 | } TimestampedCameraOccData;
|
---|
| 52 | //----------------------------------------------------------------
|
---|
| 53 |
|
---|
| 54 | //-------------------- Sensor Grid Data --------------------------
|
---|
| 55 | // Generic sensor occupancy grid
|
---|
| 56 | typedef struct
|
---|
| 57 | {
|
---|
| 58 | int rows; // number of rows
|
---|
| 59 | int cols; // number of cols
|
---|
| 60 | float sensor_x0; // sensor x origin in the occ data (x orientated to the right)
|
---|
| 61 | float sensor_y0; // sensor y origin in the occ data
|
---|
| 62 | float sensor_x; // sensor x position in the robot frame
|
---|
| 63 | float sensor_y; // sensor y position in the robot frame
|
---|
| 64 | float sensor_theta; // sensor theta orientation in the robot frame
|
---|
| 65 | float ratio; // sensor grid ratio (m/px)
|
---|
| 66 | float occ_data[MAX_SENSOR_GRID_POINTS]; // sensor occupancy grid data with size rows*cols
|
---|
| 67 | } sensor_occ_data; // Sensor properties
|
---|
| 68 |
|
---|
| 69 | typedef struct
|
---|
| 70 | {
|
---|
| 71 | road_time_t time;
|
---|
| 72 | road_timerange_t timerange;
|
---|
| 73 | sensor_occ_data data;
|
---|
| 74 | } TimestampedSensorOccData;
|
---|
| 75 | //----------------------------------------------------------------
|
---|
| 76 |
|
---|
| 77 | //------------------ Occupancy Grid Data -------------------------
|
---|
| 78 | typedef struct
|
---|
| 79 | {
|
---|
| 80 | int num_readings; // number of readings
|
---|
| 81 | double radius[MAX_GRID_POINTS]; // distance measurements
|
---|
| 82 | double angle[MAX_GRID_POINTS]; // angle of each measurement
|
---|
| 83 | } occ_grid_data; // Sensor properties
|
---|
| 84 |
|
---|
| 85 | typedef struct
|
---|
| 86 | {
|
---|
| 87 | road_time_t time;
|
---|
| 88 | road_timerange_t timerange;
|
---|
| 89 | occ_grid_data data;
|
---|
| 90 | } TimestampedOccGridData;
|
---|
| 91 | //----------------------------------------------------------------
|
---|
| 92 |
|
---|
| 93 | //--------------------- Robot State Data -------------------------
|
---|
| 94 | typedef struct
|
---|
| 95 | {
|
---|
| 96 | double x; // Delta X related to the last frame
|
---|
| 97 | double y; // Delta Y related to the last frame
|
---|
| 98 | double theta; // Delta theta (orientation angle) related to the last frame
|
---|
| 99 | double phi; // Delta phi (steering angle) related to the last frame
|
---|
| 100 | } robot_pose_data; // pose properties
|
---|
| 101 |
|
---|
| 102 | typedef struct
|
---|
| 103 | {
|
---|
| 104 | double v1; // Linear velocity
|
---|
| 105 | double v2; // Steering angle velocity
|
---|
| 106 | } robot_velocity_data; // velocities properties
|
---|
| 107 |
|
---|
| 108 | typedef struct
|
---|
| 109 | {
|
---|
| 110 | road_time_t time;
|
---|
| 111 | road_timerange_t timerange;
|
---|
| 112 | robot_pose_data pose_data;
|
---|
| 113 | robot_velocity_data velocity_data;
|
---|
| 114 | } TimestampedRobotStateData;
|
---|
| 115 | //----------------------------------------------------------------
|
---|
| 116 |
|
---|
| 117 | //------------------ Line Features Data -------------------------
|
---|
| 118 | typedef struct
|
---|
| 119 | {
|
---|
| 120 | int center_point_x,
|
---|
| 121 | center_point_y; // Reference line point
|
---|
| 122 | double center_angle; // Reference line angle
|
---|
| 123 | // For road surface
|
---|
| 124 | int left_point_x,
|
---|
| 125 | left_point_y; // Left road boundary
|
---|
| 126 | double left_angle; // Left road boundary angle
|
---|
| 127 | int right_point_x,
|
---|
| 128 | right_point_y; // Left road boundary
|
---|
| 129 | double right_angle; // Left road boundary angle
|
---|
| 130 | } line_features_data; // line features
|
---|
| 131 |
|
---|
| 132 | typedef struct
|
---|
| 133 | {
|
---|
| 134 | road_time_t time;
|
---|
| 135 | road_timerange_t timerange;
|
---|
| 136 | line_features_data data;
|
---|
| 137 | } TimestampedLineFeaturesData;
|
---|
| 138 | //----------------------------------------------------------------
|
---|
| 139 |
|
---|
| 140 | //------------------ Robot Control Inputs -------------------------
|
---|
| 141 | typedef struct
|
---|
| 142 | {
|
---|
| 143 | double v1; // Linear velocity in km/h
|
---|
| 144 | double v2; // Angular velocity for the wifibot and Steering
|
---|
| 145 | // angle velocity for the car-like robot in degrees/s
|
---|
| 146 | double phi; // Final steering angle setpoint in degrees
|
---|
| 147 | double acc; // Desired acceleration/deceleration m/s^2
|
---|
| 148 | } control_data; // Control Data
|
---|
| 149 |
|
---|
| 150 | typedef struct
|
---|
| 151 | {
|
---|
| 152 | road_time_t time;
|
---|
| 153 | road_timerange_t timerange;
|
---|
| 154 | control_data data;
|
---|
| 155 | } TimestampedControlData;
|
---|
| 156 | //----------------------------------------------------------------
|
---|
| 157 |
|
---|
| 158 | //------------------ CAN DATA -------------------------
|
---|
| 159 | typedef struct
|
---|
| 160 | {
|
---|
| 161 | double frontLeftWheelSpeed; ///< speed of the front left wheel (in m/s)
|
---|
| 162 | double frontRightWheelSpeed; ///< speed of the front right wheel (in m/s)
|
---|
| 163 | double rearLeftWheelSpeed; ///< speed of the rear left wheel (in m/s)
|
---|
| 164 | double rearRightWheelSpeed; ///< speed of the rear right wheel (in m/s)
|
---|
| 165 | double averageFrontWheelSpeed; ///< average front wheels speed (in m/s)
|
---|
| 166 | } CANSpeed_data; // Speed data
|
---|
| 167 |
|
---|
| 168 | typedef struct
|
---|
| 169 | {
|
---|
| 170 | road_time_t time;
|
---|
| 171 | road_timerange_t timerange;
|
---|
| 172 | CANSpeed_data data;
|
---|
| 173 | } TimestampedCANSpeedData;
|
---|
| 174 |
|
---|
| 175 | typedef struct
|
---|
| 176 | {
|
---|
| 177 | double angle; ///< in rad positive in trigonometric direction (to the left)
|
---|
| 178 | double rotationSpeed; ///< in rad/s
|
---|
| 179 | } CANSteering_data; // Steering data converted to the front wheel frame
|
---|
| 180 |
|
---|
| 181 | typedef struct
|
---|
| 182 | {
|
---|
| 183 | road_time_t time;
|
---|
| 184 | road_timerange_t timerange;
|
---|
| 185 | CANSteering_data data;
|
---|
| 186 | } TimestampedCANSteeringData;
|
---|
| 187 | //----------------------------------------------------------------
|
---|
| 188 |
|
---|
| 189 | //------------------ Visual Odometry Data -------------------------
|
---|
| 190 | typedef struct
|
---|
| 191 | {
|
---|
| 192 | double delta_d; // Camera translaction from the last interaction
|
---|
| 193 | double delta_theta; // Camera angle relate to the last camera frame
|
---|
| 194 | double delta_t; // Time interval between calculations
|
---|
| 195 | } viso_data; // Visual odometry Data
|
---|
| 196 |
|
---|
| 197 | typedef struct
|
---|
| 198 | {
|
---|
| 199 | road_time_t time;
|
---|
| 200 | road_timerange_t timerange;
|
---|
| 201 | viso_data data;
|
---|
| 202 | } TimestampedVisoData;
|
---|
| 203 | //----------------------------------------------------------------
|
---|
| 204 |
|
---|
| 205 | #endif
|
---|