How to update the Virtual compass

We have a gyro that we know is working; we are sending the number values to the driver station via a printf statement, but we cannot get the virtual compass to display the data. We are using C++. Any help will be greatly appreciated.

Hi, I’m the other programmer from team 2603; I have noticed that when we declare the gyro within DashboardDataFormat.cpp and use it in the function to show the value in the compass, we get a watchdog error and it gets stuck in some kind of loop. How are other teams getting the gyro data into the compass?

bump

The heading indicator is part of the default Dashboard. It gets its data from the gyro code in the provided programming. I’m not familiar enough with C++ to give you any specific advice; perhaps someone else will jump in to tell you what to look for.

I’ll be that person to jump in. Assuming you are using the default dashboard code and have it properly included in your code, you probably don’t know that the default dashboard posts the same values to the dashboard all the time.

Looking at the code though, it looks like the gyro data is not sent at all. This is a perfect time for an exercise in dashboard coding. Hopefully by looking at the example code you can figure out the C++ to LabVIEW interface used. Just add another U8 (or whatever type is used for gyros) data field to the Digital portion of the dashboard packet, have it read your gyro data in, and in LabVIEW update the packet typedef to what you are using, open the Decode Digital module VI and read the new gyro data you included, and then conect that to the virtual gyro on the dashboard. If you need help with all that I might be able to take some LabVIEW screenshots tomorow when I’m back at the build

If I remember right, the default image code creates a new gyro and used the DashboardDataSender class to send the gyro information. I took it all out of our code because we don’t have one; but I distinctly remember seeing it there.

Thank you, but what needs to be put in place of the hard coded value?

I trust this won’t get any points for elegance, but in our case, we find the virtual compass on the driver station (straight out of the box) is updated along with the Vision Data, which at present, we don’t have, but this seems to get the compass heading updated by stubbing out the vision stuff:
// this comes from the example:
// dds->sendVisionData(0.0,
// gyro->GetAngle(),
// 0.0,
// targets[0].m_xPos / targets[0].m_xMax,
// targets);

// and we are able to swing the needle thusly:
vector<Target> targets;
dds->sendVisionData(0.0, m_Gyro->GetAngle(), 0.0, 0.0, targets);

This uses DashboardDataSender.cpp from the 2010 Image Demo.

Hope it helps,
David Fort
Mentor, Team 1001
Hacksaw

Ok, I found the example code you are talking about, now what I am wondering is how to get the DashboardDataSender to work in our code. I have tried simply declaring DashboardDataSender, but it returns an error saying that it does not name a type.

what does the gyro look like?