22 #include "emergency_motor_instruct.h" 24 #include <interfaces/MotorInterface.h> 25 #include <logging/logger.h> 26 #include <config/config.h> 27 #include <utils/math/common.h> 82 float EmergencyMotorInstruct::calculate_translation(
float current,
float desired,
float time_factor )
84 float exec_trans = 0.0;
86 if (desired < current) {
92 }
else if (current < 0.0) {
95 exec_trans = max( exec_trans, desired );
102 }
else if (desired > current) {
107 exec_trans = min( exec_trans, desired );
109 }
else if (current < 0.0) {
111 exec_trans = desired;
120 exec_trans = desired;
123 return exec_trans*time_factor;
137 float EmergencyMotorInstruct::calculate_rotation(
float current,
float desired,
float time_factor )
139 float exec_rot = 0.0;
141 if (desired < current) {
146 exec_rot = max( exec_rot, desired );
148 }
else if (current < 0.0) {
151 exec_rot = max( exec_rot, desired );
155 exec_rot = max( -
rot_acc_, desired );
158 }
else if (desired > current) {
162 exec_rot = min( exec_rot, desired );
164 }
else if (current < 0.0) {
167 exec_rot = min( exec_rot, desired );
171 exec_rot = min(
rot_acc_, desired );
179 return exec_rot*time_factor;
virtual ~EmergencyMotorInstruct()
Destructor.
Fawkes library namespace.
float rot_acc_
Rotation acceleration.
float rot_dec_
Rotation deceleration.
Logger * logger_
The fawkes logger.
virtual void log_debug(const char *component, const char *format,...)=0
Log debug message.
EmergencyMotorInstruct(MotorInterface *motor, float frequency, Logger *logger, Configuration *config)
Constructor.
float trans_acc_
Translation acceleration.
The Basic of a Motorinstructor.
MotorInterface Fawkes BlackBoard Interface.
Interface for configuration handling.