Using Victors with RobotDrive

The students put together a robot and used Victors because they were smaller and there were plenty of them lying around. I had them change the code from the SimpleRobot template to use victors but the victors didn’t run. They just blink like there is no communication.

I found this in the programming guide:
By default the RobotDrive class assumes that Jaguar speed controllers are used. To use Victor speed controllers, create the Victor objects then call the RobotDrive constructor passing it pointers or references to the Victor objects rather than port numbers.

The code looks like this. Shouldn’t this have worked? If code is OK, I am going to have them check the power to the digital sidecar. Note: the relay does work.


/**
 * This is a demo program showing the use of the RobotBase class.
 * The SimpleRobot class is the base of a robot application that will automatically call your
 * Autonomous and OperatorControl methods at the right time as controlled by the switches on
 * the driver station or the field controls.
 */ 
class RobotDemo : public SimpleRobot
{
    // use victors
	Victor victor1;
	Victor victor2;
	RobotDrive myRobot; // robot drive system
	Joystick stick1; // only joystick
	Joystick stick2;
	Relay dumpertilt;

public:
	RobotDemo(void):
		victor1(1),
		victor2(2), 
		//myRobot(1, 2),	//Jaguar
		myRobot(victor1,victor2),	// Victor 
		stick1(1),		// as they are declared above.
		stick2(2),
		dumpertilt(1)
	{
		myRobot.SetExpiration(0.1);
	}

	/**
	 * Drive left & right motors for 2 seconds then stop
	 */
	void Autonomous(void)
	{
		myRobot.SetSafetyEnabled(false);
		myRobot.Drive(-0.5, 0.0); 	// drive forwards half speed
		Wait(2.0); 				//    for 2 seconds
		myRobot.Drive(0.0, 0.0); 	// stop robot
	}

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		printf("In Operator Control 
");
		while (IsOperatorControl())
		{
			myRobot.TankDrive(stick1, stick2); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
		
			if (stick1.GetRawButton(8))
				dumpertilt.Set(Relay::kForward);
			else if (stick1.GetRawButton(9))
				dumpertilt.Set(Relay::kReverse);
			else
				dumpertilt.Set(Relay::kOff);
		}
	}
	
	/**
	 * Runs during test mode
	 */
	void Test() {

	}
};

START_ROBOT_CLASS(RobotDemo);


No, code-wise, that should work just fine.
Conventionally, things like that are passed in as pointers, but the constructor is overloaded such that it can take references instead, like you’re doing (with no functional difference).
The only thing I can think of would be modifying it to pass pointers.

myRobot(&victor1, &victor2),

But that really shouldn’t fix anything…

All your code looks good. Just check the PWM hookups on the sidecar, and the hookup of the ribbon cable. If the relay works fine, the problem is not with power going to the sidecar. Maybe check the wiring of the victors…