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

Committer:
cnckiwi31
Date:
2018-10-12
Revision:
4:1cdce6c6c94e
Parent:
0:3855d4588f76
Child:
5:63063a9fa51c

File content as of revision 4:1cdce6c6c94e:

#ifndef _BENCH02_H_
#define _BENCH02_H_

#include "mbed.h"
#include "as5048.h"
#include "lcm101.h"
#include "SPTEPressureSensor.h"
#include "constants.h"

/**
 * Class to read out sensory information from the second test bench;
 * the upper and lower leg, foot en toe setup with 1-dof hinges,
 * each of which is equipped with an AMS AS5048 absolute rotary sensor.
 * The sensors are daisy chained and communicate via SPI
 * also includes a load cell measuring the vertical force applied externally to 
 * the hip and pressure sensors connected to the setup
 */
class Bench {
public:
    
    static const float kCutOffDegrees = 180.0f;
    static const float kCutOffRadians = 3.14159265359f;
    
    enum Joint {
        TOES,
        ANKLE,
        KNEE,
        HIP
    };

    Bench(PinName mosi, PinName miso, PinName sck, PinName cs, PinName p_lcm101, PinName p_spte0, PinName p_spte1);
    
    void Update();

    float getDegrees(int i_joint);
    float getDegrees(Joint joint);

    float getRadians(int i_joint);
    float getRadians(Joint joint);


    const char* getJointName(int i_joint);
    const char* getJointName(Joint joint);

    float getForce();
    void nullForce();
    
    float getPressure0();
    void nullPressure0();
    float getPressure1();
    void nullPressure1();
    
    As5048* get_as5048();


private:
    As5048 as5048_;
    Lcm101 lcm101_;
    SPTEPressureSensor spte0;
    SPTEPressureSensor spte1;
};

#endif