|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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);
Thanks in advance! |
|
#2
|
|||
|
|||
|
Re: CANJaguar timeout on cRIO startup
Are you using a 2CAN? Last year, we had CAN timeout errors when the 2CAN was plugged into the radio but not when plugged into the CRIO. I know the CRIO II only has 1 ethernet port. I asked elsewhere here on how to best configure it this year.
KC |
|
#3
|
|||
|
|||
|
Re: CANJaguar timeout on cRIO startup
Make sure your console out is off.
|
|
#4
|
||||
|
||||
|
Re: CANJaguar timeout on cRIO startup
Quote:
|
|
#5
|
|||
|
|||
|
Re: CANJaguar timeout on cRIO startup
Thanks! Turning off the console solved the problem.
BTW I was using Serial, not 2CAN. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|