2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00

Minor drive/auto improvements

This commit is contained in:
Austen Adler 2015-02-15 17:54:59 -05:00
parent f01373de39
commit f6b6efacc5
6 changed files with 8 additions and 11 deletions

View File

@ -12,6 +12,7 @@ Autonomous::Autonomous(int seq){
case 0: case 0:
// Just for testing // Just for testing
AddSequential(new CollectTote()); AddSequential(new CollectTote());
AddSequential(new Turn());
//AddSequential(new Raise()); //AddSequential(new Raise());
//AddSequential(new Lower()); //AddSequential(new Lower());
//AddSequential(new Turn()); //AddSequential(new Turn());

View File

@ -3,13 +3,13 @@
// Drive for a short while then stop. Just for testing // Drive for a short while then stop. Just for testing
Turn::Turn() : Command("Turn"){ Turn::Turn() : Command("Turn"){
Requires(DentRobot::drivetrain); Requires(DentRobot::drivetrain);
SetTimeout(0.25); SetTimeout(0.85);
} }
void Turn::Initialize(){ void Turn::Initialize(){
} }
void Turn::Execute(){ void Turn::Execute(){
//X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro //X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle), gyro
DentRobot::drivetrain->DriveMecanum(0.0,0.0,0.5,0.9,0.0); DentRobot::drivetrain->DriveMecanum(0.0,0.0,1.0,0.9,0.0);
} }
bool Turn::IsFinished(){ bool Turn::IsFinished(){
return IsTimedOut(); return IsTimedOut();

View File

@ -3,11 +3,7 @@
#include "../Autonomous/AutoDrive.h" #include "../Autonomous/AutoDrive.h"
#include "RollIn.h" #include "RollIn.h"
CollectTote::CollectTote(){ CollectTote::CollectTote(){
AddParallel(new AutoDrive(0.5, -1.0)); AddParallel(new AutoDrive(1.0, -0.75));
AddSequential(new RollIn());
AddParallel(new AutoDrive(0.5, 1.0));
AddSequential(new RollIn());
AddParallel(new AutoDrive(0.5, -1.0));
AddSequential(new RollIn()); AddSequential(new RollIn());
} }
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

View File

@ -7,7 +7,7 @@ void RollIn::Initialize(){
} }
void RollIn::Execute(){ void RollIn::Execute(){
double throttle=DentRobot::oi->GetLeftThrottle(); double throttle=DentRobot::oi->GetLeftThrottle();
double cvt=throttle*DentRobot::collector->GetSonarDistance()/0.4/5; double cvt=throttle*DentRobot::collector->GetSonarDistance()/0.4;
if(cvt>=1.0){ if(cvt>=1.0){
DentRobot::collector->MoveRollers(1.0); DentRobot::collector->MoveRollers(1.0);
}else{ }else{

View File

@ -18,7 +18,7 @@ DentRobot::DentRobot(){
CameraServer::GetInstance()->StartAutomaticCapture("cam0"); CameraServer::GetInstance()->StartAutomaticCapture("cam0");
//SmartDashboard::PutNumber("Auto Wait Time", 1.0); //SmartDashboard::PutNumber("Auto Wait Time", 1.0);
//SmartDashboard::PutNumber("Auto Sequence", 0); //SmartDashboard::PutNumber("Auto Sequence", 0);
printf("Initialized"); printf("Initialized\n");
} }
void DentRobot::RobotInit(){ void DentRobot::RobotInit(){
//SmartDashboard::PutNumber("CodeVersion",0.001); //SmartDashboard::PutNumber("CodeVersion",0.001);

View File

@ -12,10 +12,10 @@ void Collector::InitDefaultCommand(){
} }
void Collector::MoveRollers(double a){ void Collector::MoveRollers(double a){
collectorMotorLeft->Set(a); collectorMotorLeft->Set(a);
collectorMotorBottom->Set(a); collectorMotorBottom->Set(-a);
collectorMotorRamp->Set(a); collectorMotorRamp->Set(a);
collectorMotorRight->Set(-a); collectorMotorRight->Set(-a);
printf("%f\n",GetSonarDistance()); printf("Roller power: %f\n",a);
} }
double Collector::GetSonarDistance(){ double Collector::GetSonarDistance(){
return sonarAnalog->GetAverageVoltage(); return sonarAnalog->GetAverageVoltage();