|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Jaguar keeps flashing
I'm having a bit of a problem with the Jaguar motors (fyi, I'm using the Jaguar via PWM ports 1 and 2).
I just started doing the programming for the robot. Everything was going well until I actually tried to get the motors to move.. I'm using the SimpleRobot code to get a jist of how everything works. I didn't modify it at all, then I took out the autonomous code, so now it looks like this: Code:
#include "WPILib.h"
/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*/
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
public:
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order
stick(1) // as they are declared above.
{
myRobot.SetExpiration(0.1);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
}
/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time
}
}
};
START_ROBOT_CLASS(RobotDemo);
Everything is connected correctly, I fixed the ribbon from the cRIO to the digital sidecar. All the lights on the digital sidecar light up. The robot signal stays orange, it doesn't flash or anything. The Jaguar flashes yellow all the time, even when connected and the joysticks are moving, it doesn't change. Can anyone help me ![]() |
|
#2
|
|||
|
|||
|
Re: Jaguar keeps flashing
Can someone at least guess to what the problem is? I am kinda stuck at this point.
|
|
#3
|
||||
|
||||
|
Re: Jaguar keeps flashing
If the light on the Jaguar is flashing, you are not receiving any sort of control signal from the digital side car. This can be a result of not opening the jag correctly in your code, having a bad PWM connection, having the PWM plugged in backwards, or having a bad cable between the digital side car and the cRio.
You will need to verify all of these. You can confirm that you have a good PWM cable using a multimeter. You did not show your code opening the PWM, so I do not know if that code is ok. The only way I know of to check the ribbon cable is to get another known 'good' cable and swap it out. I'd check the PWM and your code before anything else. |
|
#4
|
|||
|
|||
|
Re: Jaguar keeps flashing
I'm willing to bet that if you looked at the diagnostics tab in the Driver Station, you'd see that it was getting a timeout error. I've run into this problem before, there seems to be an issue with the way that they have the safety set up and, on some devices, it will insist that there is always a timeout error. The only solution I've found is to set the safety to off.
|
|
#5
|
|||
|
|||
|
Re: Jaguar keeps flashing
i re-wrote the cod (with the jaguars enabled), but it still isn't working. Any ideas?
Code:
#include "WPILib.h"
/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*/
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // create joystick 1
Joystick stick2;//create joystick 2
Jaguar motor1;//create motor1
Jaguar motor2;//create motor2
public:
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order (activate pwm 1 and pwm 2)
stick(1), // as they are declared above. (activate joystick 1)
stick2(2), // activate joystick 2
motor1(1,1), //activate motor 1(digital output 1)
motor2(1,2) //activate motor2(Digital output 1)
{
myRobot.SetExpiration(0.1);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
myRobot.Drive(0.5, 0.0); // drive forwards half speed
Wait(2.0); // for 2 seconds
myRobot.Drive(0.0, 0.0); // stop robot
}
/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
motor1.Get();
motor2.Get();
while (IsEnabled() && IsOperatorControl())
{
myRobot.SetSafetyEnabled(false);
myRobot.TankDrive(stick,stick2); // drive with arcade style (use right stick)
Wait(0.006); // wait for a motor update time
}
}
};
START_ROBOT_CLASS(RobotDemo);
|
|
#6
|
|||||
|
|||||
|
Re: Jaguar keeps flashing
That's not normal. Do you have the DIO module installed in slot #2 of the cRIO?
|
|
#7
|
|||
|
|||
|
Re: Jaguar keeps flashing
Quote:
I have the signal light in the power distributor at the moment since the rsl ports aren't lighting up. when I check its voltage it emits a .5v. idk if that's normal, but the light won't light up when I put it in there. |
|
#8
|
|||||
|
|||||
|
Re: Jaguar keeps flashing
Quote:
If the little green LED by the RSL connector on the Digital Sidecar stays off, you need to figure out why. It's trying to tell you that something isn't right, even before you start programming. Let's start at the beginning and make sure the hardware is all properly configured. Do you have a 4-slot or 8-slot cRIO? What modules are installed, and in which slots? |
|
#9
|
|||
|
|||
|
Re: Jaguar keeps flashing
I have the same problem minus the lights. I have gotten it to run using the default code example however using the simplerobot example nothing works. Furthermore it appears as if using the Jaguar class does something with the relay pins since one of the lights lights up next to the number 1 when I do something like this:
Code:
Jaguar * jag1; jag1 = new Jaguar(1); jag1->Set(1.0); Wait(2.0); jag1->Set(0.0); Also I failed to mention using RobotDrive works perfectly. I use it with tank drive and two controllers. One last thing. Motors refuse to go full speed forward but will go full speed backwards with that config. It just started happening after working fine for a while. Don't know if any of these other things could be similar to what you are experiencing but I'm listing them just to find out if we could have a similar issue. EDIT: Another note. I have had no success with SimpleRobot only with IterativeRobot. More strangeness. I don't see why it would be a hardware problem but none of this seems at all logical to me. I should also note my setup is EXACTLY like the getting started with frc control setup is. Instead of having 2 Jaguars with one on pwm 1 and one on pwm 2 I have 1 jaguar on pwm1. Last edited by meltbox360 : 31-01-2012 at 21:09. |
|
#10
|
||||
|
||||
|
Re: Jaguar keeps flashing
Quote:
For these kind of problems it is best to debug in sections by process of elimination. First off take the pwm connector going to your side car and plug it into a vex controller or some remote control car type receiver and see if you can make it go. We actually have an rc receiver fir this purpose. If it moves then the problem will lie either in the side car or code. If it does not move, change the pwn cable or jaguar. If it does move, you have to make sure the side car module is in the correct slot. You can do this by running the FRC 2012 cRIO Imaging Tool. This will will light up in red what modules are missed placed and if you wave your mouse over the slots it tells you what you can or cannot plug in. The netconsole is also good for this too as it will give you errors if the modules are plugged in wrong. You can have a bad side car, but that is rare I think. I have had a lot of bad pwm cables in the past and I am glad to have moved on to can. You should not have to change this code for it to work. I dout its the code. |
|
#11
|
|||
|
|||
|
Re: Jaguar keeps flashing
The funny thing is only the RobotDrive class makes anything spin. The Jaguar class either crashes or uses a pin on the DB37 cable that is not intact for us. I forgot to check each pin of the cable and so that will be the first thing I do tomorrow. It just does not make sense that it would cause the lights on the sidecar labeled relay to light up when I use the Jaguar class.
Some strange problems I have seen on the forum and a few instances of the controllers sitting there blinking with that code. Maybe a few defective parts were distributed? Completely possible. The lights I am referring to are not the solenoid lights though, I took that code out and stripped it down to the minimum working code. I will post it up tomorrow to show you what works and what does not. EDIT: I will definitely try a vex controller as I have code that was used by another team last year and I know it works. If it does not work there is a hardware issue somewhere. |
|
#12
|
|||
|
|||
|
Re: Jaguar keeps flashing
I've checked all voltages and all cables and they are all perfect. The issue is either in the cRIO, the modules, the sidecart, or the code. Here is the code I used for getting a Jaguar to spin:
Code:
Jaguar * jag1; jag1 = new Jaguar(1,1); jag1->SetSafetyEnabled(false); jag1->Set(1.0); Wait(9.0); jag1->Set(0.0); Code:
Victor * vex1; vex1 = new Victor; vex1->SetSafetyEnabled(false); vex1->Set(1.0); Wait(9.0); vex1->Set(0.0); Code:
Jaguar *jag1; jag1 = new Jaguar(1,1); jag1 = new Jaguar(1,1); Any thoughts on what this could be an issue with? It's really weird. If someone uses c++ and could compile a program that spins a motor on pwm 1 on a Jaguar controller for a few seconds and send me the ".out" file so I can try it I would be very grateful. Perhaps the compiler is borked. At this point I have run out of ideas as even the PWM class gets no response from anything and the hardware appears to be in perfect working order. |
|
#13
|
|||
|
|||
|
Re: Jaguar keeps flashing
Quote:
Oh no.... I quoted instead of editing. I apologize for that. |
|
#14
|
|||||
|
|||||
|
Re: Jaguar keeps flashing
Quote:
|
|
#15
|
|||
|
|||
|
Re: Jaguar keeps flashing
No spare cRIO or sidecar here as we are a first year team although I suppose we should definitely at least grab a sidecar. Does anyone know how much a cRIO is if it should come to that?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|