Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ce89e2c
wip ball placement improvements
mkhlb Jun 5, 2024
1b5ab3c
Made move tactic only terminate when dribbler is not on release, made…
mkhlb Jun 26, 2024
d079f30
Added new speed mode for ball placement retreats
mkhlb Jun 26, 2024
a19c461
Merge branch 'master' of github.com:UBC-Thunderbots/Software into fie…
mkhlb Jun 29, 2024
bde271a
ball placement tweaks
mkhlb Jun 29, 2024
091cedf
Tuned motion planning, adjusted field test
mkhlb Jul 5, 2024
971dcce
Merge branch 'UBC-Thunderbots:master' into field_testing_june_4
mkhlb Jul 5, 2024
82cd14e
Merge branch 'field_testing_june_4' of github.com:mkhlb/Software into…
mkhlb Jul 5, 2024
a1b00b1
Reverted some changes made for debugging
mkhlb Jul 5, 2024
a18b940
Wrote comments
mkhlb Jul 8, 2024
7d0a80e
Split dribble speed modes into 2
mkhlb Jul 8, 2024
d37546c
Addressed more arune notes
mkhlb Jul 8, 2024
7583480
Removed a debug log
mkhlb Jul 8, 2024
74dbdb3
Fixed issue where the robot wouldn't exist the wall align state where…
mkhlb Jul 8, 2024
ca99bc9
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Jul 8, 2024
4d83ab8
Teehee
mkhlb Jul 8, 2024
90b1f62
Merge remote-tracking branch 'origin/field_testing_june_4' into field…
mkhlb Jul 8, 2024
4f305fc
Merge branch 'master' of github.com:UBC-Thunderbots/Software into fie…
mkhlb Jul 8, 2024
d1a6d4e
Addressed some more notes
mkhlb Jul 15, 2024
4644b4d
Added constants
mkhlb Jul 15, 2024
45c98d5
Changed constant names
mkhlb Jul 15, 2024
9940e3e
Fixed ball placement play test failing
mkhlb Jul 15, 2024
7be4c25
Merge upstream
mkhlb Jul 15, 2024
3e462dd
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Jul 15, 2024
7966dd1
cleaned up fsm logic
mkhlb Jul 15, 2024
2f620b0
Merge remote-tracking branch 'origin/field_testing_june_4' into field…
mkhlb Jul 15, 2024
5354608
Removed old constant
mkhlb Jul 15, 2024
93141a1
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Jul 15, 2024
6d725f4
Merge branch 'master' of https://github.com/UBC-Thunderbots/Software …
TryErr04 Mar 1, 2025
66fbd98
Merge conflict fixes
TryErr04 Mar 1, 2025
ada9c31
Fix problems with ball placement play
TryErr04 Mar 2, 2025
f622aad
Code cleanup
williamckha Mar 8, 2025
d457672
Merge branch 'master' of https://github.com/UBC-Thunderbots/Software …
williamckha Mar 8, 2025
6ac0045
Remove change to logger.h
williamckha Mar 8, 2025
1dd1bb5
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Mar 8, 2025
0935d6e
Merge branch 'master' of https://github.com/UBC-Thunderbots/Software …
williamckha Jan 9, 2026
5a082fb
Addressed some comments + code cleanup
williamckha Jan 10, 2026
31c4281
Merge branch 'master' of github.com:UBC-Thunderbots/Software into bal…
Apeiros-46B Feb 11, 2026
ce857e1
Use saturating arithmetic in ball placement play to avoid underflow
Apeiros-46B Feb 11, 2026
0f77793
Add some more tests
Apeiros-46B Feb 23, 2026
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
26 changes: 15 additions & 11 deletions docs/fsm-diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,24 @@ stateDiagram-v2
classDef terminate fill:white,color:black,font-weight:bold
direction LR
[*] --> StartState
StartState --> AlignPlacementState : [!shouldKickOffWall]\n<i>alignPlacement</i>
StartState --> KickOffWallState : [shouldKickOffWall]
KickOffWallState --> KickOffWallState : [!kickDone && shouldKickOffWall]\n<i>kickOffWall</i>
KickOffWallState --> KickOffWallState : [kickDone]
KickOffWallState --> AlignPlacementState : [!kickDone]
AlignPlacementState --> KickOffWallState : [shouldKickOffWall]
StartState --> AlignPlacementState : [!shouldPickOffWall]\n<i>alignPlacement</i>
StartState --> AlignWallState : [shouldPickOffWall]\n<i>alignWall</i>
AlignWallState --> AlignWallState : [!wallAlignDone && shouldPickOffWall]\n<i>alignWall</i>
AlignWallState --> PickOffWallState : [wallAlignDone]\n<i>setPickOffDest, pickOffWall</i>
AlignWallState --> AlignPlacementState : [!shouldPickOffWall]\n<i>alignPlacement</i>
PickOffWallState --> PickOffWallState : [!wallPickOffDone]\n<i>pickOffWall</i>
PickOffWallState --> ReleaseBallState : [wallPickOffDone]\n<i>startWait</i>
AlignPlacementState --> AlignWallState : [shouldPickOffWall]\n<i>alignWall</i>
AlignPlacementState --> AlignPlacementState : [!alignDone]\n<i>alignPlacement</i>
AlignPlacementState --> PlaceBallState : [alignDone]
AlignPlacementState --> PlaceBallState : [alignDone]\n<i>placeBall</i>
PlaceBallState --> PlaceBallState : [!ballPlaced]\n<i>placeBall</i>
PlaceBallState --> WaitState : [ballPlaced]\n<i>startWait</i>
WaitState --> WaitState : [!waitDone]
WaitState --> RetreatState : [waitDone]
PlaceBallState --> ReleaseBallState : [ballPlaced]\n<i>startWait</i>
ReleaseBallState --> ReleaseBallState : [!waitDone && ballPlaced]\n<i>releaseBall</i>
ReleaseBallState --> StartState : [!ballPlaced]
ReleaseBallState --> RetreatState : [waitDone]\n<i>retreat</i>
RetreatState --> Terminate:::terminate : [retreatDone && ballPlaced]
RetreatState --> RetreatState : [ballPlaced]\n<i>retreat</i>
RetreatState --> StartState : [!ballPlaced]

```

Expand Down Expand Up @@ -403,7 +407,7 @@ direction LR
MoveState --> MoveState : [!moveDone]\n<i>updateMove</i>
MoveState --> Terminate:::terminate : [moveDone]\n<i>updateMove</i>
Terminate:::terminate --> MoveState : [!moveDone]\n<i>updateMove</i>
Terminate:::terminate --> Terminate:::terminate : <i>updateMove</i>
Terminate:::terminate --> Terminate:::terminate : <i>SET_STOP_PRIMITIVE_ACTION</i>

```

Expand Down
2 changes: 1 addition & 1 deletion src/cli/cli_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ class Platform(str, Enum):

EnableThunderscopeOption = Annotated[bool, Option("-t", "--enable_thunderscope")]
EnableVisualizerOption = Annotated[bool, Option("-v", "--enable_visualizer")]
StopAIOnStartOption = Annotated[bool, Option("-t", "--stop_ai_on_start")]
StopAIOnStartOption = Annotated[bool, Option("-s", "--stop_ai_on_start")]
8 changes: 8 additions & 0 deletions src/proto/message_translation/tbots_protobuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ int convertDribblerModeToDribblerSpeed(TbotsProto::DribblerMode dribbler_mode,
return robot_constants.max_force_dribbler_speed_rpm;
case TbotsProto::DribblerMode::OFF:
return 0;
case TbotsProto::DribblerMode::RELEASE_BALL_SLOW:
return robot_constants.release_ball_dribbler_speed_rpm;
default:
LOG(WARNING) << "DribblerMode is invalid" << std::endl;
return 0;
Expand All @@ -518,6 +520,12 @@ double convertMaxAllowedSpeedModeToMaxAllowedSpeed(
STOP_COMMAND_SPEED_SAFETY_MARGIN_METERS_PER_SECOND;
case TbotsProto::MaxAllowedSpeedMode::COLLISIONS_ALLOWED:
return COLLISION_ALLOWED_ROBOT_MAX_SPEED_METERS_PER_SECOND;
case TbotsProto::MaxAllowedSpeedMode::BALL_PLACEMENT_RETREAT:
return robot_constants.ball_placement_retreat_max_speed_m_per_s;
case TbotsProto::MaxAllowedSpeedMode::BALL_PLACEMENT_WALL_DRIBBLE:
return robot_constants.ball_placement_wall_max_speed_m_per_s;
case TbotsProto::MaxAllowedSpeedMode::DRIBBLE:
return robot_constants.dribble_speed_m_per_s;
default:
LOG(WARNING) << "MaxAllowedSpeedMode is invalid" << std::endl;
return 0.0;
Expand Down
9 changes: 8 additions & 1 deletion src/proto/parameters.proto
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ message SensorFusionConfig

// Number of dropped detections before we consider the ball not to be in the dribbler
required int32 num_dropped_detections_before_ball_not_in_dribbler = 12
[default = 3, (bounds).min_int_value = 0, (bounds).max_int_value = 1000];
[default = 10, (bounds).min_int_value = 0, (bounds).max_int_value = 1000];

// Possession tracker for determining which team has possession of the ball
required PossessionTrackerConfig possession_tracker_config = 13;
Expand Down Expand Up @@ -562,6 +562,13 @@ message RobotNavigationObstacleConfig
// robot's position for obstacle avoidance
required double dynamic_enemy_robot_obstacle_horizon_sec = 4
[default = 0.4, (bounds).min_double_value = 0.0, (bounds).max_double_value = 2.0];

// Additional amount to inflate ball obstacle by for extra safety
required double additional_ball_obstacle_inflation_meters = 5 [
default = 0.05,
(bounds).min_double_value = 0.0,
(bounds).max_double_value = 0.5
];
}

message CostVisualizationConfig
Expand Down
13 changes: 10 additions & 3 deletions src/proto/primitive.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ enum MotionConstraint

enum DribblerMode
{
OFF = 0;
INDEFINITE = 1;
MAX_FORCE = 2;
OFF = 0;
INDEFINITE = 1;
MAX_FORCE = 2;
RELEASE_BALL_SLOW = 3;
}

enum MaxAllowedSpeedMode
Expand All @@ -70,6 +71,12 @@ enum MaxAllowedSpeedMode
STOP_COMMAND = 1;
// Move at speed at which collisions are allowed
COLLISIONS_ALLOWED = 2;
// Slow speed for retreating in ball placement
BALL_PLACEMENT_RETREAT = 3;
// Slow speed for picking the ball off the wall in ball placement
BALL_PLACEMENT_WALL_DRIBBLE = 4;
// Slower speed for dribbling
DRIBBLE = 5;
}

