Go to Post Doughnuts would probably be a pretty good alternative to churros. However, that could be open to debate. - Calvin Hartley [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2010, 08:19
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Need help w/ moving Camera Servo motors.

Quote:
Originally Posted by umangv620 View Post
So should I use Servo SetAngle instead? What range does that go from? 0 to 180 or -90 to 90?
If you open up the SetAngle vi you can see how it works. It takes the angle and normalizes it to 0-359, then converts that to a number from 0 to 1 based on the angular range of the servo. The default range is 170 degrees.

What you should do is choose an appropriate increment. If you use 0.01 instead of 1, your servo will work as you expect with 100 steps of travel. (This assumes that the rest of your code is correct. Things are scrunched enough that I can't really read it well.)
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2010, 15:53
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 Alan Anderson View Post
If you open up the SetAngle vi you can see how it works. It takes the angle and normalizes it to 0-359, then converts that to a number from 0 to 1 based on the angular range of the servo. The default range is 170 degrees.

What you should do is choose an appropriate increment. If you use 0.01 instead of 1, your servo will work as you expect with 100 steps of travel. (This assumes that the rest of your code is correct. Things are scrunched enough that I can't really read it well.)
Sorry about the double post and sorry about the code. Maybe I should have kept the lightbulb mode off so everyone could read the code more clearly.

I will try changing the increment tomorrow, since school is closed today.
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote
  #3   Spotlight this post!  
Unread 12-02-2010, 18:27
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.

The camera still wont move. With light bulb on, the motor shows its position as .5, and when i press button 2, it decreases to .49. After executing once, i still have button 2 pressed down, so the value is .48.

Here is my Robot Main code, and my Camera code. The camera code is being called in Teleop Enabled, but when it runs without light bulb, the Camera Sub VI is "waiting to run". Why is this error occurring and how can I fix it?

On a sidenote, for some reason when we deploy our code, the driver station reports that the robot is on Teleop enabled, then switches to "Watchdog not fed", then back to Teleop Enabled, and back to "Watchdog not fed", and then to Teleop Enabled, and back to "Watchdog not fed", and keeps following that loop. I am not sure why I am getting this error, and is interrupting our code execution.
Attached Thumbnails
Click image for larger version

Name:	Code.PNG
Views:	63
Size:	95.1 KB
ID:	8644  
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2010, 18:58
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Need help w/ moving Camera Servo motors.

You've put the teleop code into RobotMain rather than into the Team Code Teleop function. While this isn't horrible, it does mean that the code in teleop, the drive code, and the camera update code are all running in parallel.

Far worse, the code to read the Joystick 1, Ope the Drive and read Joystick 2 are running in parallel with what I'm assuming is the Begin VI which is offscreen. This will likely mean that the joystick references are bad.

Anyway, before you write additional code, why not move the existing stuff into Teleop? Also, if you have errors due to multiple opens or referencing before opening, the Diagnostics tab should list those errors.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 12-02-2010, 20:59
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
You've put the teleop code into RobotMain rather than into the Team Code Teleop function. While this isn't horrible, it does mean that the code in teleop, the drive code, and the camera update code are all running in parallel.
I tried moving the tank drive code into the teleop vi, and i experienced a very rapid burst of "teleop enabled" and "teleop disabled". This may be from the faulty wiring into the digital sidecar we discovered later. Should the tank drive code be inside the case structure that is true/false based on the Joystick Read.vi or should it be outside that loop, but inside the other case structure loop encasing most of the teleop code?

Quote:
Originally Posted by Greg McKaskle View Post
Far worse, the code to read the Joystick 1, Open the Drive and read Joystick 2 are running in parallel with what I'm assuming is the Begin VI which is offscreen. This will likely mean that the joystick references are bad.
how else am i supposed to get the joystick references? in the begin vi, i intialized the joysticks and set a reference to them. In Robot Main, i get the reference. If i am not supposed to get the reference, how will i run tank drive?
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote
  #6   Spotlight this post!  
Unread 13-02-2010, 04:07
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Need help w/ moving Camera Servo motors.

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
Reply With Quote
  #7   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
  #8   Spotlight this post!  
Unread 13-02-2010, 19:13
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Need help w/ moving Camera Servo motors.

When I look at the code Teleop code at : http://i48.tinypic.com/sqqe8n.jpg I see that each time it is called, 50 times a second, the joysticks are being closed, additionally, the drive is being opened and closed.

Move the Opens to Begin, the Closes to Finish, and see if that helps. By the way, you'll need to name and store the drive.

Greg McKaskle
Reply With Quote
  #9   Spotlight this post!  
Unread 14-02-2010, 00:19
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
When I look at the code Teleop code at : http://i48.tinypic.com/sqqe8n.jpg I see that each time it is called, 50 times a second, the joysticks are being closed, additionally, the drive is being opened and closed.

Move the Opens to Begin, the Closes to Finish, and see if that helps. By the way, you'll need to name and store the drive.

Greg McKaskle
Thats what we had. We were getting errors, so we deleted that part and opened the joysticks and drive in now robot main(not teleop) and closed it in robot main as well. When we do this, our joysticks function correctly.

When we open the joysticks and the drive in begin.vi and reference them, the joysticks act funny and so does drive. Which is why i was wondering if anyone could post or PM any screenshots or code that could help us out.
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote
  #10   Spotlight this post!  
Unread 15-02-2010, 02:31
ecnahc515 ecnahc515 is offline
Registered User
FRC #3192
 
Join Date: Jan 2010
Location: Oregon
Posts: 6
ecnahc515 is an unknown quantity at this point
Re: Need help w/ moving Camera Servo motors.

Quote:
Originally Posted by umangv620 View Post
Thats what we had. We were getting errors, so we deleted that part and opened the joysticks and drive in now robot main(not teleop) and closed it in robot main as well. When we do this, our joysticks function correctly.

When we open the joysticks and the drive in begin.vi and reference them, the joysticks act funny and so does drive. Which is why i was wondering if anyone could post or PM any screenshots or code that could help us out.
That probably means you opened up the same reference or something, more than once. It should work fine with the begin and finish VI's, while having your reference and settings in the teleop. If it isn't than you set something up wrong.
Reply With Quote
  #11   Spotlight this post!  
Unread 18-02-2010, 18:21
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 ecnahc515 View Post
That probably means you opened up the same reference or something, more than once. It should work fine with the begin and finish VI's, while having your reference and settings in the teleop. If it isn't than you set something up wrong.
The problem was that Arcade Drive was running in Teleop.vi and Tank Drive was running in Robot Main.vi

Im guessing Arcade Drive is originally in Teleop.vi because we never put it there.
Anyways, we fixed the problem. The error was that the power cable was not properly connected to the Digital Sidecar.
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote
  #12   Spotlight this post!  
Unread 19-02-2010, 12:28
Doc Wu's Avatar
Doc Wu Doc Wu is offline
Registered User
AKA: Al Gritzmacher
FRC #1507 (Warlocks)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Lockport NY
Posts: 207
Doc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant future
Re: Need help w/ moving Camera Servo motors.

I just read your post. We have been doing the same thing with a servo, but with two preset positions and a button to toggle between them.

Here's a picture of our code:

I put this in a sub-vi, called from teleop.vi. Two controls in teleop.vi are used to set the two angles of the servo. When you get them where you want, either make the current value the default value, (right-click and select Data Operations) or replace them with a constant of the same value. The green, boolean wire comes from the joystick button where it breaks out from the unbundle block.



The Flip-Flop.vi is used to latch the button. I found the VI here on CD a while back, posted by one of the NI people. I don't recall the name or exact post, but it's been quite useful, once I made a few modifications to simplify it for our use.
Attached Files
File Type: vi 1507 Camera Position.vi (14.6 KB, 6 views)
__________________
-= Mentor Lockport Warlocks -=- Team 1507 =-
Amateur Radio Callsign: AE2T

2016 Robot Inspector - Fingerlakes, Pittsburgh
2015 Robot Inspector - Pittsburgh, Champs. Judge Observer - Champs
2014 Robot Inspector - Tech Valley, Fingerlakes, Buckeye, Championship
2013 Robot Inspector - Fingerlakes, Buckeye, Championship
2012 Robot Inspector - Fingerlakes, Buckeye, Championship - Website Evaluator - Fingerlakes, Buckeye, Championship
2011 Robot Inspector - Fingerlakes 2011 Safety Advisor - Fingerlakes

Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP- Need Globe Motors ASAP Brandon Holley General Forum 0 03-11-2009 10:37
need help with motors EagleMentor Programming 3 06-02-2009 17:37
Need help with mini motors R.C. Motors 11 03-07-2008 16:25
help getting servo values from camera ruddy Programming 12 30-11-2007 23:18
Window Motors. Need help!!!! Mohsin Motors 1 27-02-2004 13:05


All times are GMT -5. The time now is 11:58.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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