Go to Post I think there is much to be learned from working in teams, and team projects, but even more when you go out on your own some time for something you are truly passionate about. - paul_v [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-25-2014, 08:12 PM
Jceggbert5 Jceggbert5 is offline
Registered User
FRC #1825
 
Join Date: Feb 2013
Location: Terran
Posts: 5
Jceggbert5 is an unknown quantity at this point
Initialization issues with Talons.

This is our first year using C++. We've used LabView for the last several years, but our programming team finally made the switch for this season.

We're having an extremely weird issue with our code. We are using a mecanum drive system, and have not had issues until we attempted to add a fifth controller for our manipulator. We are using the RobotDrive class to initialize our first four controllers (using myRobot(1, 2, 3, 4) for init).

I attempted to add a fifth controller using this:
Code:
Talon shooter;

shooter = new Talon(6);
Once I deploy the code and reboot, every time I enable the robot (in either Teleop or in Autonomous), all the motors spin in reverse for about a quarter of a second and then disable.

For sake of troubleshooting, I tried removing all drive code and then reinitialize all the controllers manually as Talons. Once I did this, I cannot get the motors to spin at all. When I click Enable, the controllers enable for a split second and then disable. During that split second, I cannot give any value to the controllers, either directly in the code or by joystick input.

Anyone have any ideas?

Here's my full code:

Code:
#include "WPILib.h"
#include <math.h>

/**
 * This is a demo program showing the use of the RobotBase class.
 * The IterativeRobot class is the base of a robot application that will automatically call your
 * Periodic methods for each packet based on the mode.
 */ 
class RobotDemo : public IterativeRobot
{
	double joyX, joyY, joyZ;
	//RobotDrive myRobot; // robot drive system
	Jaguar  LF, LR, RF, RR, talonFive, shooter;
	Joystick stick; // only joystick
	Gyro fieldOrientation;

public:
	RobotDemo():
		//myRobot(1, 2, 3, 4),	// these must be initialized in the same order
		LF(1),
		LR(2),
		RF(3),
		RR(4),
		talonFive(5),
		shooter(6),
		stick(1),		// as they are declared above.
		fieldOrientation(1)
	{
		//myRobot.SetExpiration(0.1);
		//shooter.SetSafetyEnabled(false);
		//shooter.SetExpiration(0.1);
		this->SetPeriod(0); 	//Set update period to sync with robot control packets (20ms nominal)
	}
	
/**
 * Robot-wide initialization code should go here.
 * 
 * Use this method for default Robot-wide initialization which will
 * be called when the robot is first powered on.  It will be called exactly 1 time.
 */
void RobotDemo::RobotInit() {
}

/**
 * Initialization code for disabled mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters disabled mode. 
 */
void RobotDemo::DisabledInit() {
}

/**
 * Periodic code for disabled mode should go here.
 * 
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in disabled mode.
 */
void RobotDemo::DisabledPeriodic() {
}

/**
 * Initialization code for autonomous mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters autonomous mode.
 */
void RobotDemo::AutonomousInit() {
}

/**
 * Periodic code for autonomous mode should go here.
 *
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in autonomous mode.
 */
void RobotDemo::AutonomousPeriodic() {
}

/**
 * Initialization code for teleop mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters teleop mode.
 */
void RobotDemo::TeleopInit() {
	fieldOrientation.Reset();
}

/**
 * Periodic code for teleop mode should go here.
 *
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in teleop mode.
 */
void RobotDemo::TeleopPeriodic() {
	//myRobot.ArcadeDr1ive(stick); // drive with arcade style
	joyX = pow(stick.GetX(), 3);
	joyY = pow(stick.GetY(), 3);
	joyZ = pow(stick.GetRawAxis(3), 3);
	//myRobot.MecanumDrive_Cartesian(-joyX, -joyY, joyZ, fieldOrientation.GetAngle());
	
	//shooter.SetLeftRightMotorOutputs(pow(stick.GetRawAxis(4), 3), pow(stick.GetRawAxis(5), 3));
	LF.SetSpeed(pow(stick.GetRawAxis(5), 3));
	LR.SetSpeed(pow(stick.GetRawAxis(5), 3));
	RF.SetSpeed(pow(stick.GetRawAxis(5), 3));
	RR.SetSpeed(pow(stick.GetRawAxis(5), 3));
	talonFive.SetSpeed(pow(stick.GetRawAxis(5), 3));
	shooter.SetSpeed(pow(stick.GetRawAxis(5), 3));
}

/**
 * Initialization code for test mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters test mode.
 */
void RobotDemo::TestInit() {
}

/**
 * Periodic code for test mode should go here.
 *
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in test mode.
 */
void RobotDemo::TestPeriodic() {
}

};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote
  #2   Spotlight this post!  
Unread 01-25-2014, 09:42 PM
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 257
Jefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant future
Re: Initialization issues with Talons.

Check your power to the Digital Sidecar.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-25-2014, 10:30 PM
Jceggbert5 Jceggbert5 is offline
Registered User
FRC #1825
 
Join Date: Feb 2013
Location: Terran
Posts: 5
Jceggbert5 is an unknown quantity at this point
Re: Initialization issues with Talons.

Quote:
Originally Posted by Jefferson View Post
Check your power to the Digital Sidecar.
The 5V LED and Battery LED are on, 6V is off. RSL is functioning normally.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-25-2014, 10:46 PM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,547
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Initialization issues with Talons.

Quote:
Originally Posted by Jceggbert5 View Post
The 5V LED and Battery LED are on, 6V is off. RSL is functioning normally.
If the 6v LED isn't lit, there is definitely a problem. How many are lit if you remove the DB-37 cable?
Reply With Quote
  #5   Spotlight this post!  
Unread 01-25-2014, 10:53 PM
Jceggbert5 Jceggbert5 is offline
Registered User
FRC #1825
 
Join Date: Feb 2013
Location: Terran
Posts: 5
Jceggbert5 is an unknown quantity at this point
Re: Initialization issues with Talons.

Quote:
Originally Posted by Joe Ross View Post
If the 6v LED isn't lit, there is definitely a problem. How many are lit if you remove the DB-37 cable?
Not near the robot at present (will be on Monday and I'll answer your question). Why would that affect some code but not others?
Reply With Quote
  #6   Spotlight this post!  
Unread 01-25-2014, 10:57 PM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,547
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Initialization issues with Talons.

Quote:
Originally Posted by Jceggbert5 View Post
Not near the robot at present (will be on Monday and I'll answer your question). Why would that affect some code but not others?
The digital sidecar can receive leakage current through the DB-37 cable, which is enough for it to work in some cases, but not others. You should verify that the Digital Sidecar power is connected to a 20 amp breaker, and that all connections are good.
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2014, 01:50 AM
Jceggbert5 Jceggbert5 is offline
Registered User
FRC #1825
 
Join Date: Feb 2013
Location: Terran
Posts: 5
Jceggbert5 is an unknown quantity at this point
Re: Initialization issues with Talons.

Quote:
Originally Posted by Joe Ross View Post
The digital sidecar can receive leakage current through the DB-37 cable, which is enough for it to work in some cases, but not others. You should verify that the Digital Sidecar power is connected to a 20 amp breaker, and that all connections are good.
Sorry for taking so long to get back with you all, got caught up with other robot stuff.

The issue turned out to be a wiring issue with the Sidecar. It got wired to the regulated 5V out on the PDB... Oops.

Thank you all for your time and suggestions!
Reply With Quote
  #8   Spotlight this post!  
Unread 02-02-2014, 10:37 PM
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 257
Jefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant future
Re: Initialization issues with Talons.

I can promise you that y'all weren't the first team to do exactly that same thing this year. There is a reason I recognized the symptoms immediately.

lLad y'all got it fixed. Good luck.
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 09:51 AM.

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