|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Code for beaglebone and network camera
Thought I might as well share our team's starting code for the beaglebone and the network camera.
It is not quite done yet, we still have to deal with multiple targets, add in more filters, correct the measurements of the targets, etc. But it should provide a base to those who want to get started. Some gotchas to the beaglebone: 1. If your model is A4, then you will have to remove a resistor in order to get the ethernet to work. Here is a video randomly found on the internet showing you how to remove the resistor: http://www.youtube.com/watch?v=Ak30G-shiYY 2. Sometimes the file system gets a tad corrupted and the beaglebone will neither connect to a network or pop up as a usb drive when connected to the computer. The solution is simple, plug the microsd into a desktop computer and run fsck on it. 3. Opencv did not seem to work with the network camera on our beaglebone. We ended up just going directly with ffmpeg. 4. Ffmpeg was claiming that it did not have the mjpeg codec (even though it had mjpeg). Building ffmpeg from scratch fixed this. 5. We compiled everything on the beaglebone. Cross compiling was too much of a pain. This is how we are finding the angle to the target. 1. Use findContours to find the contours. 2. Use approxpolydp to find the points of the rectangles. 3. Use a filter that tosses out misshapen rectangles. 4. Use solvePnP to obtain the location of the target. 5. Use atan2 to obtain our angle to the target in the x-z plane. As for controlling the beaglebone we are going to have the beaglebone act as a TCP server and send messages back and forth with boost::asio. Hope that this is useful for some teams. |
|
#2
|
||||
|
||||
|
Re: Code for beaglebone and network camera
Wow, very interesting. So are you actually using the beaglebone on the robot this year, or is this only a proof-of-concept with the camera?
|
|
#3
|
|||
|
|||
|
Re: Code for beaglebone and network camera
Proof of concept so far. We will put it on the practice bot on Monday, and see how well it works on our target on a stick.
Otherwise it gives very accurate measurements with our printed out protractor. Last edited by Lalaland1125 : 25-02-2012 at 22:06. |
|
#4
|
||||
|
||||
|
Re: Code for beaglebone and network camera
Sweet, let us know what happens.
|
|
#5
|
||||||
|
||||||
|
Re: Code for beaglebone and network camera
Are you planning on using the Kinect Sensor with it?
One of my main cool projects I want to dig into in the off season is using the Kinect to find things like floors, corners, balls, steps, other robots... Dream big... Joe J. |
|
#6
|
|||
|
|||
|
Re: Code for beaglebone and network camera
For some reason we were having problems with the usb port on the beaglebone. After a couple days of tinkering around with usb cameras and the kinect we decided to cut our losses and move on with the network camera.
It just didn't seem to be giving enough power to the devices. |
|
#7
|
|||
|
|||
|
Re: Code for beaglebone and network camera
Quote:
|
|
#8
|
|||
|
|||
|
Re: Code for beaglebone and network camera
Quote:
Something very funky is obviously going on. We will look into the Kinect( and usb webcams) later, but the ip camera will work perfectly for now. There was actually 3 reasons why we got the beaglebone. 1. A lot more possibilities, with opencv, full C++ support, etc. We can practically do whatever we wish(and opencv does come with some pretty impressive functions, solvePnp being one of them). 2. We want all this technology to be separate from the drive system. This way, if the code is slow, if the code fails, etc, at least the robot will continue to drive and the driver can manually shoot. 3. We wanted the ability to use usb devices such as usb cameras(much cheaper/ faster), and the Kinect. 2 out of 3 is still pretty good as far as I can see it. Last edited by Lalaland1125 : 26-02-2012 at 00:44. |
|
#9
|
|||
|
|||
|
Re: Code for beaglebone and network camera
Quote:
|
|
#10
|
|||
|
|||
|
Re: Code for beaglebone and network camera
Quote:
When the robot goes through robot-init it tries to connect to the beaglebone, and sets a flag if it fails. We could simply show a light that the connection failed. As for the speed of doing this on the beaglebone, it is a 700 Mhz processor, and seems to do these calculations almost in real time. We could of course have it cache the previous calculations, and simply immediately return the "stale" value if needed, but I doubt that will be necessary. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|