Go to Post I do this stuff because...well first inspired me to become me. I now understand who i am better and what i want to do. - Marygrace [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

 
Reply
Thread Tools Rate Thread Display Modes
  #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: 358
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
  #2   Spotlight this post!  
Unread 01-02-2013, 09:24
nightpool's Avatar
nightpool nightpool is offline
robotRectifier
AKA: Evan
no team (formerly of CORE 2062)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Waukesha, WI
Posts: 81
nightpool is on a distinguished road
Re: Using Victors with RobotDrive

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.
Code:
myRobot(&victor1, &victor2),
But that really shouldn't fix anything...
__________________
Proud alum of CORE 2062.
www.core2062.com
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2013, 09:37
Toa Circuit's Avatar
Toa Circuit Toa Circuit is offline
Thaddeus Maximus
AKA: Thad Hughes
FRC #4213 (MetalCow Robotics)
Team Role: Leadership
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Shirley, IL
Posts: 131
Toa Circuit is an unknown quantity at this point
Re: Using Victors with RobotDrive

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...
__________________

2012 Head of Programming and Electrical
2013-14 Overall Team Captain and Programming Head
2012-14 Mentor of FLL Team Power Surge
2014 Dean's List Finalist
2014 CIR Xerox Creativity Award
Webpage
Reply With Quote
Reply


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 14:03.

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