Skip to content

Commit

Permalink
Introduce Calibration state (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: Gijs de Jong <[email protected]>
  • Loading branch information
Fyor and oxkitsune authored Jun 25, 2023
1 parent 29be852 commit e4e77aa
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 4 deletions.
11 changes: 11 additions & 0 deletions crates/control/src/behavior/calibrate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use types::{MotionCommand, PrimaryState, WorldState};

pub fn execute(world_state: &WorldState) -> Option<MotionCommand> {
match world_state.robot.primary_state {
PrimaryState::Calibration => Some(MotionCommand::Stand {
head: types::HeadMotion::ZeroAngles,
is_energy_saving: false,
}),
_ => None,
}
}
1 change: 1 addition & 0 deletions crates/control/src/behavior/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod calibrate;
mod defend;
mod dribble;
mod fall_safely;
Expand Down
3 changes: 3 additions & 0 deletions crates/control/src/behavior/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use types::{
};

use super::{
calibrate,
defend::Defend,
dribble, fall_safely,
head::LookAction,
Expand Down Expand Up @@ -97,6 +98,7 @@ impl Behavior {
Action::FallSafely,
Action::StandUp,
Action::Stand,
Action::Calibrate,
];

if let Some(active_since) = self.active_since {
Expand Down Expand Up @@ -184,6 +186,7 @@ impl Behavior {
Action::StandUp => stand_up::execute(world_state),
Action::Stand => stand::execute(world_state, context.field_dimensions),
Action::LookAround => look_around::execute(world_state),
Action::Calibrate => calibrate::execute(world_state),
Action::DefendGoal => defend.goal(&mut context.path_obstacles),
Action::DefendKickOff => defend.kick_off(&mut context.path_obstacles),
Action::DefendLeft => defend.left(&mut context.path_obstacles),
Expand Down
4 changes: 4 additions & 0 deletions crates/control/src/localization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ impl Localization {
);
Some(*context.robot_to_field)
}
(PrimaryState::Calibration, _) => {
*context.robot_to_field = Isometry2::identity();
Some(*context.robot_to_field)
}
_ => None,
};
Ok(MainOutputs {
Expand Down
1 change: 1 addition & 0 deletions crates/types/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub enum Action {
StandUp,
Stand,
LookAround,
Calibrate,
Dribble,
DefendGoal,
DefendKickOff,
Expand Down
10 changes: 8 additions & 2 deletions etc/configuration/head.P0000074A03S83I00027.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"disable_communication_acceptor": true,
"player_number": "Two"
"camera_matrix_parameters": {
"vision_top": {
"extrinsic_rotations": [
0.7900000214576721, -3.119999885559082, 0.7400000095367432
]
}
},
"player_number": "One"
}
10 changes: 8 additions & 2 deletions etc/configuration/head.P0000074A04S8C700011.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"disable_communication_acceptor": true,
"player_number": "Three"
"camera_matrix_parameters": {
"vision_top": {
"extrinsic_rotations": [
0.03999999910593033, -3.009999990463257, 1.2999999523162842
]
}
},
"player_number": "Two"
}

0 comments on commit e4e77aa

Please sign in to comment.