|
17 | 17 | #include <cstdint> |
18 | 18 |
|
19 | 19 | #include <libhal-canrouter/can_router.hpp> |
| 20 | +#include <libhal/angular_velocity_sensor.hpp> |
20 | 21 | #include <libhal/can.hpp> |
21 | 22 | #include <libhal/motor.hpp> |
22 | 23 | #include <libhal/rotation_sensor.hpp> |
@@ -336,13 +337,39 @@ class drc_servo : public hal::servo |
336 | 337 | * |
337 | 338 | * @param p_drc - reference to a drc driver. This object's lifetime must |
338 | 339 | * exceed the lifetime of the returned object. |
339 | | - * @param p_max_speed - maximum speed of the motor when moving to an angle |
340 | | - * @return result<drc_servo> - motor implementation based on the drc driver |
| 340 | + * @param p_max_speed - maximum speed of the servo when moving to an angle |
| 341 | + * @return result<drc_servo> - servo implementation based on the drc driver |
341 | 342 | */ |
342 | 343 | result<drc_servo> make_servo(drc& p_drc, hal::rpm p_max_speed); |
| 344 | + |
| 345 | +/** |
| 346 | + * @brief angular velocity sensor adaptor for DRC |
| 347 | + * |
| 348 | + */ |
| 349 | +class drc_angular_velocity_sensor : public hal::angular_velocity_sensor |
| 350 | +{ |
| 351 | +private: |
| 352 | + drc_angular_velocity_sensor(drc& p_drc); |
| 353 | + result<angular_velocity_sensor::read_t> driver_read() override; |
| 354 | + friend result<drc_angular_velocity_sensor> make_angular_velocity_sensor( |
| 355 | + drc& p_drc); |
| 356 | + drc* m_drc = nullptr; |
| 357 | +}; |
| 358 | + |
| 359 | +/** |
| 360 | + * @brief Create a hal::angular_velocity_sensor driver using the drc driver |
| 361 | + * |
| 362 | + * @param p_drc - reference to a drc driver. This object's lifetime must exceed |
| 363 | + * the lifetime of the returned object |
| 364 | + * @return result<angular_velocity_sensor> - angular_velocity_sensor |
| 365 | + * implementation based on the drc driver |
| 366 | + */ |
| 367 | +result<drc_angular_velocity_sensor> make_angular_velocity_sensor(drc& p_drc); |
| 368 | + |
343 | 369 | } // namespace hal::rmd |
344 | 370 |
|
345 | 371 | namespace hal { |
| 372 | +using rmd::make_angular_velocity_sensor; |
346 | 373 | using rmd::make_motor; |
347 | 374 | using rmd::make_rotation_sensor; |
348 | 375 | using rmd::make_servo; |
|
0 commit comments