* It's HUB ID * Rename file * Working with official doc * Some progress * AttachedIO msg * device action impl * some better device alert impl * restructuring * Some port commands handled * Some command feedback waiting * Some more request-reply things * Some more request-reply things * Reworked msg classes * Getting back to UTs * Getting back to UTs * Facing sync lock problems * Facing sync lock problems * Testing it * Covering more with tests * handle actions * Hub class is almost covered * done coverage for Hub * done coverage for MoveHub * Button is tested * remove debug server from examples * Current and voltage tested * color sensor basic test * cover tilt sensor * motor sensor tested * constant motor * motor is tested * hold_speed impl for motor * motor commands recorded * some cleanup * some cleanup * some cleanup * debug * debug * FIX a bug * acc/dec profiles figured out * UT motor ops * UT motor ops * Get rid of weird piggyback * fix UT * Fix encoding? * fix test mb * More robust * Checked demo works * cosmetics * cosmetics * Maybe better test * fetching and decoding some device caps * describing devs * describing devs works * Applying modes we've learned * Simple and extensible dev attach * Reworking peripherals based on modes * Applying modes we've learned * implemented getting sensor data * fixed port subscribe * Added led out cmds on vision sensor * Worked on color-distance sensor * Introduce some locking for consistency * Improved it all * Travis flags * improve * improve * improve docs
1.5 KiB
Peripheral Types
Here is the list of peripheral devices that have dedicated classes in library:
- Motors
- RGB LED
- Tilt Sensor
- Vision Sensor (color and/or distance)
- Voltage and Current Sensors
In case device you attached to Hub is of an unknown type, it will get generic Peripheral
class, allowing direct low-level interactions.
Subscribing to Sensors
Each sensor usually has several different "subscription modes", differing with callback parameters and value semantics.
There is optional granularity
parameter for each subscription call, by default it is 1
. This parameter tells Hub when to issue sensor data notification. Value of notification has to change greater or equals to granularity
to issue notification. This means that specifying 0
will cause it to constantly send notifications, and specifying 5
will cause less frequent notifications, only when values change for more than 5
(inclusive).
It is possible to subscribe with multiple times for the same sensor. Only one, very last subscribe mode is in effect, with many subscriber callbacks allowed to receive notifications.
Good practice for any program is to unsubscribe from all sensor subscriptions before exiting, especially when used with DebugServer
.
Generic Perihpheral
In case you have used a peripheral that is not recognized by the library, it will be detected as generic Peripheral
class. You still can use subscription and sensor info getting commands for it.