Go to Post I'm so conflicted right now. On one hand, you made the same page as a celebrity. On the other hand.... Justin Bieber. - Akash Rastogi [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 15-01-2014, 17:03
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Processed Image > Robot Movement Help Needed

I have spent the last week or so modifying the dashboard to be able to process the vision system for this year's game.



As you can see above, the dashboard is able to take our live incoming image and give back the specific scores pertaining to left and right, etc. We can also see the distance to the wall (not pictured because it's cut off currently, and it's also a little off on the math).

With that information and knowledge handy, I'm completely stumped on how to integrate it into the teleop or autonomous VIs and make the robot do things (such as move to 10 feet away from the wall, or turn 60 degrees to the left, etc.) based on score or distance away. If anyone considers themself a guru of vision, any help with pictured examples or a .pdf or something like that would be fantastic.
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #2   Spotlight this post!  
Unread 15-01-2014, 17:26
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: Processed Image > Robot Movement Help Needed

Quote:
Originally Posted by BenGrapevine View Post
I have spent the last week or so modifying the dashboard to be able to process the vision system for this year's game.



As you can see above, the dashboard is able to take our live incoming image and give back the specific scores pertaining to left and right, etc. We can also see the distance to the wall (not pictured because it's cut off currently, and it's also a little off on the math).

With that information and knowledge handy, I'm completely stumped on how to integrate it into the teleop or autonomous VIs and make the robot do things (such as move to 10 feet away from the wall, or turn 60 degrees to the left, etc.) based on score or distance away. If anyone considers themself a guru of vision, any help with pictured examples or a .pdf or something like that would be fantastic.
To my understanding, you are getting distance to the wall like you said. My team has used closed loop control (PID) to do similar tasks such as moving a certain distance. A some what older CD thread is about a mentor's book he wrote about labview, and in it he goes into detail about pid control. I think that would be a great start to your problem at hand.

http://www.chiefdelphi.com/forums/sh....php?p=1297945
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
Reply With Quote
  #3   Spotlight this post!  
Unread 15-01-2014, 17:28
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Processed Image > Robot Movement Help Needed

Alright thanks for the link, looking into it now.
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #4   Spotlight this post!  
Unread 15-01-2014, 17:44
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Processed Image > Robot Movement Help Needed

Okay to be more specific:

How do I take information being created in one VI project and give it to another?

e.g. Scores from dashboard.lvproj and transmit that to robotcode.lvproj (teleop.vi and the like)

I get that once that information is in the VI, the world is open to possibilities with PIDs and etc, but I can't seem to get there yet.
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #5   Spotlight this post!  
Unread 15-01-2014, 23:02
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: Processed Image > Robot Movement Help Needed

You can take your targeting cluster, flatten to a string, UDP Write (port 1130) to the Robot. On the robot you have a UDP listener on port 1130 that reads that string, performs an unflatten from string back into a similar cluster on your robot code.
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics



Last edited by Phalanx : 15-01-2014 at 23:22. Reason: Add more detail
Reply With Quote
  #6   Spotlight this post!  
Unread 15-01-2014, 23:46
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: Processed Image > Robot Movement Help Needed

You can transfer a value or cluster via UDP as Michael suggested. You can also use SmartDashboard variables (via the Network Tables infrastructure) to share the values between the Dashboard and the robot program.
Reply With Quote
  #7   Spotlight this post!  
Unread 16-01-2014, 07:00
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,752
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: Processed Image > Robot Movement Help Needed

Part 3 of the tutorial, step 5, shows a picture of flattening and sending the string via network tables.

