Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Seeking #2160

Merged
merged 25 commits into from
Jan 31, 2024
Merged

Adding Seeking #2160

merged 25 commits into from
Jan 31, 2024

Conversation

sanatd33
Copy link
Contributor

Description

Adds seeking functionality to offense which makes idle robots try to 'get open'.

Associated / Resolved Issue

Resolves https://app.clickup.com/t/86aytmv75

Steps to Test

  1. make run-sim
  2. Move opposition robots between the ball and our team robot

Expected result: Idle robots should be moving around the field to get open

Key Files to Review

  • offense.cpp

Review Checklist

  • Docstrings: All methods and classes should have the file appropriate docstrings which follow the guidelines in the "Contributing" page of our docs.
  • Remove extra print statements: Any print statements used for debugging should be removed
  • Tag reviewers: Tag some people for review and ping them on Slack

(Optional) Sub-issues (for drafts)

Note: if you find yourself breaking this PR into many smaller features, it may make sense to break up the PR into logical units based on these features.

  • Step 1
  • Step 2

automated style fixes

Co-authored-by: sanatd33 <[email protected]>
Copy link
Contributor

@sid-parikh sid-parikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey this looks generally good but can we refactor seeking into a RoleInterface? As much as I dislike RoleInterface this is a lot of code to put straight into this file. Could also use a little more commenting maybe some docs-style stuff explaining what each function does.

automated style fixes

Co-authored-by: sanatd33 <[email protected]>
@sanatd33 sanatd33 requested a review from sid-parikh January 24, 2024 01:25
Copy link
Contributor

@sid-parikh sid-parikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note all the GH action warnings. I left more constructive comments that should resolve all them, but double-check before your next submission. you can ignore the cognitive complexity one for now

* The Seeking role provides the implementation for a offensive robot that
* is trying to get open, so that they can receive a pass
*/
class Seeking : public RoleInterface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call this Seeker

* is trying to get open, so that they can receive a pass
*/
class Seeking : public RoleInterface {
public:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the GH action warning: explicitly =default the other four required ctors/operators see "rule of five" section here https://en.cppreference.com/w/cpp/language/rule_of_three or ask me for more info

// The seeker's id
int robot_id_;
// The taret point to move to
rj_geometry::Point target_pt{0.0, 0.0};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_pt_

*/
rj_geometry::Point get_open_point(const WorldState* world_state,
rj_geometry::Point current_position,
FieldDimensions field_dimensions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FieldDimensions field_dimensions);
FieldDimensions field_dimensions) const;

*/
rj_geometry::Point get_open_point(const WorldState* world_state,
rj_geometry::Point current_position,
FieldDimensions field_dimensions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FieldDimensions field_dimensions);
const FieldDimensions& field_dimensions);

*
* @return rj_geometry::Point The best point found
*/
rj_geometry::Point calculate_open_point(double current_prec, double min_prec,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same changes as before

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also for both of these member fns make them static if they don't use any members

*
* @return rj_geometry::Point The corrected point
*/
rj_geometry::Point correct_point(rj_geometry::Point point, FieldDimensions field_dimensions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as last two

*
* @return double The evaluation of that target point
*/
double eval_point(rj_geometry::Point ball_pos, rj_geometry::Point current_point,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

sanatd33 and others added 9 commits January 28, 2024 20:37
automated style fixes

Co-authored-by: sanatd33 <[email protected]>
Added hard-coded robot positions in main_window reset method
* added play state to plan request

* Fix style

* Fix Code Style On add-play-state-to-plan-request (#2166)

automated style fixes

Co-authored-by: sid-parikh <[email protected]>

---------

Co-authored-by: Sid Parikh <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: sid-parikh <[email protected]>
github-actions bot and others added 2 commits January 28, 2024 20:49
@sanatd33 sanatd33 requested a review from sid-parikh January 29, 2024 02:05
@sid-parikh
Copy link
Contributor

hey @sanatd33 you re-requested my review but didn't address many of the comments from the previous review. please take a look at those when you get a chance.

@sid-parikh sid-parikh merged commit 0324315 into ros2 Jan 31, 2024
2 checks passed
@sid-parikh sid-parikh deleted the seeking-test branch January 31, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants