USFirst.org
follow us on twitter
like us on facebookMNFTC.org
Bookmark and Share

Thanks

The team members of FRC Team 2220 would like to give a big thanks to all of the Sponsors, Mentors and Parents that make having this team possible.

Thank you!

Team Login



Dashboard Data Format.ccp Create PDF Send to Printer Email this Article
Written by TarinB   
Saturday, February 13 2010 16:46

 

#include "DashboardDataFormat.h"

 

DashboardDataFormat::DashboardDataFormat(void)

: m_ds (DriverStation::GetInstance())

{

}

 

DashboardDataFormat::~DashboardDataFormat()

{

}

 

/**

* Pack data using the correct types and in the correct order to match the

* default "Dashboard Datatype" in the LabVIEW Dashboard project.

*/

void DashboardDataFormat::PackAndSend(void)

{

Dashboard &dashboardPacker = m_ds->GetDashboardPacker();

UINT32 module;

UINT32 channel;

 

// Pack the analog modules

for (module = 0; module < kAnalogModules; module++)

{

dashboardPacker.AddCluster();

for (channel = 0; channel < kAnalogChannels; channel++)

{

dashboardPacker.AddFloat(m_AnalogChannels[module][channel]);

}

dashboardPacker.FinalizeCluster();

}

// Pack the digital module

for (module = 0; module < kDigitalModules; module++)

{

dashboardPacker.AddCluster();

dashboardPacker.AddU8(m_RelayFwd[module]);

dashboardPacker.AddU8(m_RelayRev[module]);

dashboardPacker.AddU16(m_DIOChannels[module]);

dashboardPacker.AddU16(m_DIOChannelsOutputEnable[module]);

dashboardPacker.AddCluster();

for(channel = 0; channel < kPwmChannels; channel++)

{

dashboardPacker.AddU8(m_PWMChannels[module][channel]);

}

dashboardPacker.FinalizeCluster();

dashboardPacker.FinalizeCluster();

}

// Pack the solenoid module

dashboardPacker.AddU8(m_SolenoidChannels);

// Pack user data

/* User data format (according to Dashboard Datatype):

* Ready to Fire (boolean)

* Turret Clockwise Limit (bool)

* Turret CC Limit (bool)

* Turret Heading (I32)

* Collector Jamming (bool)

*/

dashboardPacker.AddCluster();

dashboardPacker.AddBoolean(boolUserData[0]);

dashboardPacker.AddBoolean(boolUserData[1]);

dashboardPacker.AddBoolean(boolUserData[2]);

dashboardPacker.AddI32(intUserData);

dashboardPacker.AddBoolean(boolUserData[3]);

dashboardPacker.FinalizeCluster();

// Flush the data to the driver station.

dashboardPacker.Finalize();

}

 
Lockheed Martin
Valid XHTML 1.0 Transitional Valid CSS!
Blanda
Blanda
Copyright © 2012 Eagan Robotics. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.