24 #include "linear_motor_instruct.h" 26 #include <utils/math/common.h> 81 float LinearMotorInstruct::calculate_translation(
float current,
float desired,
float time_factor )
83 float exec_trans = 0.0;
85 if (desired < current) {
90 exec_trans = max( exec_trans, desired );
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) {
112 exec_trans = min( exec_trans, desired );
121 exec_trans = desired;
124 return exec_trans*time_factor;
138 float LinearMotorInstruct::calculate_rotation(
float current,
float desired,
float time_factor )
140 float exec_rot = 0.0;
142 if (desired < current) {
147 exec_rot = max( exec_rot, desired );
149 }
else if (current < 0.0) {
152 exec_rot = max( exec_rot, desired );
156 exec_rot = max( -
rot_acc_, desired );
159 }
else if (desired > current) {
163 exec_rot = min( exec_rot, desired );
165 }
else if (current < 0.0) {
168 exec_rot = min( exec_rot, desired );
172 exec_rot = min(
rot_acc_, desired );
180 return exec_rot*time_factor;
Fawkes library namespace.
float trans_dec_
Translation deceleration.
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.
float trans_acc_
Translation acceleration.
LinearMotorInstruct(MotorInterface *motor, float frequency, Logger *logger, Configuration *config)
Constructor.
The Basic of a Motorinstructor.
MotorInterface Fawkes BlackBoard Interface.
virtual ~LinearMotorInstruct()
Destructor.
Interface for configuration handling.