Go to Post if you've got the guts you will get the job done. - JamesCH95 [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 11-02-2015, 15:24
btcshields6 btcshields6 is offline
Registered User
FRC #4206
 
Join Date: Aug 2014
Location: Texas
Posts: 107
btcshields6 is an unknown quantity at this point
Controlling Motor Turns Autonomous

Hey all. Just a quick question. When not using encoders, can you control how many revolutions your motor should turn during an autonomous period, or do you have to control them using time specifications?

Also, how can I program autonomous to automatically switch to teleop when 15 seconds has happened?
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2015, 17:26
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: Controlling Motor Turns Autonomous

You can control just about anything you can measure. To control the number of revolutions of a shaft, you need to measure the shaft revolutions. That's something encoders are good at. What kind of motor is it, what kind of gearbox are you using, and what is it connected to?

Your program does not control whether the robot is in Autonomous or Teleoperated mode. That's done by the Driver Station, and on a competition field the Driver Station is told to command the appropriate mode at the appropriate time by the Field Management System.

You can use "practice mode" on the Driver Station to run it through a timed sequence of disabled, autonomous, teleoperated, and disabled again. If you want to, you can modify the timing on the DS setup tab.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-02-2015, 18:47
btcshields6 btcshields6 is offline
Registered User
FRC #4206
 
Join Date: Aug 2014
Location: Texas
Posts: 107
btcshields6 is an unknown quantity at this point
Re: Controlling Motor Turns Autonomous

We're using these encoders: http://www.andymark.com/product-p/am-0180.htm

I'd like to use them on our drive train during autonomous (which has no gearbox (it's just a cim on each side)), and on our lead screw lift mechanism during teleop to hit various levels.

I've looked at some previous posts about encoders, and also at the Team 358 example, but I'm still a little lost at how to program and/or mount them.
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2015, 19:46
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Controlling Motor Turns Autonomous

Quote:
Originally Posted by btcshields6 View Post
our drive train ... has no gearbox (it's just a cim on each side)
You're probably not going to be too happy with that arrangement.


Reply With Quote
  #5   Spotlight this post!  
Unread 12-02-2015, 20:20
PAR_WIG1350's Avatar
PAR_WIG1350 PAR_WIG1350 is offline
Registered User
AKA: Alan Wells
FRC #1350 (Rambots)
Team Role: Alumni
 
Join Date: Dec 2009
Rookie Year: 2009
Location: Rhode Island
Posts: 1,189
PAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond repute
Re: Controlling Motor Turns Autonomous

Quote:
Originally Posted by btcshields6 View Post
...drive train during autonomous (which has no gearbox (it's just a cim on each side)), and on our lead screw lift mechanism during teleop to hit various levels...
Have you confirmed that you can drive without tripping the 40 amp breakers?
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 12-02-2015, 21:38
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: Controlling Motor Turns Autonomous

Quote:
Originally Posted by btcshields6 View Post
...I'm still a little lost at how to program and/or mount them.
The Encoder example in LabVIEW shows how to wire and how to program them.

The am-0180 is designed to be attached to one of several specific gearboxes, or to a custom gearbox with the same short 1/4" shaft and mounting hole pattern. Mounting it is going to be rather problematic without such a gearbox.
Reply With Quote
  #7   Spotlight this post!  
Unread 13-02-2015, 00:32
btcshields6 btcshields6 is offline
Registered User
FRC #4206
 
Join Date: Aug 2014
Location: Texas
Posts: 107
btcshields6 is an unknown quantity at this point
I may be incorrect with my assessment of the gearbox. It's not similar to what we had last year, which I know to be a gearbox, so I might have made that assumption too soon. I'll post a picture in the morning. Thanks!
Reply With Quote
  #8   Spotlight this post!  
Unread 13-02-2015, 10:57
btcshields6 btcshields6 is offline
Registered User
FRC #4206
 
Join Date: Aug 2014
Location: Texas
Posts: 107
btcshields6 is an unknown quantity at this point
These two pictures sorta show what I'm working with. Click image for larger version

Name:	ImageUploadedByTapatalk1423843258.899381.jpg
Views:	41
Size:	289.7 KB
ID:	18324Click image for larger version

Name:	ImageUploadedByTapatalk1423843281.732194.jpg
Views:	39
Size:	252.2 KB
ID:	18325
Reply With Quote
  #9   Spotlight this post!  
Unread 13-02-2015, 11:21
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Controlling Motor Turns Autonomous

Quote:
Originally Posted by btcshields6 View Post
These two pictures sorta show what I'm working with. Attachment 18324Attachment 18325
The longitudinal axis of your CIM is clearly not concentric with the wheel axis. So there are some gears involved.


Reply With Quote
  #10   Spotlight this post!  
Unread 13-02-2015, 13:37
btcshields6 btcshields6 is offline
Registered User
FRC #4206
 
Join Date: Aug 2014
Location: Texas
Posts: 107
btcshields6 is an unknown quantity at this point
Re: Controlling Motor Turns Autonomous

You're right Ether. I'm sorry...I'm not the most mechanically minded member of the team. I've got someone mounting the encoder on an axle right now. I'm hoping to use it to control the motors during autonomous, but I'm not so sure what to do next. I'm going to try and use the Motor with Encoder example included with Labview, but it looks to me as if that gives me encoder information, not actual ways to affect the motors with that information. Not so sure really. I also have read something about PID. Where do I implement that?
Reply With Quote
  #11   Spotlight this post!  
Unread 13-02-2015, 13:42
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Controlling Motor Turns Autonomous

Quote:
Originally Posted by btcshields6 View Post
it looks to me as if that gives me encoder information, not actual ways to affect the motors with that information.
If the motor and the encoder are both mechanically linked to the gearbox, then the encoder can give information about the motor.

To get a jump-start to understanding PID, you may find the following YouTube video quite helpful:

https://www.youtube.com/watch?v=UOuR...n0gJUQ&index=2

Others can help you with LabVIEW implementation details.


Reply With Quote
  #12   Spotlight this post!  
Unread 13-02-2015, 15:52
btcshields6 btcshields6 is offline
Registered User
FRC #4206
 
Join Date: Aug 2014
Location: Texas
Posts: 107
btcshields6 is an unknown quantity at this point
That video did help. Thanks! Anyone have advice about labview implementation?
Reply With Quote
  #13   Spotlight this post!  
Unread 14-02-2015, 09:38
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: 58
mshafer1 is an unknown quantity at this point
Re: Controlling Motor Turns Autonomous

Quote:
Originally Posted by btcshields6 View Post
That video did help. Thanks! Anyone have advice about labview implementation?
Here is some example code of how one might implement a PID gain on the encoder to drive the robot in auto. Please refer to the a fore posted video for how to set the gains. Also, please ignore the comments before the sequence, they were just not deleted from the default auto.

Also, the stopped constants will likely need adjusted - it is .3 on our robot.

There are other options, like running the pid loop in parallel, and setting the instructions in the sequence (i.e. not in the loop with the pid), using a stacked sequence, or the array of actions that comes with the default auto (although you will likely want to change the contained cluster to contain a distance rather than a joystick y), although be careful to put a wait inside the parallel loop so it doesn't bog down the processor.

It could be argued that constantly resetting the encoders allows for more drift (inconsistent drive due to not hitting the set point exactly, and I would agree, it would be better to use absolute set points (in this example, 500, 1100, and 1600).

As far as automatically switching to Teleop, it is not appropriate to code it to (since that would require messing with how the robot decides with mode to drive), but you can run the driver station in practice mode, and with the settings correct, it will do this (i.e. 15s auto 0s delay between periods).
Attached Thumbnails
Click image for larger version

Name:	autoEncoder.png
Views:	36
Size:	112.9 KB
ID:	18346  
Reply With Quote
  #14   Spotlight this post!  
Unread 15-02-2015, 09:57
btcshields6 btcshields6 is offline
Registered User
FRC #4206
 
Join Date: Aug 2014
Location: Texas
Posts: 107
btcshields6 is an unknown quantity at this point
Thank you very much! That looks like it'll be a lot of help. I'll try to integrate it.

Thanks again!
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 21:27.

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