Go to Post EXPERIMENT in the off season! - DonRotolo [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 01-02-2012, 14:41
cilginbilgin cilginbilgin is offline
Registered User
FRC #2905
 
Join Date: Jan 2010
Location: Istanbul,Turkey
Posts: 188
cilginbilgin is a jewel in the roughcilginbilgin is a jewel in the roughcilginbilgin is a jewel in the roughcilginbilgin is a jewel in the rough
Re: Autonomous with Ultrasonic sensor doesnt work!!

[/quote]
Quote:
Originally Posted by Chris Hibner View Post
The portion of the code in the "while loop" will run continuously. The portion outside of the "while loop" will only run once (as soon as autonomous starts), and will never run again. Therefore, the code that is checking the ultrasonic sensor is never checked after the start of autonomous.

Remove the "while loop" around the motors, and place the wh[IMG]C:\Users\Developer\Desktop\autonomouss.png[/IMG]ile loop around all of your code. That should fix the problem.
We put all of our autonomous code inside the while loop however the robot still doesnt do what we want. We would be really happy if you could help us.

Thanks in advance.

Last edited by cilginbilgin : 01-02-2012 at 14:48.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-02-2012, 14:43
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Autonomous with Ultrasonic sensor doesnt work!!

Quote:
Originally Posted by cilginbilgin View Post
We put all of our autonomous code inside the while loop however the robot still doesnt do what we want. We would be really happy if you could help us.

Thanks in advance.
Please post a picture of your new code.

Please see the post from MotorHead above. You autonomous code should look similar to his when your finished.
__________________
-
An ounce of perception is worth a pound of obscure.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2012, 15:12
cilginbilgin cilginbilgin is offline
Registered User
FRC #2905
 
Join Date: Jan 2010
Location: Istanbul,Turkey
Posts: 188
cilginbilgin is a jewel in the roughcilginbilgin is a jewel in the roughcilginbilgin is a jewel in the roughcilginbilgin is a jewel in the rough
Re: Autonomous with Ultrasonic sensor doesnt work!!

Quote:
Originally Posted by Chris Hibner View Post
Please post a picture of your new code.

Please see the post from MotorHead above. You autonomous code should look similar to his when your finished.
here are the pictures:
http://www.mypicx.com/02012012/Autonomous/

and I think my autonomous code is pretty same with MotorHead's.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2012, 15:37
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Autonomous with Ultrasonic sensor doesnt work!!

Your logic seems correct. However, you may not be getting anything from the ultrasonic sensor. See the attached image of the ultrasound example (the example can be found in (LabviewInstallFolder)/examples\FRC\Analog\EZ1 MB1010 Sonar Analog).

The example sets the averaging, sets sample rate, and then gets the voltage within the while loop. We tried moving the "set averaging" and "set sample rate" to Begin.vi, but the "analog get voltage" stopped working when we did that. Perhaps you need to add the "set averaging" and "set sample rate" into your while loop.


Can you describe the following:

1) How exactly is your robot behaving when you run autonomous?

2) When you run autonomous, what are you seeing from your "Distance" indicator?
Attached Thumbnails
Click image for larger version

Name:	UltrasoundExample.JPG
Views:	32
Size:	91.7 KB
ID:	11676  
__________________
-
An ounce of perception is worth a pound of obscure.
Reply With Quote
  #5   Spotlight this post!  
Unread 01-02-2012, 16:23
MotorHead's Avatar
MotorHead MotorHead is offline
Programming Mentor
AKA: Jeff Beltramo
FRC #1922 (OZ-Ram)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Concord, NH
Posts: 68
MotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to behold
Re: Autonomous with Ultrasonic sensor doesnt work!!

I haven't used the Ultrasonic yet, so I can't comment on its setup. I do have a problem with your logic. The way you currently are configured is: If distance >= to 40 then back up with y =-.4, If distance < 40, stop and activate solenoid.

