Skip to content

Commit

Permalink
Comandos de chutar e defender
Browse files Browse the repository at this point in the history
  • Loading branch information
felipepsaraiva committed Nov 8, 2019
1 parent 83db600 commit e0a57b5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/ServoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
ServoManager manager;

ServoManager::ServoManager(ManagerState start_state)
: servos{{BodyServo(RIGHT_ANKLE_ROLL, RIGHT_ANKLE_ROLL_ID, 0, 10, false),
: servos{{BodyServo(RIGHT_ANKLE_ROLL, RIGHT_ANKLE_ROLL_ID, 0, -20, false),
BodyServo(RIGHT_ANKLE_PITCH, RIGHT_ANKLE_PITCH_ID, 0, 0, true),
BodyServo(RIGHT_KNEE, RIGHT_KNEE_ID, 0, -20, false),
BodyServo(RIGHT_HIP_PITCH, RIGHT_HIP_PITCH_ID, 0, -5, false),
BodyServo(RIGHT_HIP_ROLL, RIGHT_HIP_ROLL_ID, 0, -30, false),
BodyServo(RIGHT_HIP_ROLL, RIGHT_HIP_ROLL_ID, 0, -90, false),
BodyServo(RIGHT_HIP_YAW, RIGHT_HIP_YAW_ID, 0, 0, true),
BodyServo(LEFT_ANKLE_ROLL, LEFT_ANKLE_ROLL_ID, 0, -60, false),
BodyServo(LEFT_ANKLE_ROLL, LEFT_ANKLE_ROLL_ID, 0, -50, false),
BodyServo(LEFT_ANKLE_PITCH, LEFT_ANKLE_PITCH_ID, 0, 10, true),
BodyServo(LEFT_KNEE, LEFT_KNEE_ID, 0, 0, false),
BodyServo(LEFT_HIP_PITCH, LEFT_HIP_PITCH_ID, 0, -40, false),
BodyServo(LEFT_HIP_ROLL, LEFT_HIP_ROLL_ID, 0, -15, false),
BodyServo(LEFT_HIP_YAW, LEFT_HIP_YAW_ID, 0, 0, true),
BodyServo(LEFT_ARM_PITCH, LEFT_ARM_PITCH_ID, 0, 0, false),
BodyServo(LEFT_ARM_YAW, LEFT_ARM_YAW_ID, 0, 0, false),
BodyServo(LEFT_ARM_ROLL, LEFT_ARM_ROLL_ID, 0, 0, false),
BodyServo(LEFT_ARM_ROLL, LEFT_ARM_ROLL_ID, 0, -20, false),
BodyServo(RIGHT_ARM_PITCH, RIGHT_ARM_PITCH_ID, 0, 0, false),
BodyServo(RIGHT_ARM_YAW, RIGHT_ARM_YAW_ID, 0, 0, false),
BodyServo(RIGHT_ARM_ROLL, RIGHT_ARM_ROLL_ID, 0, 0, false)}},
Expand Down
3 changes: 0 additions & 3 deletions src/extras/compliance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ void setup() {
SERIAL_SERVOS.setTimeout(20);

delay(3000);

for (auto servo : servos)
servo.setPosition(1024 / 2, 1);
}

bool updateServo(XYZrobotServo& servo) {
Expand Down
27 changes: 18 additions & 9 deletions src/peripherals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@

time_t btn_last_press[] = {0, 0, 0, 0, 0};

void run_button0_action() {
control.publish_command("reset");
manager.reset();
}
void run_button0_action() {}

// void run_button1_action() {
// control.publish_command(control.status.is_mode_manual ? "set_mode_auto"
// : "set_mode_manual");
// }

// void run_button2_action() {
// if (control.status.is_mode_manual)
// control.publish_command("walk");
// }

void run_button1_action() {
control.publish_command(control.status.is_mode_manual ? "set_mode_auto"
: "set_mode_manual");
control.publish_command("move kick_left");
}

void run_button2_action() {
if (control.status.is_mode_manual)
control.publish_command("walk");
control.publish_command("defend");
}

void run_button3_action() {}
void run_button3_action() {
// control.publish_command("move wave");
control.publish_command("reset");
manager.reset();
}

void run_button4_action() {
if (manager.get_state() == ManagerState::WaitServo) {
Expand Down

0 comments on commit e0a57b5

Please sign in to comment.