24#include "linear_motor_instruct.h"
26#include <utils/math/common.h>
76LinearMotorInstruct::calculate_translation(
float current,
float desired,
float time_factor)
78 float exec_trans = 0.0;
80 if (desired < current) {
84 exec_trans = max(exec_trans, desired);
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) {
105 exec_trans = min(exec_trans, desired);
114 exec_trans = desired;
117 return exec_trans * time_factor;
131LinearMotorInstruct::calculate_rotation(
float current,
float desired,
float time_factor)
133 float exec_rot = 0.0;
135 if (desired < current) {
139 exec_rot = max(exec_rot, desired);
141 }
else if (current < 0.0) {
144 exec_rot = max(exec_rot, desired);
151 }
else if (desired > current) {
155 exec_rot = min(exec_rot, desired);
157 }
else if (current < 0.0) {
160 exec_rot = min(exec_rot, desired);
172 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.
float trans_dec_
Translation deceleration.
Interface for configuration handling.
virtual ~LinearMotorInstruct()
Destructor.
LinearMotorInstruct(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.