To compare the choices:
1. Unbundle and write individual elements using network tables/smart dashboard:
a. This may be the simplest to approach.
b. You will be restricted to the types supported by network tables.
c. It is possible that the elements do not arrive at the same time. If you write ten elements, five may be delivered now and the other five in 100ms.
2. Flatten the cluster and write it using SD/NT.
a. This is similarly simple, but involves flattening and unflattening data.
b. You must match the types exactly. An int and a float aren't the same, and order matters.
3. Format or flatten to a string and write using TCP.
a. This is still not hard, but you need to use the TCP nodes in addition to flattening or string formatting functions. You also need to unflatten or parse the string on the other end.
b. You need to specify the correct port that will be opened on a official field.
c. This is how NT/SD works under the hood.
4. Format or flatten and write using UDP.
a. Similar to TCP, but some find UDP easier to understand.
b. UDP isn't guaranteed to arrive, though for repetitive writes, you can typically ignore this.
c. Be sure to use the correct ports for UDP, not the TCP ones.

Once the data is sent, you need to read it on the robot. You can put the SD/NT reads almost anywhere, but I'd suggest Periodic tasks. TCP and UDP should really go there and not in auto or tele code. Once you have it in periodic, reform your cluster and write it to a global. Read the global in auto or tele.

Greg McKaskle
Reply With Quote
  #8   Spotlight this post!  
Unread 16-01-2014, 12:49
Invictus3593's Avatar
Invictus3593 Invictus3593 is offline
time you like wasting is not wasted
FRC #3593 (Team Invictus)
Team Role: Leadership
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Tulsa, OK
Posts: 318
Invictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really nice
Re: Processed Image > Robot Movement Help Needed

I agree with Greg, Periodic Tasks>Global is the way to go for sure.
__________________
Per Audacia Ad Astra
Reply With Quote
  #9   Spotlight this post!  
Unread 16-01-2014, 16:51
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Processed Image > Robot Movement Help Needed

Alright, I've flattened the distance information to a string and did some poking around with SD/NT and I'm getting pretty confused. I've got it writing a string array to a SmartDashboard table which, like the tutorial shows, calls it "Distances". I was seeing some Network Tables .vis that were calling for the cRIO IP address to start communicating information but I know absolutely nothing about it and I don't know how SD and NT relate to each other, if at all. Though I've got a hold on reading it on the robot once the information is received (as far as I know, I haven't done it before), what's the next step for establishing a TCP or UDP connection in the Dashboard the Robot? I feel like it's right there in the Network Tables palette but I can't figure it out.

EDIT: I apologize if my battery of questions are annoying, I've spent 4 years looking into vision and it's a miracle the dashboard can see shapes as of Tuesday and I'm excited but know nothing more about the subject.
__________________
Millerbots Team 2549
orange and blue

Last edited by BenGrapevine : 16-01-2014 at 16:57.
Reply With Quote
  #10   Spotlight this post!  
Unread 16-01-2014, 16:52
Animal Control's Avatar
Animal Control Animal Control is offline
Registered User
FRC #2345
 
Join Date: Jan 2014
Rookie Year: 2007
Location: Kearney, MO
Posts: 72
Animal Control is infamous around these partsAnimal Control is infamous around these partsAnimal Control is infamous around these partsAnimal Control is infamous around these parts
Re: Processed Image > Robot Movement Help Needed

This is unrelated but do you know if we can put color sensors on the robot?
Reply With Quote
  #11   Spotlight this post!  
Unread 16-01-2014, 17:09
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Processed Image > Robot Movement Help Needed

UPDATE: I found UDP write but I don't know what information on the .vi means what? What is the difference between Connection ID and Address?

EDIT: Man I'm stupid 'detailed help' is a life saver.

EDIT 2: It's not as much of a life saver as I thought, I still don't know what they mean.
__________________
Millerbots Team 2549
orange and blue

Last edited by BenGrapevine : 16-01-2014 at 17:14.
Reply With Quote
  #12   Spotlight this post!  
Unread 16-01-2014, 17:44
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: Processed Image > Robot Movement Help Needed

