Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Black jaguars: not working (http://www.chiefdelphi.com/forums/showthread.php?t=80884)

ellisk 22-01-2010 19:36

Black jaguars: not working
 
I am trying to get the new black jaguars working and am getting errors when I attempt to use them. Here is the setup and the errors I am getting:

First, the jaguars have been updated (done by another member of our team). I put the file at http://firstforge.wpi.edu/sf/frs/do/...agbridgeplugin onto the cRIO via FTP according to the directions at http://firstforge.wpi.edu/sf/sfmain/...ects.canjaguar, under the heading "Getting Started."

I got the Jaguar code from http://firstforge.wpi.edu/sf/frs/do/...anjaguar_for_c and modified it so that it compiles, as shown in this thread: http://www.chiefdelphi.com/forums/sh...ad.php?t=80706

The code I am using is:
Code:

// This code has been simplified for the purposes of posting.
#include "WPILib.h"
#include "CANJaguar.h"

class Spy : public SimpleRobot
{
        Joystick* leftStick;
        CANJaguar* frontRightMotor;

public:
        Spy(void)
        {
                GetWatchdog().SetEnabled(false);

                leftStick = new Joystick(1);
                frontRightMotor = new CANJaguar(1);
        }

        void Autonomous(void)
        {

        }

        void OperatorControl(void)
        {
                while (true)
                        frontRightMotor->Set(leftStick->GetY());
        }
};

START_ROBOT_CLASS(Spy);

When I run the code, I get the following error, repeatedly, in the console (and the Jaguar, of course, does not run):
Code:

>>>>ERROR: status == -52007 (0xFFF34D9) in sendMessage() in C:/windriver/workspace/Spy/CANJaguar.cpp at line 176
I *assume* that the correct port is 1; we're daisy-chaining our CAN Jaguars, and the Jaguar of interest is the first one in the chain. I've also tried 0 as the port for the jaguar, which gives the same error.

Does anyone know what's going on? I would really appreciate any help.

Thanks,
Kevin

ellisk 22-01-2010 20:14

Re: Black jaguars: not working
 
I'm realizing that this really isn't a C++ Windriver specific question. Would a moderator mind moving my thread into the general programming forum? Thanks.

jhersh 23-01-2010 06:14

Re: Black jaguars: not working
 
Quote:

Originally Posted by ellisk (Post 904908)
I *assume* that the correct port is 1; we're daisy-chaining our CAN Jaguars, and the Jaguar of interest is the first one in the chain. I've also tried 0 as the port for the jaguar, which gives the same error.

I certainly cannot be 0, since that is the broadcast address. 1 is what all Jaguars ship as. You must assign a unique ID to each Jaguar with a tool such as the bdc-comm utility from TI. This has nothing to do with wiring order. All Jags are on a shared bus. The CAN bus is wired straight through between the 2 CAN connectors on the Jags.

TI recommends that you use addresses in the range 2 - 63.

BTW, the error code is "Operation Timed Out".

Also, have you tested your serial cable adapter with a PC serial port and bdc-comm to make sure it's functioning properly? Is your serial cable plugged into the left RJ-12 plug on the Black Jag? Does the plugin appear to be loading properly on the console (you would have to use a network console to see it since your serial port is in use!)?

-Joe

ellisk 23-01-2010 19:37

Re: Black jaguars: not working
 
Thanks for the reply. I talked to the control systems people on my team and they set the ID of the black Jaguar using the bdc-comm utility to 2. I tried the code again, however, with the ID given in the constructor of the black jaguar to 2, and I still get the exact same behavior.:confused: So, while it seems that I did have the wrong port, that isn't the reason I get these errors. Any advice?

Thanks,
Kevin

EDIT: yes, the driver loads correctly, as seen from the network console. The black jaguar utilities show that the Jaguar is functioning fine and the wiring is fine. I'm very confused...

jhersh 23-01-2010 19:42

Re: Black jaguars: not working
 
What about the other list of suggestions in my last post? Also... if you have LabVIEW installed, you could run the voltage mode example to see what enumerates on your robot.

-Joe

ellisk 23-01-2010 19:47

Re: Black jaguars: not working
 
Yes, we've tried the other suggestions. The cable is fine, it's plugged in on the left, there is a 100 ohm resistor on the left jack, and I can see the driver loading on the console when the cRIO boots.

EDIT:
Here's the startup message from the cRIO's console:
Code:

FPGA Hardware GUID: 0xAD(a bunch of hex digits)
FPGA Software GUID: 0xAD(a bunch of hex digits)
FPGA Hardware Version: 2010
FPGA Software Version: 2010
FPGA Hardware Revision: 1.3.0
FPGA Software Revision: 1.3.0
* Loading StartupDlls: FRC_BlockJagBridgePlugin
FRC_BlockJagBridgePlugin was compiled from SVN revision 10
task 0x12d9610 (t2) deleted: erno=0 (0) status=0 (0)
* Loading StartupDls: FRC_UserProgram
...FRC_UserProgram failed to load.

NI-VISA Server 4.5 started successfully.
task 0xe414e8 (t1) deleted: errno=1835009 (0x1c001) status=1 (0x1)

Welcome to LabVIEW Real-Time 8.6.1f2

(the last line is odd, considering that it's not in LabVIEW mode...)

When I run the aforementioned program, I get the following error at startup, presumably from the call to Init of the CANJaguar in the constructor of the program:
Code:

>>>>ERROR: status == -63194 (0xFFFF0926) in InitJaguar() in C:/windriver/workspace/Spy/CANJaguar.cpp at line 32

jhersh 23-01-2010 19:53

Re: Black jaguars: not working
 
If you just unplug the serial connector from the cRIO and plug it into a PC, does bdc-comm see the Jaguars?

ChristopherBuck 23-01-2010 23:15

Re: Black jaguars: not working
 
Hi, we had a seemingly similar problem with our CAN bus setup (using LabView). the driverstation would display an error regarding "CAN-Recieve.vi" and "operation not completed in time" (or something like that), so a timeout error of sorts. essentially, the cRIO was not getting a confirmation of initial setup from the black jag, or other jaguar- I forget exactly which. Anyway, we went into the code for initializing a 4motor robot drive system. and modified it such that it bypassed this error point (removing CAN-Recieve.vi). Then it worked perfectly. So my guess is that you may be able to do something similar in C++.

Dale 23-01-2010 23:33

Re: Black jaguars: not working
 
Answering for ellisk and in answer jhersh's question... yes the same cable works fine off a PC to talk to the Jaguar via the command line and GUI interface. The firmware was updated and ID set. No other changes were made to the Jaguar's settings. Also, for what it's worth, different cRIOs exhibit the same problem.

Once thing we didn't do was wire any of the the RS-232 handshake lines in the connector, things like CTS, RTS, DTR, DSR. The manual didn't say anything about that so we're assuming the cRIO doesn't care. Is that true?

imac256 24-01-2010 00:04

Re: Black jaguars: not working
 
As a side thought, is your CAN bus properly terminated? To make the CAN bus work it is my understanding that you need approximately a 100ohm resistor joining CANH and CANL on the last Jaguar. The pin outs can be found in the data sheet available here: http://www.luminarymicro.com/products/mdl-bdc24.html. I don't know if this will fix the problem but it may be something in the right direction.

-Ian
Programmer, Team 2022

jhersh 24-01-2010 00:12

Re: Black jaguars: not working
 
Quote:

Originally Posted by Dale (Post 905690)
Once thing we didn't do was wire any of the the RS-232 handshake lines in the connector, things like CTS, RTS, DTR, DSR. The manual didn't say anything about that so we're assuming the cRIO doesn't care. Is that true?

The Jaguar only has connections for RX and TX.

jhersh 24-01-2010 00:31

Re: Black jaguars: not working
 
Quote:

Originally Posted by ChristopherBuck (Post 905684)
Hi, we had a seemingly similar problem with our CAN bus setup (using LabView). the driverstation would display an error regarding "CAN-Recieve.vi" and "operation not completed in time" (or something like that), so a timeout error of sorts. essentially, the cRIO was not getting a confirmation of initial setup from the black jag, or other jaguar- I forget exactly which. Anyway, we went into the code for initializing a 4motor robot drive system. and modified it such that it bypassed this error point (removing CAN-Recieve.vi). Then it worked perfectly. So my guess is that you may be able to do something similar in C++.

That a great point... I forgot to ask if the robot was enabled when you got this error. The current image (v19) will not cause a reply if the robot is disabled. This means that, for the moment, you can't call any "Set" commands while the robot is disabled without an error. This will be addressed in the next update. It won't cause any trouble (the way the C++ library is written), but it will create some errors on the DS. As ChristopherBuck noted, in LabVIEW it is written with status chaining so one of these errors will prevent it from working from then on.

Dale 24-01-2010 01:52

Re: Black jaguars: not working
 
We do have the 100 ohm terminator in place. We know the Jaguars only have TX and RX but I wasn't clear whether the cRIO needed to have the other handshake lines jumpered at it's end. ellisk will have to answer about the robot being enabled.

They were trying a 2CAN ethernet adapter when I left the lab tonight to see if that yields better results. We'd still like to get the "official" RS-232 solution working though.

jhersh 24-01-2010 02:31

Re: Black jaguars: not working
 
Quote:

Originally Posted by Dale (Post 905739)
We know the Jaguars only have TX and RX but I wasn't clear whether the cRIO needed to have the other handshake lines jumpered at it's end.

The cRIO does support hardware flow control, but it's disabled by default and the BlakJagBridgePlugin does not enable it.

-Joe

Bryscus 25-01-2010 13:05

Re: Black jaguars: not working
 
2 Attachment(s)
Quote:

Originally Posted by ellisk (Post 905558)
Yes, we've tried the other suggestions. The cable is fine, it's plugged in on the left, there is a 100 ohm resistor on the left jack, and I can see the driver loading on the console when the cRIO boots.

I have been having an issue with intermittent signals getting to the Jags. We currently have updated the firmware on both Jags connected (One black and one gray each with its respective firmware update) through the RS232 port on the cRio. There is a 100 ohm termination resistor inside the DB9 shield between CANL and CANH (the green and red wires). There is a 6 pin cable running from the RS232 to CAN inverter to the LEFT port of the black Jag. I have then tried both a 4pin and 6pin cable from the RIGHT port of the black Jag to the LEFT port of the gray Jag (just to see if I had made a bad cable). I then created a short Termination cable that only has a 100ohm resistor between the green and red wires. This short cable is plugged into the RIGHT port of the Gray Jag. I have tried communications with and without this termination cable and get similar results.

If I just send the Jags a constant max output value, they will run and then sputter, and then run, yada yada yada. It sounds as if I have a physical layer problem - i.e., signals not propagating properly.

Also, I have obviously been able to connect with BD-COM to assign IDs and re-flash the firmware...


So my questions are:

Should the termination resistor be on the cable at the LEFT port of the Gray Jag, or is it correct the way I have it?

Has anyone else been able to get a connection, but suffers from intermittent signal loss?

- Bryce

P.S. I have attached some pictures of errors that I am receiving in the NetConsole.

P.S.S. This is somewhat of a bummer, because I have written code to make use of the Speed and Position modes, but can't test it until I at least have a reliable communication interface...

Dale 25-01-2010 13:33

Re: Black jaguars: not working
 
It may not be your problem, but we ordered a RJ11 cable tester to test our CAN cables. We have 9 Jaguars on our board and can't have one of those cables being marginal if we can help it! You can get one for anywhere between $7 and $100+.

We still don't have our first Jaguar working on CAN so we'll see if we get to use that spiffy tester. For what it's worth we're getting this one because of it's good reviews and middle range price.

Mike Copioli 25-01-2010 13:46

Re: Black jaguars: not working
 
Quote:

Originally Posted by Dale (Post 906555)
There should be just one terminator...at the end of the chain. Have a terminator inside the shell of the DB9 defeats the purpose of reducing reflections. See this article.

Two 120 ohm resistors are required on a CAN bus. One at each end of the BUS. The 2CAN contains one of the resistors internally that can be removed via a jumper. The second jumper needs to be placed by the user. My suggestion is to use the second RJ-11/12 connector on the Jag for this. I do not know if the Jaguar has an internal 120 ohm resistor or not. Maybe Scott Emley can answer this. If it does not, you will need to place one at the beginning of the BUS as well.

Dale 25-01-2010 13:56

Re: Black jaguars: not working
 
I stand corrected on the terminator! In re-reading page 29 of the Jaguar BDC24 getting started guide it clearly says you need a 100 ohm resistor at both ends. I wonder if that's our problem with getting the Jaguars to work via CAN! It would seem unlikely given that we only have one Jaguar in our test setup but it's certainly worth a try.

Bryscus 25-01-2010 14:05

Re: Black jaguars: not working
 
Quote:

Originally Posted by Dale (Post 906561)
I stand corrected on the terminator! In re-reading page 29 of the Jaguar BDC24 getting started guide it clearly says you need a 100 ohm resistor at both ends. I wonder if that's our problem with getting the Jaguars to work via CAN! It would seem unlikely given that we only have one Jaguar in our test setup but it's certainly worth a try.

Dale,

The instructions in the Getting Started Guide show a 100 ohm connected between red and green (CAN_L and CAN_H) inside the RS-232 to CAN converter. If you did this, you should have the proper termination.

- Bryce

P.S. I wonder if the termination needs to occur closer the the black jag than at the converter. Our cable is only 5 inches or so, but maybe even that is too long?

Dale 25-01-2010 14:11

Re: Black jaguars: not working
 
We had a 100 ohm terminator in the empty RJ11 plug on the Jaguar but didn't have one in the left one where the serial data was coming in.

Bryscus 25-01-2010 14:18

Re: Black jaguars: not working
 
That could do it...

- Bryce

Mike Copioli 25-01-2010 22:11

Re: Black jaguars: not working
 
If I understand you correctly, you only have one Jag on the BUS. The Black Jag. If this is the case you should be able to get away with only one resistor for test purposes. We have six jaguars on our Kit bot with only the resistor that is in the 2CAN. We have been driving it around for the last two days without issue. See the link to the pic. I suspect the problem is elsewhere possibly in your code.


http://www.crosstheroadelectronics.c...res/Kitbot.JPG

jhersh 26-01-2010 03:57

Re: Black jaguars: not working
 
Quote:

Originally Posted by ellisk (Post 905558)
(the last line is odd, considering that it's not in LabVIEW mode...)

That line simply means that the system is up and running. When initially developed, the cRIO only ran LabVIEW.

Quote:

Originally Posted by ellisk (Post 905558)
When I run the aforementioned program, I get the following error at startup, presumably from the call to Init of the CANJaguar in the constructor of the program:
Code:

>>>>ERROR: status == -63194 (0xFFFF0926) in InitJaguar() in C:/windriver/workspace/Spy/CANJaguar.cpp at line 32

That error message is kRIOStatusVersionMismatch. Likely it means that you haven't updated your Jaguar to the latest version.

-Joe

Bryscus 26-01-2010 09:43

Re: Black jaguars: not working
 
BTW: NEW CANJag CODE IS AVAILABLE FOR DOWNLOAD!!!

Quote:

Originally Posted by Mike Copioli (Post 906903)
If I understand you correctly, you only have one Jag on the BUS. The Black Jag. If this is the case you should be able to get away with only one resistor for test purposes. We have six jaguars on our Kit bot with only the resistor that is in the 2CAN. We have been driving it around for the last two days without issue. See the link to the pic. I suspect the problem is elsewhere possibly in your code.


http://www.crosstheroadelectronics.c...res/Kitbot.JPG

If I were you, I'd add the termination resistor at the end. They aren't hard to make, and technically you're violating the spec of the CAN bus. If you drive under different circumstances, it isn't guaranteed to work...

Bryscus 26-01-2010 09:49

Re: Black jaguars: not working
 
Quote:

Originally Posted by Bryscus (Post 906541)
I have been having an issue with intermittent signals getting to the Jags...

Guys, I think I was swamping the serial port with commands. This was causing the intermittent glitches. Everything appears to work extremely well now! Joe Hershberger is one awesome guy.

Someone has already been running with 6 Jags hooked together, but I'm going to hook up a bunch tonight and verify everything.

Also, Joe has released a new version of the Jag code that implements all the closed loop modes! He also said there was a TI firmware update available (Version 87). I'll be playing with that tonight too. Cheers!

- Bryce

Dale 26-01-2010 11:51

Re: Black jaguars: not working
 
We continued trying to get either the 2CAN or RS-232 to work last night, still without any success in C++. The RS-232 version still throws the error, even when the robot is enabled. The 2CAN just sits there with a flashing orange light (the boot loader). It's probably some setup issue because the 2CAN seems to be a quality product. Work continues but so far it's been pretty frustrating. We've tried various RJ11 cables.

Mike Copioli 26-01-2010 11:51

Re: Black jaguars: not working
 
Quote:

Originally Posted by Bryscus (Post 907095)
BTW: NEW CANJag CODE IS AVAILABLE FOR DOWNLOAD!!!



If I were you, I'd add the termination resistor at the end. They aren't hard to make, and technically you're violating the spec of the CAN bus. If you drive under different circumstances, it isn't guaranteed to work...

I am aware of that. The intent of my post was to inform Dale that his problem was elsewhere. I assure you it performs adequately without the termination resistor in our specific configuration. This does not mean that I think it is ok to leave the resistor out of the BUS. It simply means that using our tools to monitor CAN traffic there were absolutely no CAN frame errors in our particular configuration. The termination resistor is to reduce signal reflection. Signal reflection is not influenced by external factors as much as it is based on bus length. If you keep the bus short and the utilization low, you should not have any issues. In Dales example he was only connecting one Black Jaguar(as I understood it) and no gray Jags. Since the Black Jaguar is the beginning and the end of the Bus it would be pointless to place a resistor on each end of the device since the traces inside the jaguar are the entire BUS.

Mike Copioli 26-01-2010 12:18

Re: Black jaguars: not working
 
Quote:

Originally Posted by Dale (Post 907170)
We continued trying to get either the 2CAN or RS-232 to work last night, still without any success in C++. The RS-232 version still throws the error, even when the robot is enabled. The 2CAN just sits there with a flashing orange light (the boot loader). It's probably some setup issue because the 2CAN seems to be a quality product. Work continues but so far it's been pretty frustrating. We've tried various RJ11 cables.

A slow orange light means that the 2CAN does not have communication or it is disabled. If you are able to view the 2CAN dashboard then the 2CAN is not in bootloader. We are currently working on updating the 2CAN plugin to be compatible with some changes made to the CANjaguar class. The update will be available soon. Thank you for your patience.

ellisk 26-01-2010 19:15

Re: Black jaguars: not working
 
I tried it with the 2CAN bus. Now, instead of giving me error messages, it just silently fails. I've updated the firmware on the 2CAN, but it still doesn't work. Any ideas? Here's the code I'm using:

Code:

#include "WPILib.h"
#include "2CAN.h"



class Spy : public SimpleRobot
{
        JaguarOverCAN  *mtr;

public:
        Spy(void)
        {
                GetWatchdog().SetEnabled(false);
        }

        void Autonomous(void)
        {

        }

        void OperatorControl(void)
        {
                mtr = new JaguarOverCAN (2);
                while (true) {
                        mtr->Set(0.5);
                        Wait(0.5);
                }
        }
};

EDIT: I tried visiting the 2CAN's web page at 10.15.40.10. I was able to see that both the 2CAN and the Jaguar are at least partially set up correctly, that the Jaguar is getting power and that it is on ID 2.

jhersh 27-01-2010 00:58

Re: Black jaguars: not working
 
Quote:

Originally Posted by ellisk (Post 907438)
I tried it with the 2CAN bus. Now, instead of giving me error messages, it just silently fails. I've updated the firmware on the 2CAN, but it still doesn't work. Any ideas? Here's the code I'm using:

Code:

#include "WPILib.h"
#include "2CAN.h"



class Spy : public SimpleRobot
{
        JaguarOverCAN *mtr;

public:
        Spy(void)
        {
                GetWatchdog().SetEnabled(false);
        }

        void Autonomous(void)
        {

        }

        void OperatorControl(void)
        {
                mtr = new JaguarOverCAN (2);
                while (true) {
                        mtr->Set(0.5);
                        Wait(0.5);
                }
        }
};


You are using the old JaguarOverCAN class that CTRE released before the season began and before the rules were released. You need to be using the unified CANJaguar class for it to work with the FRC 2010 control system.

-Joe

ellisk 27-01-2010 18:18

Re: Black jaguars: not working
 
I tried switching to CANJaguar as well, and I still get the errors I had before (status == -57002). This was using the CANJaguar class using the 2CAN attachment.

jhersh 27-01-2010 18:37

Re: Black jaguars: not working
 
Quote:

Originally Posted by ellisk (Post 908059)
I tried switching to CANJaguar as well, and I still get the errors I had before (status == -57002). This was using the CANJaguar class using the 2CAN attachment.

There was an update to the 2CAN plugin released just a day or two ago. Try updating that.

ellisk 27-01-2010 23:18

Re: Black jaguars: not working
 
I tried the update (http://crosstheroadelectronics.com/2...2CANPlugIn.out) and it still doesn't work. This is very odd...

ozrien 28-01-2010 09:38

Re: Black jaguars: not working
 
ellisk,

I just to confirm where you are...

You are using wind river c++ with "latest" checked out code from firstforge, or the last file release (zip under the file release link)?

You have latest FRC_2CANPlugin.out file from ctr website.

FRC_2CANPlugin.out is in the "ni-rt/system" directory on the ftp server in the cRIO.

ni-rt.ini is modified so that ";FRC_2CANPlugIn.out" is IMMEDIETELY after FRC_NetworkCommunication.out.
Note that FRC_2CANPlugIn.out now should be before FRC_UserProgram (in the past releases it would have been after but that was incorrect, causing all sorts of problems).

And also have you successfully viewed the web dashboard in the 2CAN and have confirmed that the Jaguar ID for your jag is the same one used in the constructor of CANJaguar?

Bryscus 28-01-2010 10:56

Re: Black jaguars: not working
 
Quote:

Originally Posted by ozrien (Post 908422)
ellisk,

I just to confirm where you are...

You are using wind river c++ with "latest" checked out code from firstforge, or the last file release (zip under the file release link)?

You have latest FRC_2CANPlugin.out file from ctr website.

FRC_2CANPlugin.out is in the "ni-rt/system" directory on the ftp server in the cRIO.

ni-rt.ini is modified so that ";FRC_2CANPlugIn.out" is IMMEDIETELY after FRC_NetworkCommunication.out.
Note that FRC_2CANPlugIn.out now should be before FRC_UserProgram (in the past releases it would have been after but that was incorrect, causing all sorts of problems).

And also have you successfully viewed the web dashboard in the 2CAN and have confirmed that the Jaguar ID for your jag is the same one used in the constructor of CANJaguar?

ozrien,

I've been using CAN control for over a couple weeks now, but I'm using the serial port. CANJaguar.h is necessary for the project to build. ellisk only shows 2CAN.h included. Could this be his/her problem?

- Bryce

P.S. ellisk, I would verify yourself that your Jaguars are set with the correct ID. Also, that they have the correct firmware. There are two firmware files, one for the black Jags and one for the gray Jags. TI just released a new version of the firmware, so you can take this time to reflash with the newest: http://www.luminarymicro.com/index.p...d&Itemid=59 1

P.S.S. Unless you just didn't show it, you're also missing START_ROBOT_CLASS(Spy); that comes after your class. If this line is not there, the cRio won't deploy your code. This line creates a new task with your program...

P.S.S.S. Here's an example of what my code would be using CAN over the serial port.

Code:

#include "WPILib.h"
#include "CANJaguar.h"



class Spy : public SimpleRobot
{
        CANJaguar *mtr;

public:
        Spy(void)
        {       
                mtr = new CANJaguar (5);  //or whatever ID you have set
                GetWatchdog().SetEnabled(false);
        }

        void Autonomous(void)
        {

        }

        void OperatorControl(void)
        {

                while (true) {
                        mtr->Set(0.5);
                        Wait(0.5);
                }
        }
};

START_ROBOT_CLASS(Spy);


basicxman 28-01-2010 13:14

Re: Black jaguars: not working
 
Make SURE you have toggled the Console Out DIP switch on the cRio. My team was having the exact same problem and it worked after toggling Console Out and a good ol' hard reboot.

Bryscus 28-01-2010 15:40

Re: Black jaguars: not working
 
Quote:

Originally Posted by basicxman (Post 908572)
Make SURE you have toggled the Console Out DIP switch on the cRio. My team was having the exact same problem and it worked after toggling Console Out and a good ol' hard reboot.

That's a good point for everyone trying to use the serial port, but it shouldn't matter for the 2CAN interface.

- Bryce

hm29168 28-01-2010 16:39

Re: Black jaguars: not working
 
We have been having a similar problem as ellisk. We have updated our Jaguars to the most current firmware (87) as well as our 2CAN (v.1.5) and have gotten the sample code to work. However, we can only move sporadically with error -52007 showing up on the target console. Likewise, the watchdog is flipping on and off sporadically. We are using 2CAN with gray Jaguars.

jhersh 28-01-2010 18:14

Re: Black jaguars: not working
 
Quote:

Originally Posted by Bryscus (Post 908480)
P.S.S.S. Here's an example of what my code would be using CAN over the serial port.

Code:

#include "WPILib.h"
#include "CANJaguar.h"



class Spy : public SimpleRobot
{
        CANJaguar *mtr;

public:
        Spy(void)
        {       
                mtr = new CANJaguar (5);  //or whatever ID you have set
                GetWatchdog().SetEnabled(false);
        }

        void Autonomous(void)
        {

        }

        void OperatorControl(void)
        {

                while (true) {
                        mtr->Set(0.5);
                        Wait(0.5);
                }
        }
};

START_ROBOT_CLASS(Spy);


And because of the unified architecture, the exact same code will work with the 2CAN with no modifications (or even rebuilding) by simply changing which driver plugin is configured to load on startup. It may be good to get a baseline with serial so you know the robot code is OK, then switch to the 2CAN plugin and see if there might be a problem with it.

-Joe

jhersh 28-01-2010 18:17

Re: Black jaguars: not working
 
Quote:

Originally Posted by hm29168 (Post 908701)
Likewise, the watchdog is flipping on and off sporadically.

Which watchdog?

Mike Copioli 28-01-2010 18:49

Re: Black jaguars: not working
 
Quote:

Originally Posted by hm29168 (Post 908701)
We have been having a similar problem as ellisk. We have updated our Jaguars to the most current firmware (87) as well as our 2CAN (v.1.5) and have gotten the sample code to work. However, we can only move sporadically with error -52007 showing up on the target console. Likewise, the watchdog is flipping on and off sporadically. We are using 2CAN with gray Jaguars.

Are you able to view the dashboard? If the answer is yes, are your Jaguars showing up in the dashboard view? If they are, and there are no faults displayed, it is possible the issue is somewhere in the code. One thing that you could do is leverage the dashboard feature of the 2CAN. When you are in the dashboard view, verify the throttle values that your code is requesting. For example if you are requesting a throttle value of 1, the throttle value in the dashboard view for that Jaguar should be 100%. Try this and post your results. The next release of the firmware will contain more diagnostic features that will help users to pinpoint problems.

ellisk 28-01-2010 19:33

Re: Black jaguars: not working
 
Update:

ozrien: Yes to everything.

I'm not sure what on the dashboard would appear for the Jaguar. However, everything looks dead (not seeing any relays, etc).

I also get error -63194 at the start when I run over the RS232 port, that is:
Code:

>>>ERROR: status == -63194 (0xFFFF0926) in InitJaguar() in C:/windriver/workspace/Spy/CANJaguar.cpp at line 32

Dale 28-01-2010 23:18

Re: Black jaguars: not working
 
One other thing to add to ellisk's report. When using the BDC-COMM application over RS-232 via a PC we are able to control the Jaguar and it's attached motor. It was thrilling to see a motor actually move! That seems to indicate the problem is not a physical one, at least using RS-232.

I'm about ready to pull the plug, so to speak, on CAN. We'd really like to use the advanced features of Jaguars, and love the way it cleans up the board, but we also need to get on with things. Ellisk is one of the most talented programmers our team has ever had -- four years on the team, four years of CS classes, Intel Science Talent Search finalist, etc.

Do you folks have any final ideas???

jhersh 29-01-2010 01:00

Re: Black jaguars: not working
 
Quote:

Originally Posted by ellisk (Post 908839)
I also get error -63194 at the start when I run over the RS232 port, that is:
Code:

>>>ERROR: status == -63194 (0xFFFF0926) in InitJaguar() in C:/windriver/workspace/Spy/CANJaguar.cpp at line 32

-63194 is kRIOStatusVersionMismatch. Update the Jaguar firmware.

-Joe

Mike Copioli 29-01-2010 08:21

Re: Black jaguars: not working
 
Quote:

Originally Posted by jhersh (Post 909070)
-63194 is kRIOStatusVersionMismatch. Update the Jaguar firmware.

-Joe

This makes sense. That explains the jittery behavior. Ellis I would not give up on CAN just yet. Try to verify the JAG firmware version number as 87 using either the 2CAN web dash or the BDC-com.

Bryscus 29-01-2010 11:13

Re: Black jaguars: not working
 
Quote:

Originally Posted by hm29168 (Post 908701)
We have been having a similar problem as ellisk. We have updated our Jaguars to the most current firmware (87) as well as our 2CAN (v.1.5) and have gotten the sample code to work. However, we can only move sporadically with error -52007 showing up on the target console. Likewise, the watchdog is flipping on and off sporadically. We are using 2CAN with gray Jaguars.

hm29168,

I think I was getting the same error. I believe the error had to do with saturating the serial port (or maybe the 2CAN in your case?). Put a wait statement in your main loop. Use the code Wait(x); where x is the number of seconds and is a float. If you try to send commands too quickly, you will end up with jittery motors and a lot of those errors because the serial port can't send the data out as fast as you can write to the serial port itself.

- Bryce

hm29168 29-01-2010 15:20

Re: Black jaguars: not working
 
@jhersh - The watchdog is the main watchdog in the FIRST code; it appears on the Driver Station PC as "Watchdog not Fed".

@Mike Copoli - We are able to access the web dashboard and the throttle values do what we set them to.

@Bryscus - We did have a Wait function in our code set at 0.005. After playing with different Wait Value functions (0.02, 0.5, 0.08), we noted that the error dissapeared for higher values, but the Driver Station PC complained of the Watchdog not being fed. We do think it's a problem with the 2CAN being overloaded as the lower values (0.02) are the only ones that complains about the error. We could keep playing around with values until we find the magic number that makes it work. However, we are afraid of being disqualified during competition / losing command of our robot due to the Watchdog waiting too long. What was your Wait value and do you have any recommendations?

ellisk 29-01-2010 19:20

Re: Black jaguars: not working
 
Quote:

Originally Posted by Mike Copioli (Post 909148)
This makes sense. That explains the jittery behavior. Ellis I would not give up on CAN just yet. Try to verify the JAG firmware version number as 87 using either the 2CAN web dash or the BDC-com.

Thank you so much! It works now over 2CAN!

Dale 29-01-2010 22:11

Re: Black jaguars: not working
 
Just to close the loop in case everyone is wondering. After all the messing around with Jaguars, loading firmware, etc. somehow we didn't have the latest firmware on the Jaguar!!! Of all the mistakes.

We're still working on getting things working with RS-232 so we can make an informed choice vs the 2CAN but at least one of the two is working now. Thanks so much to everyone who helped us get this together!

Mike Copioli 30-01-2010 07:48

Re: Black jaguars: not working
 
QUOTE=hm29168;909397]@ We do think it's a problem with the 2CAN being overloaded as the lower values (0.02) are the only ones that complains about the error. ?[/quote]


This is not likely. The response time between commands sent and and aked over CAN using the 2CAN is sub mS and CAN is the bottleneck not Ethernet.

Are you using Java, c++ or Labview?

How many Jags are you using?

Is the webhost running when you observe these issues? This should not cause a problem but it is good to rule it out.

Any issues that are caused by "to much data" over Ethernet will only be worse over serial.

hm29168 30-01-2010 10:29

Re: Black jaguars: not working
 
We are using C++ with 4 Grey Jags and 2CAN. We are not running the web interface when the robot exhibits these problems and we are using Ethernet, not serial. The cRIO, Jag's, and 2CAN firmware are updated to version 19, 87, and 1.5, respecitvely.

Mike Copioli 30-01-2010 12:06

Re: Black jaguars: not working
 
Quote:

Originally Posted by hm29168 (Post 909795)
We are using C++ with 4 Grey Jags and 2CAN. We are not running the web interface when the robot exhibits these problems and we are using Ethernet, not serial. The cRIO, Jag's, and 2CAN firmware are updated to version 19, 87, and 1.5, respecitvely.

I know some of this may seem redundant but I am going to ask anyway.

- Have you used the web dash to verify version number of the Jaguars and the 2CAN firmware?

- Do you have a 120 ohm termination resistor on the CAN BUS?

- Have you confirmed the ARB(Jag) IDs are set correctly and not conflicting?

- Is the latest plugin being loaded? The latest can be found at www.crosstheroadelectronics.com/2CAN.htm

- When your code is running and you are not changing throttle values, what state is the LED on the 2CAN and the Jaguars in. (color and solid/blink)

The 007 ERROR is indicating that the 2CAN is awaiting a response from the Jaguar over CAN. This can happen for several reasons. It is usually due to the wrong firmware being loaded onto the Jag but can be caused by any of the afore mentioned problems.

hm29168 30-01-2010 17:09

Re: Black jaguars: not working
 
After doing all of your suggestions, we realized that the problem was that in the code, we were not asking anything of the Jaguars in the code. So, the 2CAN was waiting for a response from the Jaguars, but the Jaguars weren't sending anything back. Thanks for all of your help! Can't wait to start playing with the CAN features.

Bryscus 01-02-2010 09:36

Re: Black jaguars: not working
 
Quote:

Originally Posted by hm29168 (Post 910061)
After doing all of your suggestions, we realized that the problem was that in the code, we were not asking anything of the Jaguars in the code. So, the 2CAN was waiting for a response from the Jaguars, but the Jaguars weren't sending anything back. Thanks for all of your help! Can't wait to start playing with the CAN features.

So just to satisfy my morbid curiosity, to which code are you referring and what was the fix? Thanks.

- Bryce

P.S. Also, just in case you didn't know, you can set the expiration time for the Watchdog. If for some reason your cannot feed the watchdog in time, make sure the current expiration time is not set too short. It should be initialized in your main robot code and should then be fed every iteration of the main loop.

hm29168 01-02-2010 17:53

Re: Black jaguars: not working
 
We were coding in C++ and did play with the GetWatchdog.SetExpiration() as well as the Wait command. The fix (at least for us temporarily) was to get the Jaguars to do something every now and then, say GetOutputVoltage from the Jaguar. So glad to finally get this resolved and can finally work on more complex features of CAN.

Bryscus 02-02-2010 11:14

Re: Black jaguars: not working
 
Quote:

Originally Posted by hm29168 (Post 911373)
We were coding in C++ and did play with the GetWatchdog.SetExpiration() as well as the Wait command. The fix (at least for us temporarily) was to get the Jaguars to do something every now and then, say GetOutputVoltage from the Jaguar. So glad to finally get this resolved and can finally work on more complex features of CAN.

I'm glad you have it working, but you shouldn't have to request any information from the Jags to get them to work.

- Bryce


All times are GMT -5. The time now is 12:26.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi