Feelix
  • Feelix Documentation
  • Getting started
    • Designing Effects
      • Torque Effects
      • Position Effects
      • Velocity Effects
      • Dependent/Independent Effects
    • Effect Library
    • Creating Collections
  • Create and edit
    • Edit tools
    • Effect Settings
    • Layers
    • Grid
    • Export
    • TensorFlow
  • Uploading files
    • Setting up STM32
    • Connect and Upload
    • Hardware Settings
    • Troubleshooting Feelix
  • Hardware support
    • Hardware
    • PCB pinout
    • Setup
    • Dependencies
    • FeelixEffect Docs
      • Setup
      • Motor control
      • Import Effects
      • I2C communication
      • Example codes
  • Downloads
    • Feelix Design Tool
    • Feelix Arduino Library
    • 3D Models
    • Old Library Releases
Powered by GitBook
On this page
  • Initialization
  • Control functions
  • Motor control functions in Feelix Library

Was this helpful?

  1. Hardware support
  2. FeelixEffect Docs

Motor control

These functions provide motor control without using effects from Feelix and are based on the SimpleFOC library. Visit simplefoc.com for more details.

PreviousSetupNextImport Effects

Last updated 3 days ago

Was this helpful?

These functions can be used in combination with the designed to work with effects imported from Feelix.

Initialization


/* initialize motor */
BLDCMotor _bldc = BLDCMotor(7);

/* for Feelix MiniDriver */
DRV8316Driver6PWM _driver =
    DRV8316Driver6PWM(
        STM32_INHA,
        STM32_INLA,
        STM32_INHB,
        STM32_INLB,
        STM32_INHC,
        STM32_INLC,
        STM32_SPI1_CS_DRV,
        false);

/* similar for boards with AS5047 */
MagneticSensorSPI _sensor = MagneticSensorSPI(AS5147_SPI, STM32_SPI3_CS_ENC);

/* initialize Feelix */
FeelixM feelix = FeelixM(&_bldc, &_driver, &_sensor, 'A', State::NO_COMMUNICATION);

Control functions

These are a few examples:

Get motor angle

/* accessing angle and velocity using SimpleFOC library  */
volatile float angle = feelix.bldc->shaft_angle();
volatile float velocity = feelix.bldc->shaft_velocity();

/* when feelix.run() is called in the loop  */
/* the angle can be directly accessed with: */
feelix.angle
/* the velocity can be directly accessed with: */
feelix.velocity

Control type options

feelix.bldc->controller = MotionControlType::torque;
feelix.bldc->controller = MotionControlType::angle;
feelix.bldc->controller = MotionControlType::velocity;

Move the motor

feelix.bldc->loopFOC();
feelix.bldc->move(value);

Motor control functions in Feelix Library

Move the motor to a specific position, speed value is optional.

/* angle (deg), speed (rad/s) */
feelix.move_to(float angle, float speed (optional));

/* returns true when motor is rotating, false when position is reached */
feelix.movingToAngle(); 

You can use the functions specified in the documentation of the library. The initialization is handled in feelix.init(). To access the bldc, sensor and driver in the loop use: feelix.bldc-> (BLDCMoter object), feelix.driver-> (BLDCDriver3PWM object), feelix.sensor-> (MagneticSensorSPI object).

For all possibilities, check out the complete documentation at

simpleFOC
SimpleFOC.com
'lite' version of the library