Go to Post Only Dave knows [if the 2010 game is designed already], and he aint tellin' but he'll happily feed you lots of red herrings. - Koko Ed [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 20-03-2015, 19:36
polarvortexrobo polarvortexrobo is offline
Registered User
FRC #5637
 
Join Date: Feb 2015
Location: Minneapolis, MN
Posts: 5
polarvortexrobo is an unknown quantity at this point
Controlling Motors in Auto

Hi! I am first year programmer, this is our first year doing robotics. We are using LabView to program our robot.

I have a question about controlling motors in Auto. I looked at the sample code found in the Auto code in LabView. But it's for moving the robot.Now, my question is, is it the same way when you want to move other motors? I tried it but I probably did something wrong. I erased the work that I did.

And if possible, I would appreciate some tips on what not to do in Auto.

Thanks in advance,
from 5637 - Polar Vortex
Reply With Quote
  #2   Spotlight this post!  
Unread 20-03-2015, 19:57
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,748
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: Controlling Motors in Auto

The principle idea is the same. You will generally make a sequence of value updates, wait for time, wait for a sensor, perhaps some logic paths based on a sensor input or an auto parameter, and you will tweak it a number of times to tune the values.

I believe the top code shows how to make a literal sequence of blocks that move the robot. It would be pretty easy to update this to move forward to another zone.

The other code, with the loop, is more general in that it executes based on a recipe. The array of movements is perhaps easier to read or generate, and can be enhanced to include other robot actuator elements too.

Auto will automatically stop after 15 seconds, ending any infinite loops or anything else you happen to put into auto. So I'd say the primary things to avoid are side-effects such as closing I/O refnums or setting globals or motors to wonky values that you don't correct during disable or at the beginning of teleOp.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 20-03-2015, 21:42
stopyourself stopyourself is offline
Registered User
FRC #2335 (Sargon)
Team Role: Leadership
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Prairie Village
Posts: 35
stopyourself is on a distinguished road
Re: Controlling Motors in Auto

As another rookie programmer, I can't explain the details to you very well but might be able to help you past some rookie mistakes. This picture would be moving the robot during auto using a flat sequence structure.
You can either use a flat sequence structure or while loops to do autonomous. Make sure you call the motor every 50ms or so -- if you tell it to do something once every 3 seconds or so, it will shut off after 0.5 seconds. Also, I've heard excessive while loops (bad stop conditions?) will bog up the processors and make it run slower. If you encounter this, fix that.
__________________
2013-2016: Team 2335
Reply With Quote
  #4   Spotlight this post!  
Unread 21-03-2015, 00:28
mshafer1 mshafer1 is offline
Programming Mentor
AKA: Matthew Shafer
FRC #3937 (Breakaway)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2008
Location: Arkansas
Posts: 53
mshafer1 is an unknown quantity at this point
Re: Controlling Motors in Auto

Quote:
Originally Posted by stopyourself View Post
As another rookie programmer, I can't explain the details to you very well but might be able to help you past some rookie mistakes. This picture would be moving the robot during auto using a flat sequence structure.
....
You can either use a flat sequence structure or while loops to do autonomous. Make sure you call the motor every 50ms or so -- if you tell it to do something once every 3 seconds or so, it will shut off after 0.5 seconds. Also, I've heard excessive while loops (bad stop conditions?) will bog up the processors and make it run slower. If you encounter this, fix that.
Stopyourself has made some good points.

Most important thing I can tell you is comment like crazy - you won't remember which frame is doing what once you get past about frame four.

Also, if at all possible, do not use time for the delay. There are some cases where there is no alternative (drive, unless you put encoders on for some reason), but the output will vary greatly with battery voltage, and even if it holds through qualifier matches, the quick turn around of eliminations will sink the battery, making the robot take longer to move the same distance.

I have tried to show some different simple things that can be used, a flat sequence, a time delay (some times its the only option ), and a limit switch, also some of the different places you can put comments.

Feel free to email me for help (click on my username and select send an email)
Attached Thumbnails
Click image for larger version

Name:	auto.png
Views:	49
Size:	66.1 KB
ID:	18695  

Last edited by mshafer1 : 21-03-2015 at 00:34. Reason: attaching image
Reply With Quote
  #5   Spotlight this post!  
Unread 21-03-2015, 17:55
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,748
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: Controlling Motors in Auto

A few clarifications:
Single motors do not have safety enabled by default. You can turn it on, and if you do, you will need to update the value by the deadline or the safety timer will zero them and print a message. Robot Drive does have safety on by default, though you can disable it if you are careful how you debug. RobotDrive has a Delay block that internally loops and feeds, and you do not need to disable or use traditional wait function.

As mentioned, you should consider using other sensors and not just time for your auto, though many robots have a reasonably good auto with just time.

Greg McKaskle
Reply With Quote
  #6   Spotlight this post!  
Unread 24-03-2015, 22:12
polarvortexrobo polarvortexrobo is offline
Registered User
FRC #5637
 
Join Date: Feb 2015
Location: Minneapolis, MN
Posts: 5
polarvortexrobo is an unknown quantity at this point
Re: Controlling Motors in Auto

Thank you for the replies and pictures! I would try to build an auto program based on all of the information. I will get back to you guys with more questions.
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 18:44.

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