|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
UDP Server
Hi Guys,
I was wondering if anyone could help me understand how I would set up a udp server so I was able to process images on the laptop, than send that data to the robot. So I was wondering if someone could explain to me how to: send the images to the driverstation process those images on the driverstation send the processed data to the robot Thanks in advance, Dimitri |
|
#2
|
||||
|
||||
|
Re: UDP Server
I would start by reading some of the information that has already been posted to CD:
http://chiefdelphi.com/forums/showthread.php?p=1178173 If you have questions after that, feel free to post back. |
|
#3
|
||||
|
||||
|
Re: UDP Server
Thanks for the link, and sorry for the late repley. But I would really appreciate it if you could explain to me how this worked. I open the file they uploaded in netBeans, and loaded the libraries, but I didn't know what the classpath was and there was abunch of errors everywhere. Also if you could explain to me how the whole network thing worked I would greatly appreciate it. I know this is a lot to ask, so thanks in advance.
|
|
#4
|
||||
|
||||
|
Re: UDP Server
I fixed all the errors, but I still don't know what any of the code does.
Thanks, Dimitri |
|
#5
|
||||
|
||||
|
Re: UDP Server
Quote:
In terms of how sending images over the network works in general, most teams this year connected their cameras directly to the WiFi bridge on the robot, so the camera was part of the same network as the driver station and the cRIO. Thus, the driver station laptop can request images directly from the camera (the WPIlib libraries for all three languages contain code to do this), then the driver station can process these images. It's possible to write programs in any of the three languages to run on the driver station, or you could even use a language not supported by FIRST if you are feeling adventurous. You'll want to do as much processing on the driver station as you can to get the information into as compressed a form as possible, which will reduce the amount of network traffic. Ideally, you should only be sending back (pan, tilt, distance) triplets, (pan, motorSpeed), or something similar (obviously, the required information will depend on your robot's design). The only challenge remaining, then, is how to send the results of the processing back to the cRIO. You can roll your own communication channel using a raw UDP connection, but you can also use the SmartDashboard facilities built into WPIlib, which is what 341 did, which give you an easy way to communicate data values between the driver station and the cRIO, which is what it looks like 341 did (you can see them writing the values on lines 285-289 of DaisyCVWidget.java). |
|
#6
|
||||
|
||||
|
Re: UDP Server
I looked through the code again and I think I understand it, but what I don't get is how to use smartdashboard to send data to the robot
|
|
#7
|
||||
|
||||
|
Re: UDP Server
You use the Robot.getTable() in your dashboard extension, which returns a NetworkTable that you can use to set individual data elements (using putInt(...), putDouble(...), etc).
Then on the robot, you use SmartDashboard (which, if you look at its source, is basically a thin wrapper around the same NetworkTable as the Robot class returns to the dashboard extension) to retrieve those values. You can also use these classes in the opposite direction. The NetworkTable does the work of transferring the values between the robot and the dashboard and vice versa. |
|
#8
|
||||
|
||||
|
Re: UDP Server
So if my dashboard extension has
Code:
Robot.getTable().beginTransaction();
Robot.getTable().putBoolean("found", true);
Robot.getTable().putDouble("azimuth", azimuth);
Robot.getTable().putDouble("rpms", rpms);
Robot.getTable().endTransaction();
Code:
SmartDashboard().getDouble("azimuth");
|
|
#9
|
||||
|
||||
|
Re: UDP Server
It would be
Code:
new SmartDashboard().getDouble("azimuth");
|
|
#10
|
||||
|
||||
|
Re: UDP Server
what is propagation delay?
|
|
#11
|
||||
|
||||
|
Re: UDP Server
In this case, the time it takes changes to values in the NetworkTable made on either the driver station or the cRIo to show up on the other end.
This will be non-zero because it takes time to encode the values, send them over the network, then decode them on the other side. In most cases this will be 10s or 100s of milliseconds, unless you're sending a large amount of data. |
|
#12
|
||||
|
||||
|
Re: UDP Server
I was looking online and I found another vision project from another team. This like has the youtube video about the tracker and the link for the code is in the description.
http://www.youtube.com/watch?v=g0cluF0xdwY My problem however is that when I try to compile it is says there is no main class. Thanks for all you help so far, Dimitri |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|