View Single Post
  #12   Spotlight this post!  
Unread 13-02-2010, 18:03
umangv620 umangv620 is offline
Programming Captain
AKA: Umang
FRC #1403 (Cougar Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2008
Location: New Jersey
Posts: 80
umangv620 will become famous soon enoughumangv620 will become famous soon enough
Re: Need help w/ moving Camera Servo motors.

Quote:
Originally Posted by Greg McKaskle View Post
If you get the reference inside the teleop VI, it is guaranteed that Begin has completed. If you get the references in Robot Main, how do you guarantee that Begin has set them?

If you need the refnum in Robot Main, you should just open it there rather than in Begin.

If you are carful, you can of course keep writing the code the way you are, but moving the code from teleop to Robot Main didn't fix any bugs you had, and in fact will likely introduce them. The big green comments to the left of the diagram describe the typical way of modifying the framework. They are of course only suggestions, but maybe something you should read before making big edits.

As for the location of the drive code. The easiest way to see how it should be done is to create a new project using the getting started window. Save it to a new location/name and inspect how it was originally done. You can also do this on a separate computer if you are unsure of where your current code is saved.

Greg McKaskle
We are getting the weirdest errors. So after moving the drive code into Teleop.vi, we noticed that when we push Joystick 1 foward, both motors move in opposite directions(1 Jaguar green, 1 jaguar blinking red), and Joystick 2 randomly turns Jaguar 2 blinking red or green(depending on the direction). (now on known as MODE2)

Joystick 1 should move Jaguar 1 only, and Joystick 2 should move jaguar 2 only(now on known as MODE1). The problem we are having is that Joystick 1 controls both jaguars, and joystick 2 sometimes(like 1 sec per every 5 seconds, but its more random) sends a signal to the jaguar. The code is here: http://i48.tinypic.com/sqqe8n.jpg

So afterwards, we went back to our old code and tried to find out what was causing the error. And we have narrowed it down to two things. First, the references arent working properly. When I use a Joystick reference instead of opening a new joystick, the code goes into MODE2, and if we use open a new joystick instead of referencing it, the code goes into MODE1.

You can see our begin.vi here(disregard the Robot Main.vi because it no longer works like that): http://i49.tinypic.com/24uycr8.jpg
Although you can't fully see Begin.vi, the technique we used to reference the joysticks are the same.
Basically:
[USB1] --- [Joystick Open] ----[Joystick Set Ref.]====[error output array]
["Joystick 1"]-----------------/

Joystick 1 is the name of our reference, and I kinda drew out how our Joystick code in Begin.vi looks like.

SO, the problem: We want MODE1(but no errors in the diagnostic tab), but we are getting MODE2 with no errors in the diagnostic tab(besides watchdog). Can someone please post or PM me some screenshots or code, because we are having major trouble with this.
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote