Autonomous timeout

We are trying to program autonomous code for our robot and in our commands we have

    public turnLeft() {
        m_timeout = timeout;
        requires(chassis);
        

but the m_timeout = timeout; says that m_timeout has private access in edu.wpi.first.wpilibj.command.Command
cannot find symbol
symbol: variable timeout
location:class edu.wpi.first.wpilibj.templates.commands.turnLeft

any ideas as to why?
thanks.

Our (error-free) code looks like this –

public class TurnLeft extends CommandBase {
    
    private double m_timeout;
    private double m_speed;
    
    public TurnLeft(double speed, double timeout) {
        m_timeout = timeout;
        m_speed = speed;
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(drivetrain);
    }

Do you have any other code? Because I’m assuming you want to do the same thing that our code does, that is, turn left for the period of time put inside the parentheses when you call the command. To do that you need to make “timeout” a parameter in the TurnLeft method by using putting “double timeout” inside the parentheses. You also want to make m_timeout a variable inside the class, so make sure to put “private double m_timeout;” somewhere.

If you want you can just copy/paste my code in (remove the “speed” stuff) and see if it works.

This error means that the compiler is looking for a variable named “timeout” and can’t find it. I’m guessing you meant for timeout to be a parameter of the constructor, but forgot to actually put it in. The change is easy:

    public turnLeft(double timeout) {