message AutoChipOrKick
Expand Down
14 changes: 9 additions & 5 deletions src/shared/2021_robot_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ RobotConstants_t create2021RobotConstants(void)
.front_of_robot_width_meters = 0.11f,
.dribbler_width_meters = 0.07825f,
// Dribbler speeds are negative as that is the direction that sucks the ball in
.indefinite_dribbler_speed_rpm = -10000,
.max_force_dribbler_speed_rpm = -12000,
.indefinite_dribbler_speed_rpm = -10000,
.max_force_dribbler_speed_rpm = -12000,
.release_ball_dribbler_speed_rpm = 2000,

// Motor constant
.motor_max_acceleration_m_per_s_2 = 4.5f,

// Robot's linear movement constants
.robot_max_speed_m_per_s = 3.000f,
.robot_max_acceleration_m_per_s_2 = 3.0f,
.robot_max_deceleration_m_per_s_2 = 3.0f,
.robot_max_speed_m_per_s = 3.000f,
.ball_placement_wall_max_speed_m_per_s = 0.3f,
.ball_placement_retreat_max_speed_m_per_s = 0.3f,
.dribble_speed_m_per_s = 1.5f,
.robot_max_acceleration_m_per_s_2 = 3.0f,
.robot_max_deceleration_m_per_s_2 = 3.0f,

