3#include <const_shared/MotionConst.hpp>
4#include <action_msg_srv_shared/order_codes.hpp>
32 static void atomic_move(int64_t left_ticks, int64_t right_ticks) {
34 double cos_angle = cos(
angle_);
35 double sin_angle = sin(
angle_);
36 if(SIGN(left_ticks) == SIGN(right_ticks)) {
37 double c_ticks = SIGN(left_ticks) * MIN(ABS(left_ticks), ABS(right_ticks));
38 double dl = c_ticks * TICKS_TO_MM;
39 x += (dl * cos_angle);
40 y += (dl * sin_angle);
41 dbeta = (
robot ==
Robot::MASTER ? TICKS_TO_RADIANS_MASTER : TICKS_TO_RADIANS_SLAVE) * (left_ticks - right_ticks);
42 }
else if(left_ticks < 0 && right_ticks >= 0) {
43 double alpha = MIN(ABS(left_ticks), ABS(right_ticks)) * (
robot ==
Robot::MASTER ? TICKS_TO_RADIANS_HALF_BASE_MASTER : TICKS_TO_RADIANS_HALF_BASE_SLAVE);
45 dbeta = -(
robot ==
Robot::MASTER ? TICKS_TO_RADIANS_MASTER : TICKS_TO_RADIANS_SLAVE) * ABS(ABS(left_ticks) - ABS(right_ticks));
46 }
else if(left_ticks >= 0 && right_ticks < 0) {
47 double alpha = MIN(ABS(left_ticks), ABS(right_ticks)) * (
robot ==
Robot::MASTER ? TICKS_TO_RADIANS_HALF_BASE_MASTER : TICKS_TO_RADIANS_HALF_BASE_SLAVE);
49 dbeta = (
robot ==
Robot::MASTER ? TICKS_TO_RADIANS_MASTER : TICKS_TO_RADIANS_SLAVE) * ABS(ABS(left_ticks) - ABS(right_ticks));
52 double dr = dbeta * (
robot ==
Robot::MASTER ? WHEEL_DISTANCE_MASTER / 2 : WHEEL_DISTANCE_SLAVE / 2);
53 x += dr * (1 - dbeta * dbeta / 2);
55 double theta = ABS(
angle_) - 2 * M_PI * ((int) (ABS(
angle_) / (2 * M_PI)));
Robot
Definition: RobotStatus.hpp:13
Team
Definition: RobotStatus.hpp:7
Definition: RobotStatus.hpp:19
static Robot robot
Definition: RobotStatus.hpp:29
static Team team
Definition: RobotStatus.hpp:28
static double angle
Definition: RobotStatus.hpp:27
static double y
Definition: RobotStatus.hpp:25
static double angle_
Definition: RobotStatus.hpp:26
static void atomic_move(int64_t left_ticks, int64_t right_ticks)
Definition: RobotStatus.hpp:32
static double x
Definition: RobotStatus.hpp:24