Go to Post Brandon Martus, making CD readers' lives easier since May 2001/Fall 98 - Beth Sweet [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 23-02-2014, 18:21
zombieslayer16 zombieslayer16 is offline
Registered User
FRC #3460
 
Join Date: Jan 2012
Location: New York
Posts: 3
zombieslayer16 is an unknown quantity at this point
Help with speed control set up

We are using a sonar sensor with our robot, we want the the robot to slow to a stop when in a certain range of the wall. That range is defined at the average of the minimum and maximum values defined by the driver station. I know we could implement a more elegant solution but with our limited programming skill this is the best we could come up with. The problem is that when the button is held down the robot seems to constantly go at a slow speed and never slows to a stop, even when started at the stopping point and the button is held.

Thanks in advanced
Attached Files
File Type: vi Untitled 1.vi (18.3 KB, 10 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 23-02-2014, 19:02
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Help with speed control set up

Have you run it in debug mode and probed the values to see if they are what you expect?

A couple of problems with the loop itself:
- That loop does need a delay to avoid maxing out the CPU as it's doing now.
- That loop executes only once. When you really use it is it inside some other loop or are you using the continuously looping debug (the button with two arrows chasing each other)?

It's difficult to tell how your math works itself out.
What are typical values you are using for Sonar Min and Sonar Max?
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 23-02-2014 at 20:16.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-02-2014, 19:14
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: Help with speed control set up

Where did you place this code?

It's a "while loop" that terminates immediately, and there aren't any shift registers to maintain values from one execution of the loop to the next, so it's just as if there were no loop at all.
Reply With Quote
  #4   Spotlight this post!  
Unread 23-02-2014, 21:08
zombieslayer16 zombieslayer16 is offline
Registered User
FRC #3460
 
Join Date: Jan 2012
Location: New York
Posts: 3
zombieslayer16 is an unknown quantity at this point
Re: Help with speed control set up

I was trying to show that piece of code by itself, this actually goes inside our teleop VI. I tested the values of, the numbers seem to come out fine. We usually have the min and max set to 60 to 90 respectively.
Attached Files
File Type: vi Teleop.vi (68.7 KB, 8 views)
Reply With Quote
  #5   Spotlight this post!  
Unread 23-02-2014, 22:00
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Help with speed control set up

It seems like the value at the test for <= 6 can never be lower than 75.
That's the only test that is capable of outputting a speed of 0 while button 10 is pressed.

(60+90)/2-0v/.0098=75
(60+90)/2-5v/.0098=435
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 23-02-2014 at 22:05.
Reply With Quote
  #6   Spotlight this post!  
Unread 26-02-2014, 09:35
Jmulderig Jmulderig is offline
Registered User
FRC #3460
 
Join Date: Feb 2012
Location: Brentwood
Posts: 21
Jmulderig is an unknown quantity at this point
Mark wouldn't the 5v be -435. So if the voltage was .735 then your final would be 0?
Reply With Quote
  #7   Spotlight this post!  
Unread 26-02-2014, 09:44
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Help with speed control set up

Opps, yes. Although, the <=6 test uses an absolute value there is a small gap where the result will dip down < 6.
Thanks for the correction Jake.
I was working on three different team codes at once and started getting them confused. In addition to this mistake, I also mixed up the code and sent Connectquot this sonar code by accident. Long days.

So, there is a pretty small range where the motor should be moving.
They did say they probed the numbers and were satisfied with what they saw.
I assume that means that the sensor values changed properly according to distance. Plugging the sensor in backwards for instance would probably result in a constant unchanging voltage.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 27-02-2014 at 09:02.
Reply With Quote
  #8   Spotlight this post!  
Unread 26-02-2014, 11:26
Jmulderig Jmulderig is offline
Registered User
FRC #3460
 
Join Date: Feb 2012
Location: Brentwood
Posts: 21
Jmulderig is an unknown quantity at this point
Re: Help with speed control set up

haha yes mark my eyes are not as straight as they were 6 weeks ago either...
yes we got all appropriate outputs from the sensor when we look at the drivers station reading. we then positioned the robot at the exact avg out put held button 10 and the robot still took off when we moved the joystick we were getting it to slow down a little maybe to the first step but that range was hard to judge in our confined space.

I know edwin even made a little applet in labview using that same code that we could type in a sonar value and joystic value and it would tell us the moptor output and that all worked well.
Reply With Quote
  #9   Spotlight this post!  
Unread 26-02-2014, 12:04
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Help with speed control set up

The best suggestion I could make would be to run the code in debug with something in front of the sensor at the desired distance, then probe the code starting at the Motor Set Output and work backwards to identify where the non-zero value is being set, and why the 0 isn't being set.

I'll see if I can test your code on a robot with a range sensor, maybe tonight.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #10   Spotlight this post!  
Unread 26-02-2014, 12:16
Jmulderig Jmulderig is offline
Registered User
FRC #3460
 
Join Date: Feb 2012
Location: Brentwood
Posts: 21
Jmulderig is an unknown quantity at this point
Re: Help with speed control set up

ok thanks
Reply With Quote
  #11   Spotlight this post!  
Unread 27-02-2014, 08:57
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Help with speed control set up

Because the <=6 test uses absolute value there is a very tiny range .0588v wide where the test will pass.
This is what I forgot before when I did that quick min/max calculation (and I forgot to note that it was absolute value).

Specifically, from the raw sensor readings:
  • 0v to 0.6761v fails the test
  • 0.6762 to 0.735 passes the test
  • 0.736 to 5.0v fails the test
I couldn't get my sensor to hit that tiny range last night and trigger a 0 speed.

I'd suggest positioning your sensor at the min and max of where you want the robot to be, take the sensor readings at both positions, and I wouldn't test for being between those two raw sensor marks. I'd just test for being less than the first one. The way it's setup now, if the robot doesn't stop within the 6" it overshoots the mark and drives away.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 27-02-2014 at 10:18.
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:13.

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