// Robot's angular movement constants
.robot_max_ang_speed_rad_per_s = 10.0f,
Expand Down
16 changes: 8 additions & 8 deletions src/shared/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,25 @@ static const short unsigned int MAXIMUM_TRANSFER_UNIT_BYTES = 1500;
/* Game Rules */
// The max allowed speed of the ball, in metres per second
// https://robocup-ssl.github.io/ssl-rules/sslrules.html#_ball_speed
static const double BALL_MAX_SPEED_METERS_PER_SECOND = 6.5;
static constexpr double BALL_MAX_SPEED_METERS_PER_SECOND = 6.5;
// The safe max speed of the ball that we should shoot at, in metres per second
static const double BALL_SAFE_MAX_SPEED_METERS_PER_SECOND =
static constexpr double BALL_SAFE_MAX_SPEED_METERS_PER_SECOND =
BALL_MAX_SPEED_METERS_PER_SECOND - 0.5;
// The distance that the ball has to travel for it to be considered in play
// after a kick-off, free kick, or penalty kick.
// https://robocup-ssl.github.io/ssl-rules/sslrules.html#_ball_in_and_out_of_play
static const double BALL_IN_PLAY_DISTANCE_THRESHOLD_METERS = 0.05;
static constexpr double BALL_IN_PLAY_DISTANCE_THRESHOLD_METERS = 0.05;
// The max allowed height of the robots, in metres
static const double ROBOT_MAX_HEIGHT_METERS = 0.15;
static constexpr double ROBOT_MAX_HEIGHT_METERS = 0.15;
// The max allowed radius of the robots, in metres
static const double ROBOT_MAX_RADIUS_METERS = 0.09;
static constexpr double ROBOT_MAX_RADIUS_METERS = 0.09;
// The distance from the center of the robot to the front face (the flat part), in meters
static const double DIST_TO_FRONT_OF_ROBOT_METERS = 0.078;
static constexpr double DIST_TO_FRONT_OF_ROBOT_METERS = 0.078;
// The approximate radius of the ball according to the SSL rulebook
static const double BALL_MAX_RADIUS_METERS = 0.0215;
static constexpr double BALL_MAX_RADIUS_METERS = 0.0215;
// According to the rules, 80% of the ball must be seen at all times. Robots may not
// cover more than 20% of the ball
static const double MAX_FRACTION_OF_BALL_COVERED_BY_ROBOT = 0.2;
static constexpr double MAX_FRACTION_OF_BALL_COVERED_BY_ROBOT = 0.2;

// The radius of a circle region where ball placement is acceptable (in meters).
constexpr double BALL_PLACEMENT_TOLERANCE_RADIUS_METERS = 0.15;
Expand Down
13 changes: 13 additions & 0 deletions src/shared/robot_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,25 @@ typedef struct RobotConstants
// the ball [rpm]
int max_force_dribbler_speed_rpm;

// Speed at which to spin the dribbler to release the ball right in front of a
// stationary robot [rpm]
int release_ball_dribbler_speed_rpm;

// The maximum acceleration achievable by our motors [m/s^2]
float motor_max_acceleration_m_per_s_2;

// The maximum speed achievable by our robots, in metres per second [m/s]
float robot_max_speed_m_per_s;

// The max speed at which we will pick the ball off the wall
float ball_placement_wall_max_speed_m_per_s;

// The max speed at which we will retreat away from the ball after placing it [m/s]
float ball_placement_retreat_max_speed_m_per_s;

// The max speed at which we dribble the ball
float dribble_speed_m_per_s;

// The maximum acceleration achievable by our robots [m/s^2]
float robot_max_acceleration_m_per_s_2;

Expand Down
Loading