Go to Post Wait, robot? We've been working on building a team. - rtfgnow [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 21-04-2013, 20:33
chriz4gx chriz4gx is offline
Registered User
AKA: Christopher Villar
FRC #2871 (Beantown Botz)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston,MA
Posts: 45
chriz4gx is an unknown quantity at this point
Off Season Experimentation

Now during the off season I have been playing around with Labview and making the robot do different tasks using sensors by using the FRC Simulator. I have been very successful during these fun test, but I have just hit a stopping point . Want I'm trying to accomplish is make the robot turn exactly 90 degrees in place by using a gyro. I have a provided a screenshot of my current autonomous code. The robot just rotates to its left and keeps rotating non stop. I can't figure out why it does that. The "Left and Right Motors" should get a value of 0 as soon as the gyro angle is equal to 90. I have opened, set gained, and closed the gyro and gave it its Refnum Name called "Gyro". The False Case is empty. Thanks in Advance!
Attached Thumbnails
Click image for larger version

Name:	Auto.JPG
Views:	83
Size:	26.2 KB
ID:	14683  
Reply With Quote
  #2   Spotlight this post!  
Unread 21-04-2013, 20:59
Owen Makin Owen Makin is offline
Registered User
FRC #1972
 
Join Date: Jan 2013
Location: CUHS El Centro
Posts: 50
Owen Makin is an unknown quantity at this point
Re: Off Season Experimentation

It keeps turning because you have values outside of the case structure. you need to move the values before the case structure to after the case structure. And have a wire running through the structure while it is false in to the tank drive vi. And and keep whats in the case structure like that when its true.
Reply With Quote
  #3   Spotlight this post!  
Unread 21-04-2013, 22:30
chriz4gx chriz4gx is offline
Registered User
AKA: Christopher Villar
FRC #2871 (Beantown Botz)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston,MA
Posts: 45
chriz4gx is an unknown quantity at this point
Re: Off Season Experimentation

I made the changes and the robot did actually rotate 90 degrees, Thxs. But, I noticed that after the robot rotated 90 degrees it began to drive forward. It was suppose to stop the motors. Any idea why?
Attached Thumbnails
Click image for larger version

Name:	Auto.JPG
Views:	42
Size:	24.9 KB
ID:	14687  Click image for larger version

Name:	AutoII.JPG
Views:	46
Size:	27.2 KB
ID:	14688  
Reply With Quote
  #4   Spotlight this post!  
Unread 21-04-2013, 22:41
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,113
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: Off Season Experimentation

I see two issues with the code you posted. First, it only runs once. In order for it to do what you want, reading the Gyro angle and setting the motor speeds need to be inside a While loop. Second, you're checking for exactly 90 degrees, and that's a very unlikely number. Try stopping the motors after it has turned at least 90 degrees; that way you won't fail to stop because you miss the brief instant when it's right at 90 degrees.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-04-2013, 22:59
chriz4gx chriz4gx is offline
Registered User
AKA: Christopher Villar
FRC #2871 (Beantown Botz)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston,MA
Posts: 45
chriz4gx is an unknown quantity at this point
Re: Off Season Experimentation

I placed the While Loop and instead I changed "Equal to" to "Greater or Equal" but I still get the same results. The robot rotates 90 degrees(maybe a little bit more since its not exactly 90) and then continues to drive forward.
Attached Thumbnails
Click image for larger version

Name:	Auto.JPG
Views:	43
Size:	32.3 KB
ID:	14689  
Reply With Quote
  #6   Spotlight this post!  
Unread 22-04-2013, 02:09
Owen Makin Owen Makin is offline
Registered User
FRC #1972
 
Join Date: Jan 2013
Location: CUHS El Centro
Posts: 50
Owen Makin is an unknown quantity at this point
Re: Off Season Experimentation

Try putting all of the drive vi's inside the case structure and leave the gyro vi out. And make sure that there is are no other drive vi's in your autonomous code.
Reply With Quote
  #7   Spotlight this post!  
Unread 22-04-2013, 06:04
tilky's Avatar
tilky tilky is offline
Registered User
AKA: Ryan Thielke
FRC #3137
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Connetquot
Posts: 188
tilky is an unknown quantity at this point
Re: Off Season Experimentation

you need to have the while loop stop once the angle >90, otherwise each while loop execution (to infinity) will pulse the motors. Notice how the Tank drive (0,-.8) is outside of the case structure. That means that regardless of what is going on with the gyro, it will always turn.

Forward as in straight? or forward as in continued to turn?
Reply With Quote
  #8   Spotlight this post!  
Unread 22-04-2013, 18:24
chriz4gx chriz4gx is offline
Registered User
AKA: Christopher Villar
FRC #2871 (Beantown Botz)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston,MA
Posts: 45
chriz4gx is an unknown quantity at this point
Re: Off Season Experimentation

What I mean as in "continues to drive forward" is that after the robot rotates the required 90 degrees(at least), it(the motors) still continue to run and causes the robot to drive forward non stop. I placed all the Drive vi inside the case structure and made the while loop stop when its true which is when the gyro angle is >=90. But I still remain having the same problem I indicated that I described at the beginning of my post.
Attached Thumbnails
Click image for larger version

Name:	Auto.JPG
Views:	39
Size:	58.1 KB
ID:	14701  
Reply With Quote
  #9   Spotlight this post!  
Unread 22-04-2013, 22:01
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,752
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: Off Season Experimentation

Personally, I'd place a probe on the angle. Perhaps it would help to place a breakpoint where the motors are zeroed.

The other thing to watch for is other code updating the motors. You may want to search for the refnum name.

Greg McKaskle
Reply With Quote
  #10   Spotlight this post!  
Unread 23-04-2013, 23:01
Belovan Belovan is offline
Registered User
AKA: Alex Angelillo
FRC #0195 (Cyber Knights)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: United States
Posts: 6
Belovan is an unknown quantity at this point
Re: Off Season Experimentation

It is not likely that not having a wait timer would cause the robot to not stop moving, but they are good to have. Also, before you enter the while loop you should reset the gyro, so that moving the robot around before you run the code won't make it go more or less than 90 degrees. Another thing you should check is to see if turning in the direction you are telling the robot to turn in gives you a negative angle, like -90 degrees.
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


All times are GMT -5. The time now is 20:51.

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