The problem with this is you do not have a deadzone in which to stop. Your arrangement can cause the robot to excessively hunt about the setpoint of 40. Look again at the vi I posted. There is a nested case structure to test if you are above or below the setpoint or if you are within the acceptable deadzone, in which case, do nothing.
__________________
Jeff Beltramo
Team #1922
Concord, New Hampshire

Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2012, 08:07
cilginbilgin cilginbilgin is offline
Registered User
FRC #2905
 
Join Date: Jan 2010
Location: Istanbul,Turkey
Posts: 188
cilginbilgin is a jewel in the roughcilginbilgin is a jewel in the roughcilginbilgin is a jewel in the roughcilginbilgin is a jewel in the rough
Re: Autonomous with Ultrasonic sensor doesnt work!!

Quote:
Originally Posted by Chris Hibner View Post
Your logic seems correct. However, you may not be getting anything from the ultrasonic sensor. See the attached image of the ultrasound example (the example can be found in (LabviewInstallFolder)/examples\FRC\Analog\EZ1 MB1010 Sonar Analog).

The example sets the averaging, sets sample rate, and then gets the voltage within the while loop. We tried moving the "set averaging" and "set sample rate" to Begin.vi, but the "analog get voltage" stopped working when we did that. Perhaps you need to add the "set averaging" and "set sample rate" into your while loop.


Can you describe the following:

1) How exactly is your robot behaving when you run autonomous?

2) When you run autonomous, what are you seeing from your "Distance" indicator?
After we put set averagıng and set sample inside the while loop the code seems to be working however there is a small problem. Let x inches be the distance I want the robot to stop and to extend the piston. When I set robots position to some distance which is greater than x inches and run the code the robot stops and extends the piston at x-y inches. If I set robots position to x inches from the wall and run the code the robot doesnt move and extends the piston as I want. Is there anything I can do to avoid this problem or should I just tell the robot to stop at x+y inches to make it stop at x inches?


Quote:
Originally Posted by MotorHead View Post
I haven't used the Ultrasonic yet, so I can't comment on its setup. I do have a problem with your logic. The way you currently are configured is: If distance >= to 40 then back up with y =-.4, If distance < 40, stop and activate solenoid.

The problem with this is you do not have a deadzone in which to stop. Your arrangement can cause the robot to excessively hunt about the setpoint of 40. Look again at the vi I posted. There is a nested case structure to test if you are above or below the setpoint or if you are within the acceptable deadzone, in which case, do nothing.
It doesnt back up it goes forward with negative integers.


Thank you guys for your helps!!!!!
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2012, 08:32
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: Autonomous with Ultrasonic sensor doesnt work!!

Quote:
Originally Posted by cilginbilgin View Post
After we put set averagıng and set sample inside the while loop the code seems to be working however there is a small problem. Let x inches be the distance I want the robot to stop and to extend the piston. When I set robots position to some distance which is greater than x inches and run the code the robot stops and extends the piston at x-y inches. If I set robots position to x inches from the wall and run the code the robot doesnt move and extends the piston as I want. Is there anything I can do to avoid this problem or should I just tell the robot to stop at x+y inches to make it stop at x inches?
The robot is moving. Once you detect that you are at x and tell the drive motors to stop, the robot coasts to a halt y inches further on. You could set the motor speed controllers to "brake" mode so the robot stops immediately, though that can make driving it a little less easy.

Or you could control the motor speed based on how far away you are, slowing down as you approach the target distance so you don't overshoot. For example, set the motor output to a value proportional to the error between the desired location and the measured location. If your proportionality constant is too high, you will overshoot (and then perhaps back up to the target, depending on the details of the code). If the constant is too low, you will stop too soon, so you can use another term that increases motor speed based on how long the position error is present. You can also reduce power if you're approaching the target too quickly. Put it all together and you have PID control -- search the forums for more discussion and explanation.
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 11: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