-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial test of tigers system * clean up and add comment * added line test * fix line issue * made comments and removed from settle * Fix Code Style On intermediate-pathgen (#2267) automated style fixes Co-authored-by: sanatd33 <sanatd33@users.noreply.github.com> * make pr changes * add cache inter * start cacching intermediates * add params * use abs angle * Fix Code Style On intermediate-pathgen (#2269) automated style fixes Co-authored-by: sid-parikh <sid-parikh@users.noreply.github.com> --------- Co-authored-by: rishiso <rishisoni.5678@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: sanatd33 <sanatd33@users.noreply.github.com> Co-authored-by: petergarud <peter.garud04@gmail.com> Co-authored-by: sid-parikh <sid-parikh@users.noreply.github.com>
- Loading branch information
1 parent
fa89ee2
commit aea314c
Showing
11 changed files
with
282 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#include "line.hpp" | ||
|
||
namespace strategy { | ||
|
||
Line::Line(const Position& other) : Position{other} { position_name_ = "Line"; } | ||
|
||
Line::Line(int r_id) : Position{r_id, "Line"} {} | ||
|
||
std::optional<RobotIntent> Line::derived_get_task(RobotIntent intent) { | ||
if (check_is_done()) { | ||
forward_ = !forward_; | ||
} | ||
|
||
if (vertical_) { | ||
if (forward_) { | ||
auto motion_command = planning::MotionCommand{ | ||
"path_target", | ||
planning::LinearMotionInstant{ | ||
rj_geometry::Point{ | ||
field_dimensions_.center_field_loc().x() - (robot_id_ - 3) * 1, | ||
field_dimensions_.center_field_loc().y() - 2.5 + 5 * 0.75, | ||
}, | ||
rj_geometry::Point{0.0, 0.0}, | ||
}, | ||
planning::FaceTarget(), true}; | ||
|
||
intent.motion_command = motion_command; | ||
} else { | ||
auto motion_command = planning::MotionCommand{ | ||
"path_target", | ||
planning::LinearMotionInstant{ | ||
rj_geometry::Point{ | ||
field_dimensions_.center_field_loc().x() - (robot_id_ - 3) * 1, | ||
field_dimensions_.center_field_loc().y() - 4.5 + 5 * 0.75, | ||
}, | ||
rj_geometry::Point{0.0, 0.0}, | ||
}, | ||
planning::FaceTarget(), true}; | ||
|
||
intent.motion_command = motion_command; | ||
} | ||
} else { | ||
if (forward_) { | ||
if (face_target_) { | ||
auto motion_command = planning::MotionCommand{ | ||
"path_target", | ||
planning::LinearMotionInstant{ | ||
rj_geometry::Point{ | ||
field_dimensions_.center_field_loc().x() - 2.5 + 5 * 0.75, | ||
(field_dimensions_.center_field_loc().y() - 1) / 6 * robot_id_ + 1, | ||
}, | ||
rj_geometry::Point{0.0, 0.0}, | ||
}, | ||
planning::FaceTarget(), true}; | ||
|
||
intent.motion_command = motion_command; | ||
} else { | ||
auto motion_command = planning::MotionCommand{ | ||
"path_target", | ||
planning::LinearMotionInstant{ | ||
rj_geometry::Point{ | ||
field_dimensions_.our_defense_area().maxx(), | ||
(field_dimensions_.center_field_loc().y() - 1) / 6 * robot_id_ + 1, | ||
}, | ||
rj_geometry::Point{0.0, 0.0}, | ||
}, | ||
planning::FaceAngle{0}, true}; | ||
|
||
intent.motion_command = motion_command; | ||
} | ||
|
||
} else { | ||
if (face_target_) { | ||
auto motion_command = planning::MotionCommand{ | ||
"path_target", | ||
planning::LinearMotionInstant{ | ||
rj_geometry::Point{ | ||
field_dimensions_.our_defense_area().minx(), | ||
(field_dimensions_.center_field_loc().y() - 1) / 6 * robot_id_ + 1, | ||
}, | ||
rj_geometry::Point{0.0, 0.0}, | ||
}, | ||
planning::FaceTarget(), true}; | ||
|
||
intent.motion_command = motion_command; | ||
} else { | ||
auto motion_command = planning::MotionCommand{ | ||
"path_target", | ||
planning::LinearMotionInstant{ | ||
rj_geometry::Point{ | ||
field_dimensions_.our_defense_area().minx(), | ||
(field_dimensions_.center_field_loc().y() - 1) / 6 * robot_id_ + 1, | ||
}, | ||
rj_geometry::Point{0.0, 0.0}, | ||
}, | ||
planning::FaceAngle{0}, true}; | ||
|
||
intent.motion_command = motion_command; | ||
} | ||
} | ||
} | ||
|
||
return intent; | ||
} | ||
} // namespace strategy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <spdlog/spdlog.h> | ||
|
||
#include "position.hpp" | ||
#include "rclcpp/rclcpp.hpp" | ||
|
||
namespace strategy { | ||
class Line : public Position { | ||
public: | ||
Line(const Position& other); | ||
Line(int r_id); | ||
~Line() override = default; | ||
Line(const Line& other) = default; | ||
Line(Line&& other) = default; | ||
|
||
std::string get_current_state() override { return "Line"; } | ||
|
||
private: | ||
std::optional<RobotIntent> derived_get_task(RobotIntent intent) override; | ||
bool forward_ = true; | ||
bool vertical_ = false; | ||
bool face_target_ = false; | ||
}; | ||
} // namespace strategy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters