Log in

View Full Version : Porting Tower Tracker to CPP


Bernstern
18-03-2016, 17:03
Does anyone have a good way to translate (or if it already works its ok) the TowerTracker.java program into CPP to run on a Coprocessor (Tk1)?

jreneew2
18-03-2016, 17:20
I ported it to c++ here: https://github.com/team2053tigertronics/TestRobot2016/tree/master/TestRobot/src/vision

It's a little rough, but worked for us in Pittsburgh very well.

lethc
18-03-2016, 17:35
Does anyone have a good way to translate (or if it already works its ok) the TowerTracker.java program into CPP to run on a Coprocessor (Tk1)?

Just a heads up, we tried running TowerTracker on a TK1 at Greater Kansas City and spent literally all of Thursday trying to get it to communicate over ethernet. We got the calibration images we needed from the field about 30 seconds before we had to leave. The competition router image disables DHCP, and we hadn't planned for this. To fix it we had to set all of our devices' (Driver station, TK1, RoboRIO) IPs to static which took awhile because we hadn't planned for it.

Basically if you're planning on communication with the Jetson over ethernet make sure you account for the fact that the router competition image is different from the 'home use' image. I really don't want anybody to go through what we went through on Thursday:D

Arhowk
19-03-2016, 07:17
. The competition router image disables DHCP, and we hadn't planned for this.

No it doesn't? The field uses pure DHCP communications except for the router. You get assigned a dhcp IP address in the range of 10.xx.yy.zzz in contrast to the 169.254.xx.xx address in the pits.

Ben Wolsieffer
19-03-2016, 12:54
Just a heads up, we tried running TowerTracker on a TK1 at Greater Kansas City and spent literally all of Thursday trying to get it to communicate over ethernet. We got the calibration images we needed from the field about 30 seconds before we had to leave. The competition router image disables DHCP, and we hadn't planned for this. To fix it we had to set all of our devices' (Driver station, TK1, RoboRIO) IPs to static which took awhile because we hadn't planned for it.

Basically if you're planning on communication with the Jetson over ethernet make sure you account for the fact that the router competition image is different from the 'home use' image. I really don't want anybody to go through what we went through on Thursday:D

We ran into the same problem at our event. The competition bridge configuration doesn't disable DHCP, it just doesn't have a DHCP server (because it expects to use the one on the field). This causes the driver station and robot to get an autoconfigured IPv4 address (169.254.x.x), but the Jetson does not.

We fixed this at the competition by using static IPs, but it could likely also be fixed using avahi-autoipd (see: https://wiki.ubuntu.com/ZeroConfNetworking) to assign an IP without DHCP, but I have not tried this yet.

jreneew2
19-03-2016, 15:39
So when giving devices that run network tables an ip you can give it roboRIO-XXXX-frc.local? Or a static ip that you set?

Arhowk
19-03-2016, 16:31
So when giving devices that run network tables an ip you can give it roboRIO-XXXX-frc.local? Or a static ip that you set?


The former if you are using DHCP, the latter if your team is moved to static ip for some reason (the former still works in the second case but it is more reliable to go straight to the IP address if it is known)

jreneew2
19-03-2016, 17:08
Ok thanks!

Bernstern
20-03-2016, 14:30
I ported it to c++ here: https://github.com/team2053tigertronics/TestRobot2016/tree/master/TestRobot/src/vision

It's a little rough, but worked for us in Pittsburgh very well.

You're a lifesaver but how do i send the distance to center (all we need) over networktables and into our java code?

-Freshmen :)

jreneew2
20-03-2016, 14:43
Our team is actually working on that now! Except we are using a raspberry pi. For us, we compiled the network tables code onto to pi and included in our code. Then you just send the data as with any other code. Here is a wpi screensteps page I found that was helpful.

https://wpilib.screenstepslive.com/s/3120/m/7912/l/80205-writing-a-simple-networktables-program-in-c-and-java-with-a-java-client-pc-side

Bernstern
20-03-2016, 15:39
Our team is actually working on that now! Except we are using a raspberry pi. For us, we compiled the network tables code onto to pi and included in our code. Then you just send the data as with any other code. Here is a wpi screensteps page I found that was helpful.

https://wpilib.screenstepslive.com/s/3120/m/7912/l/80205-writing-a-simple-networktables-program-in-c-and-java-with-a-java-client-pc-side

Thanks a ton, we spent the last week trying to flash our tk1 then trying grip but this may be our answer :)

waialua359
20-03-2016, 15:53
Just a heads up, we tried running TowerTracker on a TK1 at Greater Kansas City and spent literally all of Thursday trying to get it to communicate over ethernet. We got the calibration images we needed from the field about 30 seconds before we had to leave. The competition router image disables DHCP, and we hadn't planned for this. To fix it we had to set all of our devices' (Driver station, TK1, RoboRIO) IPs to static which took awhile because we hadn't planned for it.

Basically if you're planning on communication with the Jetson over ethernet make sure you account for the fact that the router competition image is different from the 'home use' image. I really don't want anybody to go through what we went through on Thursday:D
We went through the same thing as you folks on that Thursday!😬 Spent 3 hours on it!

jreneew2
20-03-2016, 16:01
We went through the same thing as you folks on that Thursday!😬 Spent 3 hours on it!

So would you say it is better to set static ips for everything for competition? I have seen conflicting information about static and dynamic ips.

If so, how do you go about setting ips to static on the roborio, raspberry pi etc?

waialua359
20-03-2016, 16:05
So would you say it is better to set static ips for everything for competition? I have seen conflicting information about static and dynamic ips.

If so, how do you go about setting ips to static on the roborio, raspberry pi etc?

According to the manual, it is not recommended. However, FTA finally said to go ahead and setup using a static IP and gave us a range to work with. I'm not the Control Systems person, but I can tell you that he tried troubleshooting everything to get it to work. It was our only option.
It's worked fine for 2 events already.

jkelleyrtp
20-03-2016, 16:53
According to the manual, it is not recommended. However, FTA finally said to go ahead and setup using a static IP and gave us a range to work with. I'm not the Control Systems person, but I can tell you that he tried troubleshooting everything to get it to work. It was our only option.
It's worked fine for 2 events already.

What range did he give you? I want to make sure ours is good-to-go beforehand so we won't have to debug comms during practice matches.

Conor Ryan
21-03-2016, 08:21
What range did he give you? I want to make sure ours is good-to-go beforehand so we won't have to debug comms during practice matches.
If I'm not mistaken it should be:
10.xx.yy.<between 10 and 20>

That should be optimal. The higher the last number the longer it's going to take to connect.

Bernstern
21-03-2016, 10:47
We went through the same thing as you folks on that Thursday!😬 Spent 3 hours on it!

This morning when I tried to compile ubuntu spitted out WPIh doesn't exist halp?!?

Ben Wolsieffer
21-03-2016, 12:58
If I'm not mistaken it should be:
10.xx.yy.<between 10 and 20>

That should be optimal. The higher the last number the longer it's going to take to connect.

Why is that? I never heard that before.

Bernstern
21-03-2016, 13:22
Why is that? I never heard that before.

Im trying to compile in Visual Studio and opencv and wpiLIB are not existing, do I add them as external dependancies or do you have a better answer