Functions and Parameters
Last updated
Was this helpful?
Last updated
Was this helpful?
This code works with the
/* initialize Feelix
* default communication state: no I2C communication
* default I2C address: 0x71
*/
void Feelix::init(State _state = State::NO_COMMUNICATION, uint8_t I2C_ADDRESS = 0x71);
/* Function that needs to be called every loop to update variables */
void Feelix::run();
/* write target values to the motor to control torque/velocity/angle */
void Feelix::move_feelix();
/* Move to specific angle (specified in deg)
* at certain speed in percentages of maxVelocity (0.0 - 1.0)
* stop moving when angle is reached with given precision
*/
void Feelix::move_to(float _angleDeg, float speed = 1.0, float precision = 0.2);
/* set voltage (call in setup)
* default: 12.0
* updates both power supply voltage and voltage limit
*/
void Feelix::setVoltage(float voltage);
/* get angle and velocity variables */
float angle //angle in radians
float angleDeg //angle in degrees
float velocity // velocity in radians/sec
float direction // direction of motor CW (1)/CCW (-1)
/* read temperature sensor
* when calling this function a temperature above 65 degrees will stop the motor.
*/
void Feelix::readTemperature();
/* temperature is stored in:
*/
float temperature
/* set range and start position
* rangeMin and rangeMax in degrees
* update start position set to true
* when updated the startPosition will be aligned with rangeMin
* and the updated range will become equal to 0 - (rangeMax - rangeMin)
*/
void Feelix::setRange(float rangeMin, float rangeMax, bool updateStartPos = true);
/* boolean (default false) to constrain motor to set range
* outside of this range no power will be supplied to the motor
*/
bool constrain_range
/* transmission factor (default 1.0)
* this variable can be used when using gears or other types of power transmission
* simply divide teeth driven gear / teeth driving gear in case of gears.
*/
float transmissionFactor
/* play a haptic effect angle (in deg) call every loop to update variables */
void Feelix::playHapticEffectAtAngle(FeelixEffect effect, float _angleDeg);
/* play a velocity effect with optional callback call every loop to update variables */
void Feelix::playVelocityEffect(FeelixEffect effect, void (*callback)() = NULL);
/* stop the motor */
void Feelix::stop();
/* velocity effect only */
void FeelixEffect::play(bool play, long time = millis());
/* start effect */
effect_name.play(true, feelix.current_time);
/* stop effect */
effect_name.play(false);
/* boolean effect (true when playing) */
effect_name.PLAYING
void FeelixEffect::enable()
void FeelixEffect::disable()
/* enable effect */
effect_name.enable();
effect_name.disable();
/* check if effect is enabled */
bool enabled;
/* mirror effect data */
void FeelixEffect::mirrorVertical(float data_input[], int size);
void FeelixEffect::mirrorHorizontal(float data_input[], int size);
/* variable to store number of data points */
int data_size
/* Haptic Effect
* true: repeat every rotation
* false: repeat once
*/
/* Velocity Effect
* true: loop effect
* false: play effect once
*/
bool infinite
/* scale effect in x and y: value between 0.0 and 1.0 */
effect.scale.x = 0.8;
effect.scale.y = 0.5;
/* update effect position on y-axis: value between -1.0 and 1.0 */
effect.position.y = -0.5
/* Effect config settings */
struct EffectConfig_s {
int data_size; // size of data array
float angle; // width (deg) or duration (ms) of effect
float quality; // resolution of effect lower value means longer data array
Effect_type effect_type; // type of effect
Control_type control_type; // control type
};
/* control type (torque, position, or velocity) */
Control_type::POSITION
Control_type::TORQUE
Control_type::VELOCITY
Control_type::VELOCITY_ANGLE
Control_type::MOVE_TO
Control_type::UNDEFINED
/* effect type only relevant for haptic effects */
Effect_type::INDEPENDENT
Effect_type::DEPENDENT
Effect_type::NOTSET
/* direction in which the effect is played (default true) */
bool direction.cw;
bool direction.ccw;
/* boolean is true when velocity effect is playing */
bool PLAYING;
/* boolean is true when effect is enabled, set to false to disable effect */
bool enabled;