Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8b1aa38
first steps
shourikb Apr 21, 2025
ef5bc01
added required messages for marking
shourikb Apr 21, 2025
74e7956
more setup
shourikb Apr 21, 2025
a5487ae
fixed some stuff
shourikb Apr 21, 2025
dfe621e
added a dangerous score array to keep track of valid targets
shourikb Apr 21, 2025
01e4436
made some progress
shourikb Apr 22, 2025
6301a5b
danger score calcs
Squid5678 Apr 26, 2025
c85f542
more marking stuff
Squid5678 Apr 26, 2025
e83d402
update naming
Squid5678 Apr 26, 2025
b501fe6
can leave marking
Squid5678 Apr 26, 2025
ded69ac
fixed linker error
Squid5678 Apr 26, 2025
20b41d0
started client
Squid5678 Apr 26, 2025
787f99b
marking client should be done
Squid5678 Apr 26, 2025
32f8860
started on danger score calculation
petergarud Apr 27, 2025
64ef7d4
marking coordaintor should be done'
petergarud Apr 28, 2025
15f1b61
Struct of coordinators: compiles but fails to run at all
petergarud Apr 30, 2025
267f9bd
Fix issue with not running
petergarud Sep 1, 2025
30e54f6
starting implementing coordaintor with defense
petergarud Sep 1, 2025
86e538a
added some more stuff to implement marking into the defense state mac…
shourikb Sep 3, 2025
c740b5e
some debugging done. marks now, but sim crashes
shourikb Sep 3, 2025
68ce933
stuff
petergarud Sep 8, 2025
245cfd4
fixed it so it compiles
shourikb Sep 14, 2025
1d6c90d
Stuff
petergarud Sep 15, 2025
a6c207a
rebase to ros2 to have colcon
sanatd33 Sep 29, 2025
b653fd7
stuff
petergarud Oct 13, 2025
5477bf5
New danger score parameters
petergarud Oct 26, 2025
e2b8c4e
Merge from ros2
petergarud Oct 26, 2025
f070f8a
Danger angle change
petergarud Oct 27, 2025
2f1354a
doesn't mark the guy with the ball anymore
shourikb Oct 29, 2025
ac18cc7
completed marking coordinator
shourikb Oct 29, 2025
a53480b
cleaned up a little
shourikb Oct 29, 2025
3914d60
Fix Code Style On marking-coordinator (#2447)
github-actions[bot] Nov 3, 2025
3073ef6
Resolve merge comments
petergarud Nov 3, 2025
9207a0c
Resolve comments
petergarud Nov 10, 2025
d916b5a
Fix Code Style On marking-coordinator (#2452)
github-actions[bot] Nov 10, 2025
8de5768
fix client handles
sanatd33 Nov 12, 2025
0ce1e25
Fix Code Style On marking-coordinator (#2454)
github-actions[bot] Nov 12, 2025
e79fb8e
addressed most comments but still missing some callback stuff (check …
shourikb Nov 12, 2025
1fc4831
Fix Code Style On marking-coordinator (#2457)
github-actions[bot] Nov 16, 2025
22d0b1b
fixed some more comments
shourikb Nov 19, 2025
88daaec
Merge branch 'marking-coordinator' of https://github.com/RoboJackets/…
shourikb Nov 19, 2025
7b1c468
More fixes
shourikb Nov 19, 2025
498f016
addressed all comments
shourikb Nov 24, 2025
dd5a402
Add client handles implementation
petergarud Nov 24, 2025
5e2cc4d
Fix Code Style On marking-coordinator (#2472)
github-actions[bot] Nov 24, 2025
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
2 changes: 1 addition & 1 deletion install/setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ COLCON_CURRENT_PREFIX="$(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null
_colcon_prefix_chain_bash_source_script "$COLCON_CURRENT_PREFIX/local_setup.bash"

unset COLCON_CURRENT_PREFIX
unset _colcon_prefix_chain_bash_source_script
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove these changes from the commit (same for install/setup.zsh)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think anything got changed here. Looks like just removed then added the line back.

unset _colcon_prefix_chain_bash_source_script
2 changes: 1 addition & 1 deletion install/setup.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ COLCON_CURRENT_PREFIX="$(builtin cd -q "`dirname "${(%):-%N}"`" > /dev/null && p
_colcon_prefix_chain_zsh_source_script "$COLCON_CURRENT_PREFIX/local_setup.zsh"

unset COLCON_CURRENT_PREFIX
unset _colcon_prefix_chain_zsh_source_script
unset _colcon_prefix_chain_zsh_source_script
7 changes: 7 additions & 0 deletions launch/soccer.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ def generate_launch_description():
output="screen",
parameters=[param_config_filepath],
on_exit=Shutdown(),
),
Node(
package="rj_strategy",
executable="marking_node",
output="screen",
parameters=[param_config_filepath],
on_exit=Shutdown(),
)
]
)
12 changes: 12 additions & 0 deletions rj_gameplay/rj_gameplay.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Metadata-Version: 2.1
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove the rj_gameplay stuff from your commit too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Name: rj-gameplay
Version: 0.0.0
Summary: Rewrite of the gameplay library.
Home-page: UNKNOWN
Maintainer: oswinso
Maintainer-email: [email protected]
License: UNKNOWN
Platform: UNKNOWN

UNKNOWN

90 changes: 90 additions & 0 deletions rj_gameplay/rj_gameplay.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
README.md
setup.cfg
setup.py
rj_gameplay/__init__.py
rj_gameplay/gameplay_node.py
rj_gameplay/play_selector.py
rj_gameplay.egg-info/PKG-INFO
rj_gameplay.egg-info/SOURCES.txt
rj_gameplay.egg-info/dependency_links.txt
rj_gameplay.egg-info/entry_points.txt
rj_gameplay.egg-info/requires.txt
rj_gameplay.egg-info/top_level.txt
rj_gameplay.egg-info/zip-safe
rj_gameplay/eval/__init__.py
rj_gameplay/play/__init__.py
rj_gameplay/play/defend_restart.py
rj_gameplay/play/defense.py
rj_gameplay/play/defensive_clear.py
rj_gameplay/play/keepaway.py
rj_gameplay/play/kickoff_play.py
rj_gameplay/play/offense.py
rj_gameplay/play/penalty_defense.py
rj_gameplay/play/penalty_offense.py
rj_gameplay/play/prep_penalty_offense.py
rj_gameplay/play/restart.py
rj_gameplay/play/test_motion_planning.py
rj_gameplay/role/__init__.py
rj_gameplay/role/capture_role.py
rj_gameplay/role/dumb_move.py
rj_gameplay/role/goalie_role.py
rj_gameplay/role/marker.py
rj_gameplay/role/passer.py
rj_gameplay/role/receiver.py
rj_gameplay/role/seeker.py
rj_gameplay/role/striker.py
rj_gameplay/situation/__init__.py
rj_gameplay/situation/decision_tree/__init__.py
rj_gameplay/situation/decision_tree/plays.py
rj_gameplay/skill/__init__.py
rj_gameplay/skill/capture.py
rj_gameplay/skill/dribble.py
rj_gameplay/skill/intercept.py
rj_gameplay/skill/kick.py
rj_gameplay/skill/line_kick.py
rj_gameplay/skill/mark.py
rj_gameplay/skill/move.py
rj_gameplay/skill/pivot.py
rj_gameplay/skill/pivot_kick.py
rj_gameplay/skill/receive.py
rj_gameplay/skill/settle.py
rj_gameplay/tactic/__init__.py
rj_gameplay/tactic/clear_tactic.py
rj_gameplay/tactic/dumb_tactic.py
rj_gameplay/tactic/goalie_tactic.py
rj_gameplay/tactic/line_tactic.py
rj_gameplay/tactic/move_tactic.py
rj_gameplay/tactic/nmark_tactic.py
rj_gameplay/tactic/pass_tactic.py
rj_gameplay/tactic/prep_move.py
rj_gameplay/tactic/seek.py
rj_gameplay/tactic/striker_tactic.py
rj_gameplay/tactic/wall_tactic.py
stp/__init__.py
stp/global_parameters.py
stp/local_parameters.py
stp/pylint_stp.py
stp/rc.py
stp/testing.py
stp/action/__init__.py
stp/formations/__init__.py
stp/formations/diamond_formation.py
stp/formations/x_formation.py
stp/play/__init__.py
stp/play/pure_play.py
stp/role/__init__.py
stp/role/constraint.py
stp/role/cost.py
stp/role/assignment/__init__.py
stp/role/assignment/naive.py
stp/situation/__init__.py
stp/skill/__init__.py
stp/skill/action_behavior.py
stp/tactic/__init__.py
stp/utils/__init__.py
stp/utils/constants.py
stp/utils/enum.py
stp/utils/fsm.py
stp/utils/pass_seeker_optimizer.py
stp/utils/typed_key_dict.py
stp/utils/world_state_converter.py
1 change: 1 addition & 0 deletions rj_gameplay/rj_gameplay.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions rj_gameplay/rj_gameplay.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[console_scripts]
gameplay_node = rj_gameplay.gameplay_node:main

1 change: 1 addition & 0 deletions rj_gameplay/rj_gameplay.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setuptools
2 changes: 2 additions & 0 deletions rj_gameplay/rj_gameplay.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rj_gameplay
stp
1 change: 1 addition & 0 deletions rj_gameplay/rj_gameplay.egg-info/zip-safe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions src/rj_constants/include/rj_constants/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/// all weights in kilograms

// Number of identifiable robots on one team
// IF U CHANGE THIS NUMBER CHECK Marking.msg
inline constexpr size_t kNumShells = 16;

// Number of playing robots on one team
Expand Down
2 changes: 2 additions & 0 deletions src/rj_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ rosidl_generate_interfaces(

# Coordinators
msg/KickerPicker.msg
msg/Marking.msg

# Agent Request Messages
request/JoinWallRequest.msg
Expand All @@ -84,6 +85,7 @@ rosidl_generate_interfaces(
# Services
srv/AgentCommunication.srv
srv/KickerPicker.srv
srv/Marking.srv
srv/ListJoysticks.srv
srv/PlanHypotheticalPath.srv
srv/QuickCommands.srv
Expand Down
2 changes: 2 additions & 0 deletions src/rj_msgs/msg/Marking.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This is a message to pick a robot to mark
uint8[16] mark_robot_ids # ID of the robot to mark on the opposing team
5 changes: 5 additions & 0 deletions src/rj_msgs/srv/Marking.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Request a robot to be added to or removed from the marking group
uint8 robot_id # ID of the robot (0 to kNumShells-1)
bool join
---
bool success # Always true
21 changes: 19 additions & 2 deletions src/rj_strategy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ set(RJ_STRATEGY_SRC
src/agent/position/goalie.cpp
src/agent/position/idle.cpp
src/agent/position/line.cpp
src/agent/position/marker.cpp
src/agent/position/offense.cpp
src/agent/position/penalty_non_kicker.cpp
src/agent/position/penalty_player.cpp
Expand All @@ -64,6 +63,7 @@ set(RJ_STRATEGY_SRC

# Coordinators
src/coordinator/kicker_picker_client.cpp
src/coordinator/marking_client.cpp
)

# rj_strategy library
Expand Down Expand Up @@ -115,6 +115,23 @@ ament_target_dependencies(kicker_picker_node
${RJ_STRATEGY_DEPS}
)

# Marking Node
add_executable(marking_node
${RJ_STRATEGY_SRC}
src/coordinator/marking_client.cpp
src/coordinator/marking.cpp
)

target_include_directories(marking_node
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

ament_target_dependencies(marking_node
${RJ_STRATEGY_DEPS}
)

# Agent Action Clients
add_executable(agent_action_clients
${RJ_STRATEGY_SRC}
Expand Down Expand Up @@ -146,7 +163,7 @@ install(
)

install(
TARGETS straight_line_test_node kicker_picker_node agent_action_clients
TARGETS straight_line_test_node kicker_picker_node marking_node agent_action_clients
DESTINATION lib/${PROJECT_NAME}
)

Expand Down
9 changes: 9 additions & 0 deletions src/rj_strategy/include/rj_strategy/agent/position.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,20 @@
#include <rj_msgs/msg/position_request.hpp>
#include <rj_msgs/msg/test_response.hpp>

// Coordinators
#include "rj_strategy/coordinator/kicker_picker_client.hpp"
#include "rj_strategy/coordinator/marking_client.hpp"

// tell compiler this class exists, but no need to import the whole header
class AgentActionClient;

namespace strategy {

struct ClientHandles {
std::unique_ptr<KickerPickerClient> kickerPickerClient;
std::unique_ptr<MarkingClient> markingClient;
};

/*
* Position is an abstract superclass. Its subclasses handle strategy logic.
* The goal is to isolate the strategy logic from the ROS interfacing. This
Expand Down
17 changes: 11 additions & 6 deletions src/rj_strategy/include/rj_strategy/agent/position/defense.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#include <rj_msgs/action/robot_move.hpp>

#include "rj_strategy/agent/position.hpp"
#include "rj_strategy/agent/position/marker.hpp"
#include "rj_strategy/agent/position/waller.hpp"

namespace strategy {

/*
Expand All @@ -28,6 +26,8 @@ namespace strategy {
class Defense : public Position {
public:
Defense(int r_id);
Defense(int r_id, std::shared_ptr<ClientHandles> clientHandles);
Copy link
Contributor

Choose a reason for hiding this comment

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

ClientHandles seems to play a very large part in the implementation of coordinators going forward. I'm in agreement with Sanat here that we could find a solution in the future, but I am also on the side that if this works, we should not change it and finish off the coordinator design.

It would be nice if we could have a doc created on the purpose of these ClientHandles. Nothing too crazy, just explaining the purpose and where they should be used.

Defense(const Position& other, std::shared_ptr<ClientHandles> clientHandles);
~Defense() override = default;
Defense(const Position& other);

Expand All @@ -45,8 +45,8 @@ class Defense : public Position {

private:
// static constexpr int kMaxWallers{6};
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this out-of-date comment with kMaxWallers = 6

static constexpr int kMaxWallers{
static_cast<int>(kNumShells)}; // This effectively turns off marking
static constexpr int kMaxWallers{2};
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be changed into a constant

// static_cast<int>(kNumShells)}; // This effectively turns off marking

/**
* @brief The derived_get_task method returns the task for the defensive robot
Expand Down Expand Up @@ -120,8 +120,13 @@ class Defense : public Position {
int get_waller_id();
State current_state_ = JOINING_WALL;

int get_marker_target_id();
Marker marker_;
bool sent_join_marking_group_request_ = false;
RJ::Time request_time_;
RJ::Seconds kMarkingGroupJoinTimeout{2.0}; // 2 seconds
Copy link
Contributor

Choose a reason for hiding this comment

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

make this a constant as well in case needs to be tuned later


bool pending_marking_state_ = false;

std::shared_ptr<ClientHandles> clientHandles_;
};

} // namespace strategy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace strategy {
class FreeKicker : public Position {
public:
FreeKicker(int r_id);
FreeKicker(int r_id, std::shared_ptr<ClientHandles> clientHandles);
FreeKicker(const Position& other, std::shared_ptr<ClientHandles> clientHandles);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider making clientHandles part of Position instead of adding to every specific position? If we are doing it this way, would it make sense to only pass the clients it actually needs rather than a struct with all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried doing this in the past and remember encountering a lot of weird errors. I think there are a lot of places that end up expecting to have some definition of clienthandles (b/c included in position) but it's hard to pass one in. I tried again just now and still getting a lot of weird errors. I can try to debug but I think it would just take a long time and this approach already works so I would prefer to move on.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just got a fix for this working, i can either add it to this PR or just make a new one after this gets merged, up to you @petergarud

FreeKicker(const Position&);
~FreeKicker() = default;

Expand All @@ -38,6 +40,7 @@ class FreeKicker : public Position {

private:
std::optional<RobotIntent> derived_get_task(RobotIntent intent) override;
std::shared_ptr<ClientHandles> clientHandles_;
};

} // namespace strategy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class GoalKicker : public Position {
public:
GoalKicker(int r_id);
~GoalKicker() = default;
GoalKicker(int r_id, std::shared_ptr<ClientHandles> clientHandles);

/**
* @brief Does nothing; this position is a special case
Expand All @@ -39,6 +40,8 @@ class GoalKicker : public Position {

private:
std::optional<RobotIntent> derived_get_task(RobotIntent intent) override;

std::shared_ptr<ClientHandles> clientHandles_;
};

} // namespace strategy
} // namespace strategy
4 changes: 4 additions & 0 deletions src/rj_strategy/include/rj_strategy/agent/position/goalie.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace strategy {
class Goalie : public Position {
public:
Goalie(int r_id);
Goalie(int r_id, std::shared_ptr<ClientHandles> clientHandles);
Goalie(const Position& other, std::shared_ptr<ClientHandles> clientHandles);
~Goalie() override = default;
Goalie(const Position& other);

Expand Down Expand Up @@ -87,6 +89,8 @@ class Goalie : public Position {
State latest_state_ = IDLING;

rj_geometry::Point penalty_location();

std::shared_ptr<ClientHandles> clientHandles_;
};

} // namespace strategy
4 changes: 4 additions & 0 deletions src/rj_strategy/include/rj_strategy/agent/position/idle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Idle : public Position {
Idle(int r_id);
~Idle() = default;
Idle(const Position& other);
Idle(int r_id, std::shared_ptr<ClientHandles> clientHandles);
Idle(const Position& other, std::shared_ptr<ClientHandles> clientHandles);

/**
* @brief Does nothing; this position is a special case
Expand All @@ -28,5 +30,7 @@ class Idle : public Position {

private:
std::optional<RobotIntent> derived_get_task(RobotIntent intent) override;

std::shared_ptr<ClientHandles> clientHandles_;
};
} // namespace strategy
Loading
Loading