diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c index 987784e435..461b77af1e 100644 --- a/drivers/sensors/sensor.c +++ b/drivers/sensors/sensor.c @@ -214,6 +214,7 @@ static const struct sensor_meta_s g_sensor_meta[] = {sizeof(struct sensor_gnss_measurement), "gnss_measurement"}, {sizeof(struct sensor_gnss_clock), "gnss_clock"}, {sizeof(struct sensor_gnss_geofence_event), "gnss_geofence_event"}, + {sizeof(struct sensor_velocity), "velocity"}, }; static const struct file_operations g_sensor_fops = diff --git a/include/nuttx/uorb.h b/include/nuttx/uorb.h index 0247600822..f802458d06 100644 --- a/include/nuttx/uorb.h +++ b/include/nuttx/uorb.h @@ -467,9 +467,18 @@ #define SENSOR_TYPE_GNSS_GEOFENCE 52 -/* The total number of sensor */ +/* Velocity Sensor + * A sensor of this type measures the velocity as it is moving. + * The default unit velocity is meter by seconds m/s (SI). + */ -#define SENSOR_TYPE_COUNT 53 +#define SENSOR_TYPE_VELOCITY 53 + +/* The total number of sensor + * please increase it if you added a new sensor type! + */ + +#define SENSOR_TYPE_COUNT 54 /* The additional sensor open flags */ @@ -747,6 +756,12 @@ struct sensor_force /* Type: Force */ int32_t event; /* Force event */ }; +struct sensor_velocity /* Type: Velocity */ +{ + uint64_t timestamp; /* Unit is microseconds */ + float velocity; /* Velocity value, units is m/s (SI) */ +}; + struct sensor_hall /* Type: HALL */ { uint64_t timestamp; /* Units is microseconds */