PDA

View Full Version : CAN user code fails to load


unobtainium-42
02-17-2010, 10:43 PM
When I use #include "../CANJaguar/CANJaguar.h" and try to use the CANJaguar class the code crashes:

task 0x1319f60 (wtxC5124tmp) deleted: errno=196709 (0x30065) status=45106 (0xb032)
-> FPGA Hardware GUID: 0xAD9A5591CC64E4DF756D77D1B57A549E
FPGA Software GUID: 0xAD9A5591CC64E4DF756D77D1B57A549E
FPGA Hardware Version: 2010
FPGA Software Version: 2010
FPGA Hardware Revision: 1.3.0
FPGA Software Revision: 1.3.0
* Loading StartupDlls: FRC_BlackJagBridgePlugin
FRC_BlackJagBridgePlugin was compiled from SVN revision 10
task 0x1d6ae78 (t2) deleted: errno=0 (0) status=0 (0)
* Loading StartupDlls: FRC_UserProgram

NI-VISA Server 4.5 started successfully.
task 0xe416d0 (t1) deleted: errno=1835009 (0x1c0001) status=1 (0x1)
Warning: module 0x131b170 (FRC_UserProgram.out) holds reference to undefined symbol _
ZN9CANJaguarD1Ev.
Warning: module 0x131b170 (FRC_UserProgram.out) holds reference to undefined symbol _
ZN9CANJaguarC1EhNS_11ControlModeE.
Warning: module 0x131b170 (FRC_UserProgram.out) holds reference to undefined symbol _
ZN9CANJaguar3SetEf.
(unloading partially loaded module FRC_UserProgram.out)
...FRC_UserProgram failed to load.

Welcome to LabVIEW Real-Time 8.6.1f2

The code compiles with no warnings or errors. I am not using 2CAN, I am using a custom serial connector to the Black jaguar. BDC-COMM works. I updated the firmware and set their board IDs.

Radical Pi
02-17-2010, 11:14 PM
It looks like the actual CANJaguar class isn't in your project. You added the cpp files to your project as well as the h files, right?

EDIT: Your problem is you put the CANJaguar code as a separate project. The actual code isn't being built with your user code. If you put a folder reference in your project the the CANJaguar folder it should work, or you could just copy the files directly into your project (that's what we do)

unobtainium-42
02-17-2010, 11:37 PM
I put the files in the project, and all of a sudden these errors popped up:

Build Started in Project 'Breakaway': 2010-02-17 20:35:30
Generation of makefiles started.
Generation of makefiles finished (Elapsed Time: 00:00).
Platform: Wind River VxWorks 6.3
Command: make --no-print-directory BUILD_SPEC=PPC603gnu DEBUG_MODE=1 TRACE=1 clean all
Working Directory: D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/PPC603gnu
make: removing targets and objects of D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/PPC603gnu
if [ -d "Breakaway" ]; then cd "Breakaway"; rm -rf Debug; fi
if [ -d "Breakaway_partialImage" ]; then cd "Breakaway_partialImage"; rm -rf Debug; fi
if [ ! -d "`dirname "Breakaway_partialImage/Debug/Objects/Breakaway/CANJaguar.o"`" ]; then mkdir -p "`dirname "Breakaway_partialImage/Debug/Objects/Breakaway/CANJaguar.o"`"; fi;echo "building Breakaway_partialImage/Debug/Objects/Breakaway/CANJaguar.o"; ccppc -g -mcpu=603 -mstrict-align -mno-implicit-fp -mlongcall -ansi -Wall -MD -MP -mlongcall -IC:/WindRiver/vxworks-6.3/target/h -I../CANJaguar -IC:/WindRiver/vxworks-6.3/target/h/WPILib -IC:/WindRiver/vxworks-6.3/target/h/wrn/coreip -DCPU=PPC603 -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -o "Breakaway_partialImage/Debug/Objects/Breakaway/CANJaguar.o" -c "D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/CANJaguar.cpp"
building Breakaway_partialImage/Debug/Objects/Breakaway/CANJaguar.o
In file included from D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/CANJaguar.cpp:3:
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:13: error: `tNIRIO_i32' does not name a type
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:16: error: `tRioStatusCode' does not name a type
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:19: error: `tRioStatusCode' does not name a type
...
There's a hundred similar lines...
...
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:287: error: `tRioStatusCode' does not name a type
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:293: error: expected `,' or `...' before "status"
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:294: error: ISO C++ forbids declaration of `tRioStatusCode' with no type
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h: In function `bool rioStatusIsFatal(int)':
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:295: error: `status' undeclared (first use this function)
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:295: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h: At global scope:
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:298: error: expected `,' or `...' before "status"
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:299: error: ISO C++ forbids declaration of `tRioStatusCode' with no type
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h: In function `bool rioStatusIsNotFatal(int)':
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:300: error: `status' undeclared (first use this function)
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h: At global scope:
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:306: error: expected `,' or `...' before "newStatus"
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:307: error: ISO C++ forbids declaration of `tRioStatusCode' with no type
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h: In function `T& rioSetStatus(T&, int)':
C:/WindRiver/vxworks-6.3/target/h/WPILib/ChipObject/NiRioStatus.h:308: error: `newStatus' undeclared (first use this function)
D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/CANJaguar.cpp: In member function `void CANJaguar::InitJaguar()':
D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/CANJaguar.cpp:31: error: `kRIOStatusVersionMismatch' undeclared (first use this function)
C:\WindRiver\vxworks-6.3\host\x86-win32\bin\make.exe: *** [Breakaway_partialImage/Debug/Objects/Breakaway/CANJaguar.o] Error 1
Build Failed in Project 'Breakaway' (Process Exit Value was 2): 2010-02-17 20:35:32 (Elapsed Time: 00:02)

Did I forget to include something? More importantly, why didn't this happen before?

taichichuan
02-18-2010, 05:47 PM
These are well known errors. You need to include the following line into your CANJaguar.cpp code just above the #include "ChipObject/NiRioStatus.h"

#include "ChipObject/NiRio.h"

This will make the compile errors go away.

HTH,

Mike

unobtainium-42
02-18-2010, 07:40 PM
That worked, thanks.

The robot reports this runtime error via console:

>>>>ERROR: status == -52010 (0xFFFF34D6) in sendMessage() in D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/CANJaguar.cpp at line 176

And via DS:

<Code>-52010 ERROR: status == -52010 (0xFFFF34D6) in sendMessage() in D:/Eric/Documents/Projects/Robotics/workspace2/Breakaway/CANJaguar.cpp at line 176
NI Platform Services: The requested resource must be initialized before use.

All I do is instantiate CANJaguar objects, like the example. Is there any document I should be reading while doing this? If the error's well known, how was I supposed to find out?

simpsonboy77
02-19-2010, 12:28 AM
You need something in your code similar to

CANJaguar* Motor = new CANJaguar(3,CANJaguar::kPercentVoltage);
The 3 is the CANBus id, and the second arguement is a enum for the type of controls. Put this in your initialization. Of course change the name motor to the nameof your variables.

If you have this, post snipets of your code. Also make sure you set CAN IDs to each jaguar. If any 2 share a ID, the bus gets confused. I know you said you set them, but I have had my jaguars reset their IDs for no apparent reason.