Class MotionGenerator
Defined in File motion_generator.hpp
Class Documentation
-
class MotionGenerator
Generates the analytical solution for the trapezoidal motion.
Usage: // Includes #include “MotionGenerator.h”
Initialization
Define the MotionGenerator object MotionGenerator *trapezoidalProfile = new MotionGenerator(100, 400, 0); Retrieve calculated position double positionRef = 1000; double position = trapezoidalProfile->update(positionRef) Retrieve current velocity double velocity = trapezoidalProfile->getVelocity(); Retrieve current acceleration double acceleration = trapezoidalProfile->getAcceleration(); Check if profile is finished if (trapezoidalProfile->getFinished()) {}; Reset internal state trapezoidalProfile->reset();
- Author
AerDronix aerdronix@gmail.com @web https://aerdronix.wordpress.com/
- Version
1.0
- Since
2016-12-22
- Param int:
aVelMax maximum velocity (units/s)
- Param int:
aAccMax maximum acceleration (units/s^2)
- Param int:
aInitPos initial position (units)
Public Functions
-
MotionGenerator(double aMaxVel, double aMaxAcc, double aInitPos)
Constructor
- Parameters:
int – aVelocityMax maximum velocity
int – aAccelerationMax maximum acceleration
-
void init()
-
double update(double aPosRef)
Updates the state, generating new setpoints
- Parameters:
aSetpoint – The current setpoint.
-
double getVelocity()
-
double getAcceleration()
-
bool getFinished()
-
void setMaxVelocity(double aMaxVel)
-
void setMaxAcceleration(double aMaxAcc)
-
void setInitPosition(double aInitPos)
-
void reset()