BodyActuator.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * BodyActuator.h
  3. *
  4. * Copyright (C)
  5. * Honda Research Institute Europe GmbH
  6. * Carl-Legien-Str. 30
  7. * 63073 Offenbach/Main
  8. * Germany
  9. *
  10. * UNPUBLISHED PROPRIETARY MATERIAL.
  11. * ALL RIGHTS RESERVED.
  12. *
  13. */
  14. #pragma once
  15. #include <stdbool.h>
  16. #include "ArduinoHub.h"
  17. #include "EAIHub.h"
  18. typedef enum
  19. {
  20. BODYACTUATOR_TYPE_NONE,
  21. BODYACTUATOR_TYPE_EAI,
  22. BODYACTUATOR_TYPE_PIEZO,
  23. BODYACTUATOR_TYPE_ERM,
  24. BODYACTUATOR_TYPE_EMS
  25. } BodyActuator_Type;
  26. extern char* BodyActuator_Type_Names[5];
  27. typedef struct BodyActuator
  28. {
  29. bool valid;
  30. uint8_t actuatorCount;
  31. BodyActuator_Type type;
  32. ArduinoHub* arduinoHub;
  33. EAIHub* eaiHub;
  34. } BodyActuator;
  35. BodyActuator* BodyActuator_new();
  36. void BodyActuator_init(BodyActuator* self, BodyActuator_Type type, char* port, uint8_t actuatorCount);
  37. void BodyActuator_clear(BodyActuator* self);
  38. void BodyActuator_delete(BodyActuator* self);
  39. /**
  40. * Starts actuation for a specified duration. The command is non-blocking.
  41. * @intensity:
  42. * Intensity covering the whole spectrum of the actuator if no range is set.
  43. * An intensity range can be set with BodyActuator_setIntensityRange().
  44. * @duration:
  45. * Duration of the vibration in milliseconds.
  46. */
  47. void BodyActuator_actuate(BodyActuator* self, uint8_t tactor, double intensity, uint64_t duration);
  48. /**
  49. * Starts continuous actuation. The command is non-blocking.
  50. * @intensity:
  51. * Intensity covering the whole spectrum of the actuator if no range is set.
  52. * An intensity range can be set with ArduinoActuator_setIntensityRange().
  53. */
  54. void BodyActuator_startActuation(BodyActuator* self, uint8_t tactor, double intensity);
  55. /**
  56. * Stops continuous vibration.
  57. */
  58. void BodyActuator_stopActuation(BodyActuator* self, uint8_t tactor);
  59. /**
  60. * Sets the frequency of the vibration of an actuator.
  61. */
  62. void BodyActuator_setFrequency(BodyActuator* self, uint8_t tactor, uint16_t frequency);
  63. /**
  64. * Set the intensity range. The default range is the actuators whole intensity [0, 1].
  65. * Modifying this setting cuts-out intensity values under min and above max.
  66. * E.g., for the range [0.2, 1.0] the intensity 0.5 maps to a device intensity of 0.6.
  67. */
  68. void BodyActuator_setIntensityRange(BodyActuator* self, uint8_t tactor, double minIntensity, double maxIntensity);