View Single Post
  #5   Spotlight this post!  
Unread 02-02-2016, 03:10 PM
snekiam snekiam is online now
Registered User
FRC #3322 (Eagle Imperium)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2010
Location: SE Michigan
Posts: 84
snekiam has a spectacular aura aboutsnekiam has a spectacular aura aboutsnekiam has a spectacular aura about
Re: CAN Talon not working after disabling robot and re-enabling

teleop periodic:
Code:
void Robot::TeleopPeriodic() {
	Scheduler::GetInstance()->Run();	
Robot::drivetrain->robotDrive->ArcadeDrive(Robot::oi->driveStick
->GetX(),Robot::oi->driveStick->GetRawAxis(4));
}
Robot map:
Code:
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX1;
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX2;
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX3;
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX4;
std::shared_ptr<RobotDrive> RobotMap::drivetrainRobotDrive;

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION

void RobotMap::init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    LiveWindow *lw = LiveWindow::GetInstance();

    drivetraindriveSRX1.reset(new CANTalon(0));
    lw->AddActuator("Drivetrain", "driveSRX1", drivetraindriveSRX1);
    
    drivetraindriveSRX2.reset(new CANTalon(1));
    lw->AddActuator("Drivetrain", "driveSRX2", drivetraindriveSRX2);
    
    drivetraindriveSRX3.reset(new CANTalon(2));
    lw->AddActuator("Drivetrain", "driveSRX3", drivetraindriveSRX3);
    
    drivetraindriveSRX4.reset(new CANTalon(3));
    lw->AddActuator("Drivetrain", "driveSRX4", drivetraindriveSRX4);
    
    drivetrainRobotDrive.reset(new RobotDrive(drivetraindriveSRX1, drivetraindriveSRX2,
              drivetraindriveSRX3, drivetraindriveSRX4));
    
    drivetrainRobotDrive->SetSafetyEnabled(true);
        drivetrainRobotDrive->SetExpiration(0.1);
        drivetrainRobotDrive->SetSensitivity(0.5);
        drivetrainRobotDrive->SetMaxOutput(1.0);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kRearLeftMotor, true);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kFrontRightMotor, true);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kRearRightMotor, true);


    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
All talons are up to date

Last edited by snekiam : 02-02-2016 at 03:15 PM. Reason: accidental partial submission at first
Reply With Quote