![]() |
Camera shows no love to drive motors
I have had the dubious pleasure of working with the CMUCam2 and making it useful for my team's purposes. I've mostly managed to succeed, and now the camera follows the green target just fine. However, there appears to be a problem with initializing the camera. The problem is not with the actual initializing, since it does work, but there is a delay of several seconds. During this delay, the drive motors, connected on PWMs 1 and 2, begin spinning in opposite directions. They will continue to run until I shut the FRC off or turn Disable on. This happens whether it's in OI or Autonomous mode. I should note that this is not an issue with the camera not being connected (explained here) since I do eventually talk to the camera, but rather an issue during initialization.
I went ahead and put the camera into debug mode (articulated here) and noticed that during the delay in which the camera is initializing, the camera shows an exchange like this: Quote:
Through some careful debugging I discovered that the drive motors started acting crazy only once the InitCamera() function was called. This explains why they act crazy in either Competition State, since InitCamera() is in the Initialize block. At first I suspected that perhaps there was something weirdly hardcoded about PWMs 1 and 2 that made the code expect those to be the camera servo outputs (I have them on 3 and 4, not directly on the camera board, and they work fine), but switching the drive motors to other PWMs (I tried 6 and 7 *without* changing the OI code to reflect the change) seems to have no effect; they go crazy still. I noticed the servos themselves don't seem to be affected, though. Is it possible that there is a wiring issue with the Victor 884s that is causing the drive motors to be uniquely affected? The driving functions appear to be functioning perfectly normally once the motors stop spinning out of control. Obviously this issue is a showstopper for the camera. The random spinning at initialization throws the robot into an unknown state and makes autonomous programming for the competition 1000 times more difficult. I noticed that moving the InitCamera() function into the Autonomous block makes the issue go away for OI mode while still allowing for camera function, but it doesn't fix the problem with the motors in Autonomous mode. I'm hoping that the issue merely amounts to ignorance on my part and that someone else out there has had the same issue and knows the solution. Thanks. :) |
Re: Camera shows no love to drive motors
Have you calibrated the victors?
|
Re: Camera shows no love to drive motors
Yes, and it does cause the drive motors to act normally as soon as I depress the buttons on them. The problem is as soon as there's another FRC reset, the motors start acting crazy again.
|
Re: Camera shows no love to drive motors
We have used the camera for quite a few different tasks and have never had this issue. The PWM 1 & 2 do not get called while the camera initializes. You should try using Tutorial 7 to see if you continue to have this problem. I have a feeling something might be conflicting in your code. You could also post your code and we could take a look at it.
|
Re: Camera shows no love to drive motors
The camera waits a few seconds after the robot controller is started before initializing. The idea was to make sure that the camera had finished its own initialization before sending commands. The debug output you saw was the camera code in EasyC trying to initialize the camera and it not responding. You should see a bunch of commands followed by ACK messages (acknowledgment). If you only see commands being sent to the camera and no ACKs then it isn't getting your commands or it is in some strange state. I've occasionally seen a similar problem, and recycling the power seems to always fix it. I think the camera gets into some state where it doesn't accept commands.
There is no code in the EasyC runtime that does anything with the drive motors while the camera is initializing. I might suggest doing all the initialization in the Initialize() function if you're not already doing that. The IFI master code will prevent any PWM outputs from happening until the match actually starts (either autonomous or operator control). That way all the initialization (camera, gyros, etc.) is completed while the robot is sitting on the field waiting for autonomous period to start. |
| All times are GMT -5. The time now is 17:52. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi