Skip to content

Commit

Permalink
added dribbling to pivot line
Browse files Browse the repository at this point in the history
  • Loading branch information
sanatd33 committed Apr 7, 2024
1 parent 69bbfba commit fffff76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
11 changes: 0 additions & 11 deletions soccer/src/soccer/planning/planner/pivot_path_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ Trajectory PivotPathPlanner::plan(const PlanRequest& request) {
request.world_state->get_robot(true, request.shell_id).pose.position());
double target_angle = pivot_point.angle_to(final_position);
double angle_change = fix_angle_radians(target_angle - start_angle);
SPDLOG_INFO("Start Position: ({}, {})", request.world_state->get_robot(true, request.shell_id).pose.position().x(), request.world_state->get_robot(true, request.shell_id).pose.position().y());
SPDLOG_INFO("Pivot Point: ({}, {})", pivot_point.x(), pivot_point.y());
SPDLOG_INFO("Pivot Target: ({}, {})", pivot_target.x(), pivot_target.y());
SPDLOG_INFO("Final Position: ({}, {})", final_position.x(), final_position.y());
SPDLOG_INFO("Start Angle: {}", start_angle);
SPDLOG_INFO("Target Angle: {}", target_angle);
SPDLOG_INFO("Angle Change: {}", angle_change);
SPDLOG_INFO("----------------");

cached_angle_change_ = angle_change;

Expand Down Expand Up @@ -113,10 +105,7 @@ bool PivotPathPlanner::is_done() const {
if (!cached_angle_change_.has_value()) {
return false;
}
SPDLOG_INFO("checking is done, {}", cached_angle_change_.value());
bool val = abs(cached_angle_change_.value()) < degrees_to_radians(IS_DONE_ANGLE_CHANGE_THRESH);

Check warning on line 108 in soccer/src/soccer/planning/planner/pivot_path_planner.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

narrowing conversion from 'double' to 'float'
SPDLOG_INFO("Result: {}", val);
SPDLOG_INFO("----------------");
return val;
}

Expand Down
6 changes: 2 additions & 4 deletions soccer/src/soccer/strategy/agent/position/pivot_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ std::optional<RobotIntent> Pivot::derived_get_task(RobotIntent intent) {
// Get next state, and if different, reset clock
State new_state = next_state();
if (new_state != current_state_) {
SPDLOG_INFO("New State: {}", new_state);
curr_pt_ = last_world_state_->get_robot(true, robot_id_).pose.position();
}
current_state_ = new_state;
Expand All @@ -23,7 +22,6 @@ std::string Pivot::get_current_state() {

Pivot::State Pivot::next_state() {
// handle transitions between current state
SPDLOG_INFO("Current State: {}", current_state_);
switch (current_state_) {
case OUR_GOAL: {

Check warning on line 26 in soccer/src/soccer/strategy/agent/position/pivot_test.cpp

View workflow job for this annotation

GitHub Actions / build-and-test

switch has 2 consecutive identical branches
if (check_is_done()) {
Expand Down Expand Up @@ -53,17 +51,17 @@ Pivot::State Pivot::next_state() {
std::optional<RobotIntent> Pivot::state_to_task(RobotIntent intent) {
switch (current_state_) {
case OUR_GOAL: {
SPDLOG_INFO("COMMAND: Pivot to our goal");
planning::LinearMotionInstant target{field_dimensions_.our_goal_loc()};
auto pivot_cmd = planning::MotionCommand{"line_pivot", target, planning::FaceTarget{}, false, last_world_state_->ball.position};
intent.motion_command = pivot_cmd;
intent.dribbler_speed = 255.0;
return intent;
}
case OPP_GOAL: {
SPDLOG_INFO("COMMAND: Pivot to opp goal");
planning::LinearMotionInstant target{field_dimensions_.their_goal_loc()};
auto pivot_cmd = planning::MotionCommand{"line_pivot", target, planning::FaceTarget{}, false, last_world_state_->ball.position};
intent.motion_command = pivot_cmd;
intent.dribbler_speed = 255.0;
return intent;
}
case IDLE: {
Expand Down

0 comments on commit fffff76

Please sign in to comment.