Quote:
Originally Posted by BenGrapevine View Post
Alright, I've flattened the distance information to a string and did some poking around with SD/NT and I'm getting pretty confused. I've got it writing a string array to a SmartDashboard table which, like the tutorial shows, calls it "Distances". I was seeing some Network Tables .vis that were calling for the cRIO IP address to start communicating information but I know absolutely nothing about it and I don't know how SD and NT relate to each other, if at all. Though I've got a hold on reading it on the robot once the information is received (as far as I know, I haven't done it before), what's the next step for establishing a TCP or UDP connection in the Dashboard the Robot? I feel like it's right there in the Network Tables palette but I can't figure it out.
Both the Dashboard and the Robot code have all of the behind the scenes "stuff" to send/receive SmartDashboard data. All you need to do is write on the dashboard and read on the robot side.
Reply With Quote
  #13   Spotlight this post!  
Unread 16-01-2014, 18:11
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,752
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: Processed Image > Robot Movement Help Needed

As Joe said. NT and SD are already in the template code. So that it isn't magic, let me answer a few of your questions.

Network Tables is a name for the networked variables. The variables have a path that organizes them hierarchically and you can think of the elements at the same level of hierarchy as a table of variables.

Smart Dashboard is really the same thing, but we put all of the variables into the /SmartDashboard/ table. This simply isolates them from some book keeping areas and avoids a bit of clutter.

The LabVIEW Dashboard has a loop that calls the NT Binding function. It is loop 3. It takes in a list of controls and indicators that are then bound to the identically named NT variables. The loop keeps it running even if the robot disconnects and reappears.

The LabVIEW robot template has Robot Main start the NT Server. It is just below the loop towards the bottom of the window.

With those two pieces running, you should simply need to use SD VIs to read and write data. Make sure the name and datatype matches.

On the dashboard, there is a second feature where you don't even need to use a read or write. By placing your control in the Operation or Auto tab and naming it will make a variable of that name and keep it synched to the robot where you can read or write it. This is more useful for simple checkboxes and numerics, but is not sufficient for more complex types like the cluster you are using.

Greg McKaskle
Reply With Quote
  #14   Spotlight this post!  
Unread 17-01-2014, 12:56
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Processed Image > Robot Movement Help Needed

Okay I have the dashboard flattening Distance information to a string, and then sending it to SD Write String, which should put it into it's hierarchy or whatever. Now in the PeriodicTasks.vi I have placed a SD Read String and made it unflatten the string like this:



What do I do with this unstrung data in regards to getting it global and moving to mutliple .vi's? I've never used globals before, and I can't find any documentation that talks about this step in the vision processing systems.

My end goal for this is to be able to see boxes (done), identify which boxes mean left and right by using a score system (done), calculate the distance the robot is from the wall (done), send that information from the dashboard to the robot code, interpret the score values it gets, and on a button pressing move to a specific xy location to line up a shot. I am just starting with distance so I can at least make the robot go a certain distance from the goal. After that is when I would like to look into turning the robot to face the goal straight on, or moving to be in an exact spot on the field.


Any help with moving forward on this is and will be appreciated.
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #15   Spotlight this post!  
Unread 17-01-2014, 14:43
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,752
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: Processed Image > Robot Movement Help Needed

The input to the unflatten node called "type" is used to describe what was flattened in the string. You need to wire the same datatype to type as you wired into the flatten node on the dashboard. It is often easiest to drag and drop directly from one window to the other to ensure they are the same. If you envision this changing, you should read up on typedefs as a means to share types between projects.

The robot project contains a file called robot global.vi. If you open that you'll see that there are already a few in use. To create another, drag your type into robot global and name it. You can now drag robot global from the project into tele op and periodic tasks and select the global to read or write.

Another thing you should do in the loop you show that reads the SD, unflattens, and updates the global is to add a delay. As written, this parallel loop requests that it run as fast as possible. This will max out the CPU. In reality, this loop probably needs to wait for 30ms or 50ms in parallel with the operations it contains. Notice that the other loops do this already with 10ms and 100ms wired up.

For more details on globals, please search the general LabVIEW help documentation.

Greg McKaskle
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:59.

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