Go to Post None. Ours is anorexic at the moment. Lets see if the building people can come up with a simple tetra-knockdown mechanism. - Fixen [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-01-2013, 19:26
Stewie0056's Avatar
Stewie0056 Stewie0056 is offline
Registered User
FRC #3962 (Incognito Robotics)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Indiana, PA
Posts: 4
Stewie0056 is an unknown quantity at this point
Question Vision example controlled motors

Like all other teams we are trying to use our axis camera to track the retro reflective targets. there are many good examples and tutorials showing how to setup vision but they are all lacking one basic part. How do you control a motor with it? I have not seen a solid answer from any tutorial or forum. I seen on one of the posts that there is a value of 1 to -1 but I am unable to locate that in the example code.

For experimentation our team is using the example that came with lab view that lets you adjust the HSL to find your retro reflective target. so far we have the HSL tuned to find our target . The values are in the 90's but the numbers are blue(not sure why that is). The frame is following our target perfectly but is always displaying in accurate distances like 50 feet when we are about 6 feet away(again not sure why).

If someone could provide a picture or upload code that will move a motor to try and center the vision target in the center of the camera , I would greatly appreciate it
Reply With Quote
  #2   Spotlight this post!  
Unread 11-01-2013, 20:09
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,563
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: Vision example controlled motors

It's very hard to provide a generalized code, since everyone's robot is different.

Conceptually, it's very simple, if the target is left of the center of the camera, turn left, if the target is right of the center, turn right.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-01-2013, 20:43
Stewie0056's Avatar
Stewie0056 Stewie0056 is offline
Registered User
FRC #3962 (Incognito Robotics)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Indiana, PA
Posts: 4
Stewie0056 is an unknown quantity at this point
Re: Vision example controlled motors

It doesnt have to be specific to our robot. Even if you could add on to the example provided by in labview that would be helpful. We are using the Axis M1011 camera. and we have all types of motor controllers so it doesnt matter what gets used. I just need an example showing how the our target on the camera gets tied into moving a motor. From there i can create a code specific to our robot.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-01-2013, 20:54
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: Vision example controlled motors

Take a look at the attached example. It's just a very simple (and incomplete) example of how to use the tracked goal to center your robot on a target.

Basically, the PID block shown will try to turn the robot left and right (using values from -1 to 1) so that the Goal X that it is reading will approach 0 (the assumed center of the screen.)

Alternatively, you could simply code something along these lines: IF Goal X < 0, THEN Motor Output = 1, ELSE IF Goal X > 0, THEN Motor Output = -1. You get the idea.

(One other thing...because all the goals are different shapes, you probably will not be able to accurately read how far away from the goals you are.)
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	46
Size:	5.7 KB
ID:	13470  
Reply With Quote
  #5   Spotlight this post!  
Unread 11-01-2013, 21:44
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,751
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: Vision example controlled motors

As for the distance being off, how large is the target? The code uses assumptions about the physical target size to estimate distance. If you shrink the target rect, this illusion will cause the robot to think it is farther away.

Greg McKaskle
Reply With Quote
  #6   Spotlight this post!  
Unread 12-01-2013, 00:09
Stewie0056's Avatar
Stewie0056 Stewie0056 is offline
Registered User
FRC #3962 (Incognito Robotics)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Indiana, PA
Posts: 4
Stewie0056 is an unknown quantity at this point
Re: Vision example controlled motors

bvisness

i am not very familiar with PID controls but i plan to do some rearch and learn more. you code looks simple enough but i have one final question before i can test it. where does my "Goal X" get its data from. i know that there is a value of -1 to 1 in the vision example from NI that i need to route to the "goal X" but i cannot find where that value is at in the NI example.


Greg McKaskle

i have three targets made. one is 29x24(low goal), 54x21(middle goal), and 54x12(high goal). they all report inaccurate distances whether im using one or all three. would you happen to know what it means when your scores are in blue? the instructions say orange is too below, and green is above the limits but it says nothing about what blue means.
Reply With Quote
  #7   Spotlight this post!  
Unread 12-01-2013, 08:15
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,751
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: Vision example controlled motors

Blue means that the aspect ratio is more like the outer 2-point goals than the inner 3-point goal.

To debug the distance and other stuff, I'd recommend running on the PC, or if running on the cRIO, turn on the View buttons. This will let you see if the camera is in focus, is pointed at the targets, is too close, etc.

After that, you can trace the numbers being calculated through the Compute Distance VI. It is pretty simple code. It may not be obvious at first what it is doing, but it is not complicated. Please ask questions if something doesn't make sense and you've discovered why your numbers are off by that much.

Greg McKaskle
Reply With Quote
  #8   Spotlight this post!  
Unread 13-01-2013, 23:20
nickcvet89 nickcvet89 is offline
Registered User
FRC #1228 (RoboTribe)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2003
Location: Rahway,NJ
Posts: 99
nickcvet89 will become famous soon enough
Send a message via AIM to nickcvet89
Re: Vision example controlled motors

If you have any trouble on how to integrate the example code into your existing robot code, there is a tutorial if you go to the tutorials section when you first launch labview.
__________________
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 10:53.

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