mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
Robot fully works
This commit is contained in:
parent
f8da6b1d22
commit
4c6e75969e
2
.env
2
.env
@ -7,7 +7,7 @@ function mc(){
|
||||
function mk(){
|
||||
vagrant ssh -c "cd /vagrant/src;make"
|
||||
}
|
||||
function md(){
|
||||
function me(){
|
||||
vagrant ssh -c "cd /vagrant/src;make deploy"
|
||||
}
|
||||
function ma(){
|
||||
|
@ -13,7 +13,7 @@ void AutoDrive::Execute(){
|
||||
DentRobot::drivetrain->DriveMecanum(0.5,0,0,0.9,0);
|
||||
}
|
||||
bool AutoDrive::IsFinished(){
|
||||
return false;
|
||||
return IsTimedOut();
|
||||
}
|
||||
void AutoDrive::End(){
|
||||
}
|
||||
|
@ -18,10 +18,6 @@ void Drive::Execute(){
|
||||
if (DentRobot::oi->GetLeftStick()->GetRawButton(2)){
|
||||
y=0;
|
||||
}
|
||||
if (DentRobot::oi->GetLeftStick()->GetRawAxis(3)<=0.5){
|
||||
y /= 2;
|
||||
z /= 2;
|
||||
}
|
||||
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro
|
||||
DentRobot::drivetrain->DriveMecanum(x,y,z,0.9,0);
|
||||
}
|
||||
|
@ -4,13 +4,14 @@
|
||||
Lower::Lower() : Command("Lower"){
|
||||
}
|
||||
void Lower::Initialize(){
|
||||
SetTimeout(2.0);
|
||||
SetTimeout(1.0);
|
||||
}
|
||||
void Lower::Execute(){
|
||||
DentRobot::elevator->Run((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
|
||||
DentRobot::elevator->Run(-1.0);
|
||||
}
|
||||
bool Lower::IsFinished(){
|
||||
if (DentRobot::elevator->GetElevatorBottom()||IsTimedOut()){
|
||||
if (!DentRobot::elevator->GetElevatorBottom()||IsTimedOut()){
|
||||
printf("Robot stoped lowering. Sensor based? %d\n", !DentRobot::elevator->GetElevatorBottom());
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
|
@ -4,13 +4,14 @@
|
||||
Raise::Raise() : Command("Raise"){
|
||||
}
|
||||
void Raise::Initialize(){
|
||||
SetTimeout(2.0);
|
||||
SetTimeout(2.5);
|
||||
}
|
||||
void Raise::Execute(){
|
||||
DentRobot::elevator->Run(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
|
||||
DentRobot::elevator->Run(1.0);
|
||||
}
|
||||
bool Raise::IsFinished(){
|
||||
if (DentRobot::elevator->GetElevatorTop()||IsTimedOut()){
|
||||
if (!DentRobot::elevator->GetElevatorTop()||IsTimedOut()){
|
||||
printf("Robot stoped raising. Sensor based? %d\n", !DentRobot::elevator->GetElevatorTop());
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
|
19
OI.cpp
19
OI.cpp
@ -7,21 +7,28 @@
|
||||
#include "Commands/Collector/ReleaseTote.h"
|
||||
|
||||
OI::OI() {
|
||||
// Joysticks
|
||||
leftStick=new Joystick(0);
|
||||
rightStick=new Joystick(1);
|
||||
//TODO name these buttons to their functions rather to their number
|
||||
|
||||
// Collector
|
||||
JoystickButton *right1=new JoystickButton(rightStick, 1);
|
||||
JoystickButton *right2=new JoystickButton(rightStick, 2);
|
||||
JoystickButton *left3=new JoystickButton(leftStick, 3);
|
||||
JoystickButton *left4=new JoystickButton(leftStick, 4);
|
||||
right1->WhileHeld(new OpenCollector());
|
||||
right2->WhileHeld(new CloseCollector());
|
||||
left3->WhileHeld(new CollectTote());
|
||||
left4->WhileHeld(new ReleaseTote());
|
||||
// Elevator
|
||||
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
||||
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
||||
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
||||
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
||||
right1->WhileHeld(new OpenCollector());
|
||||
right2->WhileHeld(new CloseCollector());
|
||||
right3->WhileHeld(new CollectTote());
|
||||
right4->WhileHeld(new ReleaseTote());
|
||||
right3->WhenPressed(new Lower());
|
||||
right4->WhenPressed(new Lower());
|
||||
right5->WhenPressed(new Raise());
|
||||
right6->WhenPressed(new Lower());
|
||||
right6->WhenPressed(new Raise());
|
||||
}
|
||||
Joystick* OI::GetRightStick(){
|
||||
return rightStick;
|
||||
|
Loading…
Reference in New Issue
Block a user