Skip to content

Commit

Permalink
Re-enable auton and implement basic inverse kinematics for the tank d…
Browse files Browse the repository at this point in the history
…rive
  • Loading branch information
sb-msoe committed Feb 19, 2022
1 parent 5e6d447 commit f5dfda2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/v5_hal/firmware/src/auton/auton_routines/BasicAuton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ BasicAuton::BasicAuton(IDriveNode* drive_node, IClawNode* claw_node) :
}

void BasicAuton::AddNodes() {
//m_forward_node = new AutonNode(10, new DriveStraightAction(m_drive_node, 1000, 10000, 10000));
m_forward_node = new AutonNode(10, new DriveStraightAction(m_drive_node, 24, 10000, 10000));
Auton::AddFirstNode(m_forward_node);


m_claw_close_node = new AutonNode(10, new UseClawAction(m_claw_node, false));
Auton::AddFirstNode(m_claw_close_node);
//m_claw_close_node = new AutonNode(10, new UseClawAction(m_claw_node, false));
//Auton::AddFirstNode(m_claw_close_node);
//m_forward_node->AddNext(m_claw_close_node);

m_backward_node = new AutonNode(10, new DriveStraightAction(m_drive_node, 800, 10000, 10000));
m_claw_close_node->AddNext(m_claw_close_node);
//m_backward_node = new AutonNode(10, new DriveStraightAction(m_drive_node, 800, 10000, 10000));
//m_claw_close_node->AddNext(m_claw_close_node);
}
6 changes: 3 additions & 3 deletions src/v5_hal/firmware/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ void autonomous() {
auton_manager_node->selected_auton->AutonInit();

// Execute autonomous code
//while (pros::competition::is_autonomous()) {
// node_manager->executeAuton();
//}
while (pros::competition::is_autonomous()) {
node_manager->executeAuton();
}
}

/**
Expand Down
6 changes: 5 additions & 1 deletion src/v5_hal/firmware/src/nodes/TankDriveNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ void TankDriveNode::setDriveVoltage(int x_voltage, int theta_voltage) {
}

void TankDriveNode::setDriveVelocity(float x_velocity, float theta_velocity) { //incoming values should be in m/s so we convert to rpm here
//
IDriveKinematics::FourMotorPercentages motor_percentages =
m_kinematics.inverseKinematics(x_velocity, 0, theta_velocity, MAX_VELOCITY);

m_setLeftVelocity(motor_percentages.left_front_percent * MAX_VELOCITY);
m_setRightVelocity(motor_percentages.right_front_percent * MAX_VELOCITY);
}

void TankDriveNode::teleopPeriodic() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AutonManagerNode::AutonManagerNode(NodeManager* node_manager, IDriveNode* drive_
m_drive_node(drive_node),
m_claw_node(claw_node) {
m_basic_auton = new BasicAuton(m_drive_node, m_claw_node);
//selected_auton = m_basic_auton;
selected_auton = m_basic_auton;
}

void AutonManagerNode::initialize() {
Expand Down

0 comments on commit f5dfda2

Please sign in to comment.