File demo_leg.cpp¶
- Copyright
Copyright (c) 2018-2020, New York University and Max Planck Gesellschaft, License BSD-3-Clause
Functions
- std::atomic_bool StopDemos (false)
This boolean is here to kill cleanly the application upon ctrl+c.
-
void my_handler(int)
This function is the callback upon a ctrl+c call from the terminal.
- Parameters:
s –
-
int main(int, char**)
-
class Controller
This is a simple PD control on one motor and one slider.
Public Functions
Construct a new Controller object.
- Parameters:
motor –
analog_sensor –
-
inline void start_loop()
main control loop
Public Static Functions
-
static inline THREAD_FUNCTION_RETURN_TYPE loop(void *instance_pointer)
this function is just a wrapper around the actual loop function, such that it can be spawned as a posix thread.
Private Functions
-
inline void loop()¶
this is a simple control loop which runs at a kilohertz.
it reads the measurement from the analog sensor, in this case the slider. then it scales it and sends it as the current target to the motor.
Private Members
-
std::shared_ptr<blmc_drivers::Motor> motor_¶
one motor.
-
std::shared_ptr<blmc_drivers::AnalogSensor> analog_sensor_¶
one slider.
-
real_time_tools::RealTimeThread rt_thread_¶
the realt time thread object.
-
class LegController
Simple PD control on the leg.
Public Functions
Construct a new LegController object.
- Parameters:
leg –
analog_sensor –
-
inline ~LegController()
Destroy the LegController object.
-
inline void start_loop()
helper to strat the real time thread.
Public Static Functions
-
static inline THREAD_FUNCTION_RETURN_TYPE loop(void *instance_pointer)
this function is just a wrapper around the actual loop function, such that it can be spawned as a posix thread.
Private Functions
-
inline void loop()¶
this is a simple control loop which runs at a kilohertz.
it reads the measurement from the analog sensor, in this case the slider. then it scales it and sends it as the current target to the motor.
Private Members
-
std::shared_ptr<blmc_drivers::Leg> leg_¶
is the leg to control
-
std::shared_ptr<blmc_drivers::AnalogSensor> analog_sensor_¶
is the list of sliders
-
real_time_tools::RealTimeThread rt_thread_¶
is the real time thread object.
-
bool stop_loop_¶
manages the shutdown of the controller