I am sure this is operator error somehow but I don’t see it. I initialize a new Victor instance like this:
…
#define CARD_HELICALRAMP 4
#define PWM_HELICALRAMP 3
…
pMotor = new Victor(CARD_HELICALRAMP, PWM_HELICALRAMP);
…
and use it like this:
…
pMotor->Set(fMotor);
…
The pMotor member pMotor is *Victor type and fMotor is a float. The physical output is not updating. No error messages appear on the console. Am I doing something wrong? I know the function is getting called and I know the fMotor value is in the correct range (I put a printf just before the line above).
The Set call is from a different task but that should not matter (I think). This is the only PWM I have declared at this point (no RobotDrive or anything else). Does that matter? I have only one sidecar hooked up to the DIO in slot 4. This is wired to PWM 3. Do I have to start at PWM 0 for some undocumented reason?
Any advice or help is much appreciated!
What’s happening on the Victor? Does it have a solid light (set as neutral) or is it blinking (no signal)?
Try hooking up the console and creating print statements before and after the call to Set.
Also, make sure that fMotor is from -1 to 1.
The print statements before and after the Set call look correct. The Victor is blinking as if it is not being written to at all. I am thinking something is wrong with the PWM class or the FPGA code. Maybe something HAS to be on the first channel? The simple and iterative examples work on my system and they all use the first channel. Who knows? I’ll try tinkering with it tonight.
A blinking Victor does not point to a problem with your code. It says there is no PWM signal being received by it at all. This could be due to a number of things that are not programming issues.
First, does the Driver Station display tell you the system is enabled? A disabled robot does not send PWM signals.
Second, is there power being supplied to the Digital Sidecar? You should see the 12v, 6v, and 5v LEDs light up.
Third, is the system really enabled? The LED next to the Robot Status Light pins should be on steady. If it’s blinking, that means the robot is disabled. If it’s off, that could mean the cable from the Digital I/O module to the Digital Sidecar isn’t hooked up right.
Finally, is the PWM cable from the Digital Sidecar to the Victor connected properly? The black lead of the cable should be next to the edge of the Digital Sidecar, and toward the fan on the Victor. It isn’t always obvious when the pins are fully inserted in the Victor, so try reseating it.
After you verify that the system is correctly enabled and powered, if you still can’t get the Victor to stop blinking yellow, try replacing it with a servo (making sure to install the servo power jumper on the adjacent DS pins) and see if that responds.
It is enabled. It is running. The PWM cables are wired correctly because the SimpleRobot demo works. I added a call to RobotDrive to see if that performed some magic inside the PWM classes - nothing works. But the code is definitely running.
I have defined my own class that inherits RobotClass. I suspect there is some undocumented magic. This is quite frustrating. I’m an expert with VxWorks and an experienced FIRSTer. I knew C++ very well many moons ago but I must be missing something or it is not documented.
I’ll post the code later tonight, maybe someone will see something I did wrong.
While this was certainly true in past years, it is no longer the case. If you do not initialize one of the PWM-derived classes on the specific PWM port, the cRIO-based system will not generate PWM signals and the speed controller will blink.
So… it could still be a problem with the code.
Attached are my new robot class source and header files. I was having this problem in another piece of code where I wanted to use a Victor. But to check what was going on I added a call to RobotDrive in the robot class. It does not work either.
My plan was to create a simple messaging system so that the students could code tasks to control each part of the robot seperately w/o too moch interdependence. But for the life of me, I cannot see why this code does not work but SimpleRobot and IterativeRobot do work. The calls to RobotDrive in this code do nothing but SImpleRobot works fine on my setup.
And yes I know this code is not complete ;o) - neither is the robot itself - we are running an old robot with the cRIO cobbed into it.
TIA
I might not be handling the watchdog in my derived robot class correctly. A classic watchdog would reset the computer but the manual says the wpi watchdog just disables outputs. And it looks to be engaged by default.
I’ll test it later today.
… it was the watchdog (it is on by default!!)