#include <flywheelSimulator.hpp>
|
| | FlywheelSimulator (double imass=0.01, double ilinkLen=1, double imuStatic=0.1, double imuDynamic=0.9, double itimestep=0.01) |
| | A simulator for an inverted pendulum.
|
| |
| virtual | ~FlywheelSimulator () |
| |
| double | step () |
| | Step the simulation by the timestep.
|
| |
| double | step (double itorque) |
| | Step the simulation by the timestep.
|
| |
| void | setExternalTorqueFunction (std::function< double(double angle, double mass, double linkLength)> itorqueFunc) |
| | Sets the torque function used to calculate the torque due to external forces.
|
| |
| void | setTorque (double itorque) |
| | Sets the input torque.
|
| |
| void | setMaxTorque (double imaxTorque) |
| | Sets the max torque.
|
| |
| void | setAngle (double iangle) |
| | Sets the current angle.
|
| |
| void | setMass (double imass) |
| | Sets the mass (kg).
|
| |
| void | setLinkLength (double ilinkLen) |
| | Sets the link length (m).
|
| |
| void | setStaticFriction (double imuStatic) |
| | Sets the static friction (N*m).
|
| |
| void | setDynamicFriction (double imuDynamic) |
| | Sets the dynamic friction (N*m).
|
| |
| void | setTimestep (double itimestep) |
| | Sets the timestep (sec).
|
| |
| double | getAngle () const |
| | Returns the current angle (angle in rad).
|
| |
| double | getOmega () const |
| | Returns the current omgea (angular velocity in rad / sec).
|
| |
| double | getAcceleration () const |
| | Returns the current acceleration (angular acceleration in rad / sec^2).
|
| |
| double | getMaxTorque () const |
| | Returns the maximum torque input.
|
| |
Definition at line 11 of file flywheelSimulator.hpp.
◆ FlywheelSimulator()
| okapi::FlywheelSimulator::FlywheelSimulator |
( |
double |
imass = 0.01, |
|
|
double |
ilinkLen = 1, |
|
|
double |
imuStatic = 0.1, |
|
|
double |
imuDynamic = 0.9, |
|
|
double |
itimestep = 0.01 |
|
) |
| |
|
explicit |
A simulator for an inverted pendulum.
The center of mass of the system changes as the link rotates (by default, you can set a new torque function with setExternalTorqueFunction()).
◆ ~FlywheelSimulator()
| virtual okapi::FlywheelSimulator::~FlywheelSimulator |
( |
| ) |
|
|
virtual |
◆ getAcceleration()
| double okapi::FlywheelSimulator::getAcceleration |
( |
| ) |
const |
Returns the current acceleration (angular acceleration in rad / sec^2).
- Returns
- the current acceleration
◆ getAngle()
| double okapi::FlywheelSimulator::getAngle |
( |
| ) |
const |
Returns the current angle (angle in rad).
- Returns
- the current angle
◆ getMaxTorque()
| double okapi::FlywheelSimulator::getMaxTorque |
( |
| ) |
const |
Returns the maximum torque input.
- Returns
- the max torque input
◆ getOmega()
| double okapi::FlywheelSimulator::getOmega |
( |
| ) |
const |
Returns the current omgea (angular velocity in rad / sec).
- Returns
- the current omega
◆ setAngle()
| void okapi::FlywheelSimulator::setAngle |
( |
double |
iangle | ) |
|
Sets the current angle.
- Parameters
-
◆ setDynamicFriction()
| void okapi::FlywheelSimulator::setDynamicFriction |
( |
double |
imuDynamic | ) |
|
Sets the dynamic friction (N*m).
- Parameters
-
| imuDynamic | new dynamic friction |
◆ setExternalTorqueFunction()
| void okapi::FlywheelSimulator::setExternalTorqueFunction |
( |
std::function< double(double angle, double mass, double linkLength)> |
itorqueFunc | ) |
|
Sets the torque function used to calculate the torque due to external forces.
This torque gets summed with the input torque.
For example, the default torque function has the torque due to gravity vary as the link swings: [](double angle, double mass, double linkLength) { return (linkLength * std::cos(angle)) * (mass * -1 * gravity); }
- Parameters
-
| itorqueFunc | the torque function. The return value is the torque due to external forces |
◆ setLinkLength()
| void okapi::FlywheelSimulator::setLinkLength |
( |
double |
ilinkLen | ) |
|
Sets the link length (m).
- Parameters
-
◆ setMass()
| void okapi::FlywheelSimulator::setMass |
( |
double |
imass | ) |
|
Sets the mass (kg).
- Parameters
-
◆ setMaxTorque()
| void okapi::FlywheelSimulator::setMaxTorque |
( |
double |
imaxTorque | ) |
|
Sets the max torque.
The input torque cannot exceed this maximum torque.
- Parameters
-
| imaxTorque | new maximum torque |
◆ setStaticFriction()
| void okapi::FlywheelSimulator::setStaticFriction |
( |
double |
imuStatic | ) |
|
Sets the static friction (N*m).
- Parameters
-
| imuStatic | new static friction |
◆ setTimestep()
| void okapi::FlywheelSimulator::setTimestep |
( |
double |
itimestep | ) |
|
Sets the timestep (sec).
- Parameters
-
◆ setTorque()
| void okapi::FlywheelSimulator::setTorque |
( |
double |
itorque | ) |
|
Sets the input torque.
The input will be bounded by the max torque.
- Parameters
-
◆ step() [1/2]
| double okapi::FlywheelSimulator::step |
( |
| ) |
|
Step the simulation by the timestep.
- Returns
- the current angle
◆ step() [2/2]
| double okapi::FlywheelSimulator::step |
( |
double |
itorque | ) |
|
Step the simulation by the timestep.
- Parameters
-
- Returns
- the current angle
◆ stepImpl()
| virtual double okapi::FlywheelSimulator::stepImpl |
( |
| ) |
|
|
protectedvirtual |
◆ accel
| double okapi::FlywheelSimulator::accel = 0 |
|
protected |
◆ angle
| double okapi::FlywheelSimulator::angle = 0 |
|
protected |
| double okapi::FlywheelSimulator::I = 0 |
|
protected |
◆ inputTorque
| double okapi::FlywheelSimulator::inputTorque = 0 |
|
protected |
◆ linkLen
| double okapi::FlywheelSimulator::linkLen |
|
protected |
◆ mass
| double okapi::FlywheelSimulator::mass |
|
protected |
◆ maxTorque
| double okapi::FlywheelSimulator::maxTorque = 0.5649 |
|
protected |
◆ minTimestep
| const double okapi::FlywheelSimulator::minTimestep = 0.000001 |
|
protected |
◆ muDynamic
| double okapi::FlywheelSimulator::muDynamic |
|
protected |
◆ muStatic
| double okapi::FlywheelSimulator::muStatic |
|
protected |
◆ omega
| double okapi::FlywheelSimulator::omega = 0 |
|
protected |
◆ timestep
| double okapi::FlywheelSimulator::timestep |
|
protected |
◆ torqueFunc
| std::function<double(double, double, double)> okapi::FlywheelSimulator::torqueFunc |
|
protected |
The documentation for this class was generated from the following file: