Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ateam_kenobi/src/core/defense_area_enforcement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "defense_area_enforcement.hpp"
#include <ateam_geometry/ateam_geometry.hpp>
#include <ateam_common/robot_constants.hpp>
#include "core/motion/frame_conversions.hpp"

namespace ateam_kenobi::defense_area_enforcement
{
Expand Down Expand Up @@ -71,9 +72,11 @@ bool WouldVelocityCauseCollision(

const double delta_t = 0.01;

// TODO(barulicm): This ignores the velocity frame
const ateam_geometry::Vector velocity{motion_command.twist.linear.x,
ateam_geometry::Vector velocity{motion_command.twist.linear.x,
motion_command.twist.linear.y};
if (motion_command.twist_frame == ateam_msgs::msg::RobotMotionCommand::FRAME_BODY) {
velocity = ateam_kenobi::motion::LocalToWorldFrame(velocity, world.our_robots[robot_id]);
}

const ateam_geometry::Vector displacement = velocity * delta_t;

Expand Down
3 changes: 3 additions & 0 deletions ateam_kenobi/src/core/motion/motion_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ std::array<std::optional<BodyVelocity>,
},
[&](const intents::linear::VelocityIntent & v) {
body_velocity.linear = v.velocity;
if (v.frame == intents::linear::Frame::World) {
body_velocity.linear = WorldToLocalFrame(v.velocity, robot);
}
use_controller_linvel = false;
controller.reset_trajectory({robot.pos});
},
Expand Down
Loading