Go to Post People were learning left and right. 14-year olds knew what a pitch diameter is... cool stuff. - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Electrical > CAN
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 11-01-2012, 23:58
ekgordon2 ekgordon2 is offline
Registered User
FRC #2022
 
Join Date: Jan 2012
Location: Buffalo Grove
Posts: 5
ekgordon2 is an unknown quantity at this point
CANJaguar timeout on cRIO startup

This is the third year out team is using CAN, but this problem has me stumped.

We just updated the firmware on a new black jaguar (v100 from ti.com/jaguar) and assigned it board ID 1. We have a new 4-slot cRIO imaged with the NI cRIO Imaging Tool, and we are using WindRiver C++ for programming with latest workbench/WPILib update from FIRSTForge.

The jaguar worked fine when controlled manually by BDC-COMM, but when connected to the cRIO, we are getting an error in sendMessage(), CANJaguar.cpp line 460: JaguarCANDriver timed out while waiting for a response.

Here is the code we used, basically the sample IterativeRobot with everything commented out:

Code:
#include "WPILib.h"
#include "CANJaguar.h"

class BuiltinDefaultCode : public IterativeRobot
{
	
	CANJaguar *motor;
	
	// Local variables to count the number of periodic loops performed
	UINT32 m_autoPeriodicLoops;
	UINT32 m_disabledPeriodicLoops;
	UINT32 m_telePeriodicLoops;
		
public:

	BuiltinDefaultCode(void)	{
		printf("BuiltinDefaultCode Constructor Started\n");

		// Initialize counters to record the number of loops completed in autonomous and teleop modes
		m_autoPeriodicLoops = 0;
		m_disabledPeriodicLoops = 0;
		m_telePeriodicLoops = 0;

		printf("BuiltinDefaultCode Constructor Completed\n");
	}
	
	
	/********************************** Init Routines *************************************/

	void RobotInit(void) {
		// Actions which would be performed once (and only once) upon initialization of the
		// robot would be put here.
		
		motor = new CANJaguar(1);
		
		printf("RobotInit() completed.\n");
	}
	
	void DisabledInit(void) {
		m_disabledPeriodicLoops = 0;			// Reset the loop counter for disabled mode
		
		// Move the cursor down a few, since we'll move it back up in periodic.
		printf("\x1b[2B");
	}

	void AutonomousInit(void) {
		m_autoPeriodicLoops = 0;				// Reset the loop counter for autonomous mode
		
	}

	void TeleopInit(void) {
		m_telePeriodicLoops = 0;				// Reset the loop counter for teleop mode
		
	}

	/********************************** Periodic Routines *************************************/
	
	void DisabledPeriodic(void)  {
		static INT32 printSec = (INT32)GetClock() + 1;
		static const INT32 startSec = (INT32)GetClock();


		// increment the number of disabled periodic loops completed
		m_disabledPeriodicLoops++;
		
		// while disabled, printout the duration of current disabled mode in seconds
		if (GetClock() > printSec) {
			// Move the cursor back to the previous line and clear it.
			printf("\x1b[1A\x1b[2K");
			printf("Disabled seconds: %d\r\n", printSec - startSec);			
			printSec++;
		}
	}

	void AutonomousPeriodic(void) {
		
		m_autoPeriodicLoops++;

		
	}

	
	void TeleopPeriodic(void) {
		// increment the number of teleop periodic loops completed
		m_telePeriodicLoops++;

		motor->Set(0.5);

	} // TeleopPeriodic(void)

};

START_ROBOT_CLASS(BuiltinDefaultCode);
We tried switching out CAN cables, re-imaging the cRIO, and rewriting firmware on the Jaguar. Oddly, PWM worked perfectly when we tested it out, only CAN is having problems.

Thanks in advance!
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 03:51.

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