Error of startcompetition method

when I try to deploy code to the robot rio, vscode shows the success of deploy. But when i try to start my robot, drivestation tells me that the code have not deployed, and then the vscode show me this erroe.

the stack Trace reports you have problems in Robot.java line 47 and in DriveSubsystem.java line 24.
Can you please post the code in these lines?
Also, the stacktrace reports you have a HAL: resource already allocated exception. You probably instantiated multiple VictoSP objects on the same channel.

package frc.robot.subsystems;

import frc.robot.commands.*;

import edu.wpi.first.wpilibj.command.Subsystem;

import edu.wpi.first.wpilibj.SpeedControllerGroup;

import edu.wpi.first.wpilibj.VictorSP;

import edu.wpi.first.wpilibj.drive.DifferentialDrive;

public class DriveSubsystem extends Subsystem {

VictorSP m_frontLeft = new VictorSP(0);

VictorSP m_backLeft = new VictorSP(1);

SpeedControllerGroup m_left = new SpeedControllerGroup(m_frontLeft, m_backLeft);

VictorSP m_frontRight = new VictorSP(2);

VictorSP m_backRight = new VictorSP(3);

SpeedControllerGroup m_right = new SpeedControllerGroup(m_frontRight, m_backRight);

DifferentialDrive m_drive = new DifferentialDrive(m_left, m_right);

@Override

public void initDefaultCommand() {

setDefaultCommand(new Drivecommand());

}

}

this is the code of drivesubststem.java

the error occur when i declare VictorSP

Please attach the code of Robot.java line 47.

i think i may find the mistake
i declare m_drive twice
thanks

Yes, you’re right. You’re double-declaring VictorSP motor controllers, thus assigning them already assigned PWM channels.
However, please note that if you’re using the new Command-based framework, you should declare your subsystems in RobotContainer.java. You can read more about that here. But it seems you’re using the old framework.

thanks


i am sorry to border you again, i still a rooky programers
why there are error of this.
I can successfully deploy my code.
Thanks

In your drive command, right under wherever you are setting effort on your motors, call

m_drive.feed();

Recommendation for the future, its best if you could upload your entire program to github and link it, since, we can better diagnose your issues if we can see all your code.

As for your Output not Updated Error, how is your Drivecommand command setting your DriveSubsystem's motors? You should be using your DifferentialDrive m_drive object and not setting your two VictorSP objects directly.

we’d need to see your Drivecommand class, and whatever methods Drivecommand is calling in your DriveSubsystem.

1 Like

This won’t help, since feed is called when setting the motors by WPILib. Most likely the problem is that the motors aren’t being set, which is what gixxy’s line of questioning will solve.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.