Merged master into logging, fixed conflicts. The logging's still terribad.
This commit is contained in:
commit
44eb125279
DriveBase/src
@ -14,14 +14,33 @@
|
||||
* This sample shows how to use the new CANTalon to just run a motor in a basic
|
||||
* throttle mode, in the same manner as you might control a traditional PWM
|
||||
* controlled motor.
|
||||
*
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
class Robot: public IterativeRobot
|
||||
{
|
||||
private:
|
||||
CANTalon r1_drive, r2_drive,
|
||||
l1_drive, l2_drive,
|
||||
shooter1, shooter2;
|
||||
=======
|
||||
|
||||
#ifndef BUTTON_LAYOUT
|
||||
#define BUTTON_LAYOUT
|
||||
|
||||
#define TRIGGER 0
|
||||
#define THUMB 1
|
||||
|
||||
#endif
|
||||
|
||||
class Robot: public IterativeRobot {
|
||||
CANTalon r1_drive;
|
||||
CANTalon r2_drive;
|
||||
CANTalon l1_drive;
|
||||
CANTalon l2_drive;
|
||||
CANTalon shooter1;
|
||||
CANTalon shooter2;
|
||||
CANTalon ramp;
|
||||
>>>>>>> master
|
||||
TankDrive drive;
|
||||
Shooter shooter;
|
||||
Joystick rstick, lstick;
|
||||
@ -44,10 +63,11 @@ public:
|
||||
l2_drive(4), // left wheel 2
|
||||
shooter1(10), // shooter drive 1
|
||||
shooter2(11), // shooter drive 2
|
||||
ramp(12),
|
||||
drive( // initialize TankDrive object.
|
||||
&l1_drive, &l2_drive, &r1_drive, &r2_drive),
|
||||
shooter( // initialize Shooter object.
|
||||
&shooter1, &shooter2),
|
||||
&shooter1, &shooter2, &ramp),
|
||||
rstick(0), // right stick (operator)
|
||||
lstick(1) // left stick (driver)
|
||||
{
|
||||
@ -75,10 +95,26 @@ public:
|
||||
drive.Drive(&lstick);
|
||||
|
||||
float power = (1.0 - rstick.GetThrottle()) / 2.0;
|
||||
//shooter1.Set(power);
|
||||
//shooter2.Set(power);
|
||||
shooter.SetPower(power);
|
||||
|
||||
//shooter.SetPower(power);
|
||||
if(rstick.GetRawButton(TRIGGER))
|
||||
{
|
||||
// SHOOT THE BALL
|
||||
ramp.Set(-0.5);
|
||||
}
|
||||
|
||||
if(rstick.GetRawButton(THUMB))
|
||||
{
|
||||
// lower the ramp
|
||||
ramp.Set(0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
// raise the ramp to HALF (so it isn't down all the time!)
|
||||
ramp.Set(0);
|
||||
}
|
||||
|
||||
// How to pickup?
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -8,22 +8,83 @@
|
||||
#ifndef SRC_SHOOTER_H_
|
||||
#define SRC_SHOOTER_H_
|
||||
|
||||
#define PICKUP_POWER 0.5
|
||||
#define RAMP_LOWER_DURATION 2 //Rotations.
|
||||
|
||||
|
||||
/**
|
||||
* You can use the values assigned to each of these values as the number
|
||||
* of rotations to run the motor down from the "Shoot" position.
|
||||
*
|
||||
* This might not be the best way to do it, and also requires that we
|
||||
* figure out how to read the Hall Effect signal from the motor.
|
||||
*/
|
||||
enum RampState {
|
||||
Shoot = 0, // 0 rotations
|
||||
Half = 1, // 1 rotation?
|
||||
Down = 2, // 2 rotations?
|
||||
Uncalibrated = -1
|
||||
};
|
||||
|
||||
class Shooter {
|
||||
public:
|
||||
Shooter(CANTalon *s1, CANTalon *s2) {
|
||||
/**
|
||||
* Shooter talons and ramp talon.
|
||||
* s2 is also for the pickup-mechanism and can be controlled independently.
|
||||
*
|
||||
*/
|
||||
Shooter(CANTalon *s1, CANTalon *s2, CANTalon *r) {
|
||||
shooterDrive = new RobotDrive(s1, s2);
|
||||
pickup = s2;
|
||||
ramp = r;
|
||||
rampState = Uncalibrated;
|
||||
}
|
||||
|
||||
virtual ~Shooter()
|
||||
{
|
||||
/**
|
||||
* Call this method on TeleopInit so that the ramp is properly
|
||||
* set at the beginning of the match.
|
||||
*/
|
||||
RampState CalibrateRamp() {
|
||||
// TODO:
|
||||
// Raise ramp until limit switch is triggered,
|
||||
// then lower the ramp to its lower limit.
|
||||
|
||||
return Down;
|
||||
}
|
||||
|
||||
virtual ~Shooter() {
|
||||
delete shooterDrive;
|
||||
delete pickup;
|
||||
delete ramp;
|
||||
}
|
||||
|
||||
void PickUp(bool state = true) {
|
||||
pickup->Set((float) (state * PICKUP_POWER));
|
||||
}
|
||||
|
||||
void SetRamp(RampState state) {
|
||||
// TODO:
|
||||
// Move the Ramp to the set position.
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to run the pickup backwards if the ball gets jammed somehow...
|
||||
*/
|
||||
void Unjam()
|
||||
{
|
||||
pickup->Set(-1 * PICKUP_POWER);
|
||||
}
|
||||
|
||||
void SetPower(float power) {
|
||||
shooterDrive->TankDrive(power, -power, false);
|
||||
}
|
||||
private:
|
||||
|
||||
RobotDrive *shooterDrive;
|
||||
CANTalon *pickup;
|
||||
CANTalon *ramp;
|
||||
|
||||
RampState rampState;
|
||||
};
|
||||
|
||||
#endif /* SRC_SHOOTER_H_ */
|
||||
|
@ -51,7 +51,8 @@ public:
|
||||
}
|
||||
|
||||
float speed = y * th;
|
||||
float rot = -x * th; // do some math here to smooth out turning?
|
||||
// TODO: do some math here to smooth out turning?
|
||||
float rot = x * th;
|
||||
|
||||
dt1->ArcadeDrive(speed, rot, false);
|
||||
dt2->ArcadeDrive(speed, rot, false);
|
||||
|
Reference in New Issue
Block a user