It successfully build but the robot code is still red.
I tried a different laptop it worked but it didn’t move the robot. Can help help fix my errors.
include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <cstdlib>
#include <Joystick.h>
#include <RobotDrive.h>
#include <CANTalon.h>
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
//drive
myDrive = new RobotDrive (fL,fR,bR,bL);
myDrive->SetExpiration (1000);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
//Drive
if(stick->GetRawAxis(2) > .1)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0)); }
else if (stick->GetRawAxis(3) > .10)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0));
}
else
{
myDrive->SetLeftRightMotorOutputs(stick->GetRawAxis(0), -stick->GetRawAxis(0));
}
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//Drive Stuff
RobotDrive *myDrive;
CANTalon *fL = new CANTalon(15);
CANTalon *fR = new CANTalon(0);
CANTalon *bL = new CANTalon(14);
CANTalon *bR = new CANTalon(1);
//Joysticks
Joystick *stick = new Joystick (0);
};
START_ROBOT_CLASS(Robot)
include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <cstdlib>
#include <Joystick.h>
#include <RobotDrive.h>
#include <CANTalon.h>
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
//drive
myDrive = new RobotDrive (fL,fR,bR,bL);
myDrive->SetExpiration (1000);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
//Drive
if(stick->GetRawAxis(2) > .1)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0)); }
else if (stick->GetRawAxis(3) > .10)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0));
}
else
{
myDrive->SetLeftRightMotorOutputs(stick->GetRawAxis(0), -stick->GetRawAxis(0));
}
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//Drive Stuff
RobotDrive *myDrive;
CANTalon *fL = new CANTalon(15);
CANTalon *fR = new CANTalon(0);
CANTalon *bL = new CANTalon(14);
CANTalon *bR = new CANTalon(1);
//Joysticks
Joystick *stick = new Joystick (0);
};
START_ROBOT_CLASS(Robot)
What image have you loaded onto the roboRIO? What language are you using? Are you sure that the bytecode/binaries/LabView files were uploaded properly?
include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <cstdlib>
#include <Joystick.h>
#include <RobotDrive.h>
#include <CANTalon.h>
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
//drive
myDrive = new RobotDrive (fL,fR,bR,bL);
myDrive->SetExpiration (1000);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
//Drive
if(stick->GetRawAxis(2) > .1)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0)); }
else if (stick->GetRawAxis(3) > .10)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0));
}
else
{
myDrive->SetLeftRightMotorOutputs(stick->GetRawAxis(0), -stick->GetRawAxis(0));
}
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//Drive Stuff
RobotDrive *myDrive;
CANTalon *fL = new CANTalon(15);
CANTalon *fR = new CANTalon(0);
CANTalon *bL = new CANTalon(14);
CANTalon *bR = new CANTalon(1);
//Joysticks
Joystick *stick = new Joystick (0);
};
START_ROBOT_CLASS(Robot)
#include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <cstdlib>
#include <Joystick.h>
#include <RobotDrive.h>
#include <CANTalon.h>
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
//drive
myDrive = new RobotDrive (fL,fR,bR,bL);
myDrive->SetExpiration (0.1);
//invert motors
//fL->SetInverted(true);
//fR->SetInverted(true);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
//Drive
if(stick->GetRawAxis(2) > .1)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0)); }
else if (stick->GetRawAxis(3) > .10)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0));
}
else
{
myDrive->SetLeftRightMotorOutputs(stick->GetRawAxis(0), -stick->GetRawAxis(0));
}
myDrive->ArcadeDrive(stick, true);
//myDrive->ArcadeDrive(stick);
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//Drive Stuff
RobotDrive *myDrive;
CANTalon *fL = new CANTalon(15);
CANTalon *fR = new CANTalon(0);
CANTalon *bL = new CANTalon(14);
CANTalon *bR = new CANTalon(1);
//Joysticks
Joystick *stick = new Joystick (0);
};
START_ROBOT_CLASS(Robot)
#include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <cstdlib>
#include <Joystick.h>
#include <RobotDrive.h>
#include <CANTalon.h>
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
//drive
myDrive = new RobotDrive (fL,fR,bR,bL);
myDrive->SetExpiration (0.1);
//invert motors
//fL->SetInverted(true);
//fR->SetInverted(true);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
//Drive
if(stick->GetRawAxis(2) > .1)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0)); }
else if (stick->GetRawAxis(3) > .10)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0));
}
else
{
myDrive->SetLeftRightMotorOutputs(stick->GetRawAxis(0), -stick->GetRawAxis(0));
}
myDrive->ArcadeDrive(stick, true);
//myDrive->ArcadeDrive(stick);
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//Drive Stuff
RobotDrive *myDrive;
CANTalon *fL = new CANTalon(15);
CANTalon *fR = new CANTalon(0);
CANTalon *bL = new CANTalon(14);
CANTalon *bR = new CANTalon(1);
//Joysticks
Joystick *stick = new Joystick (0);
};
START_ROBOT_CLASS(Robot)
include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <cstdlib>
#include <Joystick.h>
#include <RobotDrive.h>
#include <CANTalon.h>
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
//drive
myDrive = new RobotDrive (fL,fR,bR,bL);
myDrive->SetExpiration (1000);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
//Drive
if(stick->GetRawAxis(2) > .1)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0)); }
else if (stick->GetRawAxis(3) > .10)
{
myDrive->Drive(stick->GetRawAxis(3)-stick->GetRawAxis(2), stick->GetRawAxis(0));
}
else
{
myDrive->SetLeftRightMotorOutputs(stick->GetRawAxis(0), -stick->GetRawAxis(0));
}
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//Drive Stuff
RobotDrive *myDrive;
CANTalon *fL = new CANTalon(15);
CANTalon *fR = new CANTalon(0);
CANTalon *bL = new CANTalon(14);
CANTalon *bR = new CANTalon(1);
//Joysticks
Joystick *stick = new Joystick (0);
};
START_ROBOT_CLASS(Robot)
I’m using c++, iterative,the talonsrx are flashing a orange and red light
If the Driver Station is reading a red light for Robot Code and the light is constantly red, it sounds like your binaries aren’t getting uploaded correctly. Are you using the Eclipse plugins for C++ to build and deploy your code? Are you able to SSH into your roboRIO?
If the code loads successfully, but the code light never goes green, then your code is crashing on startup. There’s nothing anyone can do to help if you don’t post your code.
#include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <CANTalon.h>
#include <Joystick.h>
#include “WPILib.h”
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
driverController = new Joystick(0);
operatorController = new Joystick(1);
fL = new CANTalon(15);
fR = new CANTalon(0);
bL = new CANTalon(14);
bR = new CANTalon(1);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
TankDrive(driverController->GetRawAxis(1), driverController->GetRawAxis(5));
}
void TankDrive(double left, double right)
{
fL->Set(left);
bL->Set(left);
fR->Set(right);
bR->Set(right);
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//set up
Joystick *operatorController, *driverController;
CANTalon *fL, *fR, *bL, *bR;
};
START_ROBOT_CLASS(Robot)
#include <iostream>
#include <memory>
#include <string>
#include <IterativeRobot.h>
#include <LiveWindow/LiveWindow.h>
#include <SmartDashboard/SendableChooser.h>
#include <SmartDashboard/SmartDashboard.h>
#include <CANTalon.h>
#include <Joystick.h>
class Robot: public frc::IterativeRobot {
public:
void RobotInit() {
driverController = new Joystick(0);
operatorController = new Joystick(1);
fL = new CANTalon(15);
fR = new CANTalon(0);
bL = new CANTalon(14);
bR = new CANTalon(1);
}
void AutonomousInit() override {
}
void AutonomousPeriodic() {
}
void TeleopInit() {
}
void TeleopPeriodic() {
TankDrive(driverController->GetRawAxis(1), driverController->GetRawAxis(5));
}
void TankDrive(double left, double right)
{
fL->Set(left);
bL->Set(left);
fR->Set(right);
bR->Set(right);
}
void TestPeriodic() {
lw->Run();
}
private:
frc::LiveWindow* lw = LiveWindow::GetInstance();
//set up
Joystick *operatorController, *driverController;
CANTalon *fL, *fR, *bL, *bR;
};
START_ROBOT_CLASS(Robot)
Joystick *operatorController, *driverController;
CANTalon *fL, *fR, *bL, *bR;
Pretty sure this isn’t suppose to be at the bottom. Forgive me if I am wrong, I haven’t touched C++ in a couple of months. It either belongs above RobotInit() or in RobotInit() (above all the declarations of course). What I think is happening is you are declaring that driverController is equal to a joystick without actually saying what driverController is beforehand. Again forgive me if I am wrong.
Also, is it normal for the talon srxs flashing a orange light, I was able to change the ids,but the talons are still orange
According to the table on page 32 of the SRX User Guide, the SRX is getting a CAN signal, but is disabled or not addressed. You can’t enable the robot until the code is running.
The code goes through. But when I enable the robot , the robot will not move
Check to make sure your (physical) controller is registered as controller 0 on your the driver station. And if it is controller 0, is the driver station picking up on its inputs?
The controller works but the talons remains orange
Did you plug in both (driver and operator) controllers? Do you have the 4 CAN Talons addressed with the CAN BUS ID’s shown in your program?