22 #include "emergency_motor_instruct.h"
24 #include <config/config.h>
25 #include <interfaces/MotorInterface.h>
26 #include <logging/logger.h>
27 #include <utils/math/common.h>
77 EmergencyMotorInstruct::calculate_translation(
float current,
float desired,
float time_factor)
79 float exec_trans = 0.0;
81 if (desired < current) {
86 }
else if (current < 0.0) {
89 exec_trans = max(exec_trans, desired);
96 }
else if (desired > current) {
100 exec_trans = min(exec_trans, desired);
102 }
else if (current < 0.0) {
104 exec_trans = desired;
113 exec_trans = desired;
116 return exec_trans * time_factor;
130 EmergencyMotorInstruct::calculate_rotation(
float current,
float desired,
float time_factor)
132 float exec_rot = 0.0;
134 if (desired < current) {
138 exec_rot = max(exec_rot, desired);
140 }
else if (current < 0.0) {
143 exec_rot = max(exec_rot, desired);
150 }
else if (desired > current) {
154 exec_rot = min(exec_rot, desired);
156 }
else if (current < 0.0) {
159 exec_rot = min(exec_rot, desired);
171 return exec_rot * time_factor;
The Basic of a Motorinstructor.
float trans_acc_
Translation acceleration.
float rot_acc_
Rotation acceleration.
float rot_dec_
Rotation deceleration.
Logger * logger_
The fawkes logger.
Interface for configuration handling.
virtual ~EmergencyMotorInstruct()
Destructor.
EmergencyMotorInstruct(MotorInterface *motor, float frequency, Logger *logger, Configuration *config)
Constructor.
virtual void log_debug(const char *component, const char *format,...)=0
Log debug message.
MotorInterface Fawkes BlackBoard Interface.
Fawkes library namespace.