![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Version 3 is with update to the test rig with a linear actuator
Dependencies: SPTE_10Bar_5V mbed AS5048 SDFileSystem MODSERIAL PinDetect LCM101 LinearActuator
bench.h@4:1cdce6c6c94e, 2018-10-12 (annotated)
- Committer:
- cnckiwi31
- Date:
- Fri Oct 12 12:12:55 2018 +0000
- Revision:
- 4:1cdce6c6c94e
- Parent:
- 0:3855d4588f76
- Child:
- 5:63063a9fa51c
HeRoS: read out and log joint angles and force sensor data from the leg test bench.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
megrootens | 0:3855d4588f76 | 1 | #ifndef _BENCH02_H_ |
megrootens | 0:3855d4588f76 | 2 | #define _BENCH02_H_ |
megrootens | 0:3855d4588f76 | 3 | |
megrootens | 0:3855d4588f76 | 4 | #include "mbed.h" |
megrootens | 0:3855d4588f76 | 5 | #include "as5048.h" |
megrootens | 0:3855d4588f76 | 6 | #include "lcm101.h" |
cnckiwi31 | 4:1cdce6c6c94e | 7 | #include "SPTEPressureSensor.h" |
megrootens | 0:3855d4588f76 | 8 | #include "constants.h" |
megrootens | 0:3855d4588f76 | 9 | |
megrootens | 0:3855d4588f76 | 10 | /** |
megrootens | 0:3855d4588f76 | 11 | * Class to read out sensory information from the second test bench; |
megrootens | 0:3855d4588f76 | 12 | * the upper and lower leg, foot en toe setup with 1-dof hinges, |
megrootens | 0:3855d4588f76 | 13 | * each of which is equipped with an AMS AS5048 absolute rotary sensor. |
megrootens | 0:3855d4588f76 | 14 | * The sensors are daisy chained and communicate via SPI |
cnckiwi31 | 4:1cdce6c6c94e | 15 | * also includes a load cell measuring the vertical force applied externally to |
cnckiwi31 | 4:1cdce6c6c94e | 16 | * the hip and pressure sensors connected to the setup |
megrootens | 0:3855d4588f76 | 17 | */ |
megrootens | 0:3855d4588f76 | 18 | class Bench { |
megrootens | 0:3855d4588f76 | 19 | public: |
megrootens | 0:3855d4588f76 | 20 | |
megrootens | 0:3855d4588f76 | 21 | static const float kCutOffDegrees = 180.0f; |
megrootens | 0:3855d4588f76 | 22 | static const float kCutOffRadians = 3.14159265359f; |
megrootens | 0:3855d4588f76 | 23 | |
megrootens | 0:3855d4588f76 | 24 | enum Joint { |
megrootens | 0:3855d4588f76 | 25 | TOES, |
megrootens | 0:3855d4588f76 | 26 | ANKLE, |
megrootens | 0:3855d4588f76 | 27 | KNEE, |
megrootens | 0:3855d4588f76 | 28 | HIP |
megrootens | 0:3855d4588f76 | 29 | }; |
megrootens | 0:3855d4588f76 | 30 | |
cnckiwi31 | 4:1cdce6c6c94e | 31 | Bench(PinName mosi, PinName miso, PinName sck, PinName cs, PinName p_lcm101, PinName p_spte0, PinName p_spte1); |
megrootens | 0:3855d4588f76 | 32 | |
megrootens | 0:3855d4588f76 | 33 | void Update(); |
megrootens | 0:3855d4588f76 | 34 | |
megrootens | 0:3855d4588f76 | 35 | float getDegrees(int i_joint); |
megrootens | 0:3855d4588f76 | 36 | float getDegrees(Joint joint); |
megrootens | 0:3855d4588f76 | 37 | |
megrootens | 0:3855d4588f76 | 38 | float getRadians(int i_joint); |
megrootens | 0:3855d4588f76 | 39 | float getRadians(Joint joint); |
megrootens | 0:3855d4588f76 | 40 | |
megrootens | 0:3855d4588f76 | 41 | |
megrootens | 0:3855d4588f76 | 42 | const char* getJointName(int i_joint); |
megrootens | 0:3855d4588f76 | 43 | const char* getJointName(Joint joint); |
megrootens | 0:3855d4588f76 | 44 | |
megrootens | 0:3855d4588f76 | 45 | float getForce(); |
cnckiwi31 | 4:1cdce6c6c94e | 46 | void nullForce(); |
cnckiwi31 | 4:1cdce6c6c94e | 47 | |
cnckiwi31 | 4:1cdce6c6c94e | 48 | float getPressure0(); |
cnckiwi31 | 4:1cdce6c6c94e | 49 | void nullPressure0(); |
cnckiwi31 | 4:1cdce6c6c94e | 50 | float getPressure1(); |
cnckiwi31 | 4:1cdce6c6c94e | 51 | void nullPressure1(); |
megrootens | 0:3855d4588f76 | 52 | |
megrootens | 0:3855d4588f76 | 53 | As5048* get_as5048(); |
megrootens | 0:3855d4588f76 | 54 | |
megrootens | 0:3855d4588f76 | 55 | |
megrootens | 0:3855d4588f76 | 56 | private: |
megrootens | 0:3855d4588f76 | 57 | As5048 as5048_; |
megrootens | 0:3855d4588f76 | 58 | Lcm101 lcm101_; |
cnckiwi31 | 4:1cdce6c6c94e | 59 | SPTEPressureSensor spte0; |
cnckiwi31 | 4:1cdce6c6c94e | 60 | SPTEPressureSensor spte1; |
megrootens | 0:3855d4588f76 | 61 | }; |
megrootens | 0:3855d4588f76 | 62 | |
megrootens | 0:3855d4588f76 | 63 | #endif |