Tips for C++ programming the 2010 control system

I had a little trouble getting the new WindRiver up and running so I thought I’d share a couple of things that I discovered or would recommend:

  1. Make sure you install the updates:
  1. Follow the directions in “Getting started with C++” from http://first.wpi.edu/FRC/frccupdates.html

  2. A couple of the examples didn’t work:

CameraToDashboardExample and SimpleTracker needed:

- right-click on the project and select Properties
- select the "Build Paths" tab
- click "Add"
- enter: -I$(WIND_BASE)/target/h/WPILib/Vision2009

CameraToDashBoardExample needed:

- open "cameraToDashboardExample.cpp"
- add: #include "WPILib.h"

Hope that helps someone!

Has anyone got the CameraToDashboardExample to actually work? I can compile it but I get nothing on the DriverStation. I notice that the driverstation program changes your IP address to 10.xx.yy.5 however the CameraToDashboardExample program says it is sending the images to 10.xx.yy.6 I tried setting up a remote dashboard with the IP10.xx.yy.6 but it is not able to connect to the robot at all.

Since there is no source code available yet, I can’t change the code to send to 10.xx.yy.5.

Any I missing something, or should I just be patient and wait for a fix to be released?

I could be wrong, but I think you just need to wait for the code to get updated and released. Last year, laptops attached to the dashboard would have the IP of 10.xx.yy.6, while the dashboard it self had 10.xx.yy.5. This year, because the dashboard and laptop are one item, the code needs to send its data to 10.xx.yy.5. Just wait until the new versions of the examples ship out and the updated verison of the CameraToDashboardExample sends to the correct IP.

Also, according to the 2010 WPLib Manual you should try using the 2010ImageDemo code sample.

Also, I can’t be 100% sure about this because I don’t have access to our robot right now, but I think all you need to do to populate the video box in the dashboard program is insert this in your code:

AxisCamera &camera = AxisCamera::getInstance();
camera.writeResolution(k320x240);
camera.writeBrightness(0);

Of course, adjust resolution and brightness as necessary.

According to WPI_Library_Users_Guide.pdf found on:
http://first.wpi.edu/FRC/frccupdates.html

All you need to do to populate that field is to call the camera getInstance method somewhere in your code.

Nope, that does not do anything (for the dashboard image)
all you need to do is create a PCVideoServer object

The code is automatically creating a PCVideo server instance when the camera is initialized. You should be able to see the images back at the dashboard if you have it running when the sample program starts running.

And if you have the newer dashboard with the targeting stuff, it should display the location of ellipses that were found. Green ones are the “acceptable” targets and magenta are the rest of the ellipses.

The 2010 Image demo should work, I just double checked it here. If it’s still not working for you, I’ll look around some more. I’m running with the dashboard and driver station on the same computer, both at the 10.x.y.6 IP address.

I did finally get it working today. The biggest issue I had is that the DSupdate did not update the dashboard. I only noticed because I installed the update on a second laptop and it looked different. I went back and checked the file date and it was not the same on the classmate. I had to run the DSupdate program, but tell it to uninstall, then run it again and install. Now it works.

  • Kevin

Brad-

What should I have my classmate’s IP address configured to?

I’m getting communications with the robot, and I have the camera tracking the target on a pan/tilt mount, but I’m not getting anything on the dashboard (nothing from the camera and nothing from the digital inputs/pwms either). The calls to DashboardDataSender are still there as per the 2010 Image demo.

I think the classmate sets itself to 10.xx.yy.5 when you go into the Driver Station account. You should probably leave it that when even if you are using for development.

If you use a separate laptop for development, you can set it to 10.xx.yy.6

Make sure your dashboard is actually updated as per my previous message (right before yours). You should see a compass type angle readout in the bottom-right corner. If you don’t have this then your Dashboard is not updated properly and you will have to uninstall it and then reinstall it using DSUpdate1.0for2010.zip

  • Kevin

Under
C:\WindRiver\vxworks-6.3 arget\h\WPIlib
I have a Vision and a Vision2009 folder
Should only Vision2009 be used this year?

The Vision dir is modern and what youd should use. The Vision2009 is the code from last year and is obsolete. Only there for old program compatibility.

The classmate can always be 10.xx.yy.5

You are running it locally? Are you getting an error from the data unpacking on the dashboard? Perhaps your data types don’t match.

Correct.

The robot is the server and the dashboard is the client. Therefore the IP address of the dashboard does not matter. It will connect to the robot to get images.

Remote dashboard is only used if you are running the dashboard on a different laptop than the driver station application. If you choose local, the packets will be sent to localhost.

There is source code available. What source are you waiting for? Look at http://firstforge.wpi.edu/sf/projects/wpilib

Yes, it is now. It was not when I posted.

The problem I had was that DSUpdate1.0for2010 did not in fact update the dashboard. It updated the driver station (the bottom window) but not the dashboard. I had to uninstall the old dashboard then reinstall the update for it to work. From several comments I have seen, I think many people have had this problem but not recognized it. Once the dashboard update installed properly the camera images appeared fine. The key thing to look for is if you have the gyro compass in the bottom-right corner of the dashboard. If you do not have this, then your update was not successful; you are still using the old version of the dashboard and you will not receive video.

  • Kevin