Go to Post "How do we make our team be like your team?" That's the sort of question everyone should be asking of these so-called "elite" or "powerhouse" teams. - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 01-02-2013, 00:41
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 357
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
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.
Code:
/**
 * 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 \n");
		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);
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi