Go to Post It certainly shows to never give up, even if all you can do is score a single tetra. - Joe Ross [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 17-01-2013, 20:08
pickett pickett is offline
Registered User
FRC #0519
 
Join Date: Feb 2012
Rookie Year: 2003
Location: Michigan
Posts: 7
pickett is an unknown quantity at this point
180 turn on button press in labview

Hello all

I want to program two buttons that when pressed spin the robot 180 degrees then stops. Currently when I press the two buttons the robot turns slightly to the right. Help Please

My code is based off of telling the arcade drive to turn for a set amount of time and then stop. Attached code is placed in Teleop.

It takes about 5 sec to spin the robot in 180degrees under operator control.

How would I make the robot turn 180 deg using encoders on the gear box programing wise?

Thanks in advance
Attached Thumbnails
Click image for larger version

Name:	screenshot 1.PNG
Views:	72
Size:	57.1 KB
ID:	13550  
Reply With Quote
  #2   Spotlight this post!  
Unread 17-01-2013, 20:15
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: 180 turn on button press in labview

I think your problem is that you are checking if 100 or 40 is greater than or equal to your loop count. When you enter the loop, that counter will be 0, so it will exit the loop right away. You want LESS than or equal to - or you just need to swap the wires going into the comparison blocks you already have.

Also, you don't need to increment your loop counter - it increments itself every time the loop restarts.
Reply With Quote
  #3   Spotlight this post!  
Unread 17-01-2013, 20:17
ferret_guy ferret_guy is offline
Registered User
AKA: Mark Omo
FRC #1703 (RATS)
Team Role: Leadership
 
Join Date: Mar 2012
Rookie Year: 2008
Location: Henderson
Posts: 97
ferret_guy is on a distinguished road
I would place it in timed tasks for ease of use and roubostness
Reply With Quote
  #4   Spotlight this post!  
Unread 17-01-2013, 20:21
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: 180 turn on button press in labview

The problem is that teleop is operated sequentially with data communication. When you put the 5 second while loop in telop, no Driver Station communication occurs for those 5 seconds. There are various safety mechanisms that kick in and stop the robot if communication doesn't occur. That is why your code is stopping.
Reply With Quote
  #5   Spotlight this post!  
Unread 17-01-2013, 20:52
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: 180 turn on button press in labview

If you have encoders on your left and right wheels, the difference in values between the two tells you something about the direction your robot is facing. The conversion between encoder counts and robot heading is a function of the wheel circumference and the distance between left and right wheels.

What you will need to do is something like this:
  • Continuously compute the robot heading from the encoder values.
  • While the buttons aren't pressed, drive normally, but continuously save the current heading + 180 degrees as a target value.
  • While the buttons are pressed, turn in whatever direction will make your current heading approach the target.

You'll probably find that the robot overshoots the target and starts oscillating back and forth. That's when you should start learning how to use PID control.
Reply With Quote
  #6   Spotlight this post!  
Unread 17-01-2013, 22:31
Suitster's Avatar
Suitster Suitster is offline
Registered User
AKA: Ethan Pellittiere
FRC #3951 (SUITS)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Honeoye
Posts: 79
Suitster is on a distinguished road
Re: 180 turn on button press in labview

We did something similar to that last year in order for our robot to drive forward for an interval, then stop and actuate it's bridge manipulator.

Anyone on Curie field that saw the big black robot crash full-speed into the bridge during autonomous (twice ) saw how well that worked out.

The best we could tell, any variation that uses up processing speed would make the action take longer than anticipated, and we used a similar method to yours.

I would recommend using encoders
__________________
2012 FLR Regional Champs, with 1507 and 191
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:47.

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