本文整理汇总了C++中DriverStation::GetHighPriorityDashboardPacker方法的典型用法代码示例。如果您正苦于以下问题:C++ DriverStation::GetHighPriorityDashboardPacker方法的具体用法?C++ DriverStation::GetHighPriorityDashboardPacker怎么用?C++ DriverStation::GetHighPriorityDashboardPacker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DriverStation
的用法示例。
在下文中一共展示了DriverStation::GetHighPriorityDashboardPacker方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
DashboardSender::SendData(Robot1073 *p)
{
static unsigned int packetCt = 0;
float tempFloat;
DriverStation *ds = DriverStation::GetInstance();
Dashboard &dash = ds->GetHighPriorityDashboardPacker();
dash.AddCluster();
dash.AddU32(packetCt++);
dash.AddU32(0xFFFFFFFF);
unsigned short packData = 1;
if(p->IsEnabled()){packData += 2;}
if(false){packData += 4;} // has tube
if(p->IsOperatorControl()){packData += 8;}
else if(p->IsAutonomous()){packData += 16;}
else {packData += 24;}
if(false){packData += 32;} // has line
if(p->arm->IsUpLimitSwitchActive()){packData += 64;}
if(p->arm->IsDownLimitSwitchActive()){packData += 128;}
if(p->pincer->IsClosedLimitSwitchActive()){packData += 256;}
if(p->pincer->IsOpenLimitSwitchActive()){packData += 512;}
if(p->leftLineSensor->Get()){ packData += 1024; }
if(p->middleLineSensor->Get()){packData += 2048; }
if(p->rightLineSensor->Get()){packData += 4096; }
if(p->kraken->GetMode() != p->kraken->IdleMode ) { packData += 1 << 13; }
dash.AddU16(packData);
//printf("left = %d middle = %d right = %d\n", p->leftLineSensor->Get(),p->middleLineSensor->Get(),p->rightLineSensor->Get());
for (int i = 1; i <= 8; i++) {
tempFloat = (float) AnalogModule::GetInstance(1)->GetAverageVoltage(i);
dash.AddFloat(tempFloat); // analogs
//printf("Float %d = %fV\n", i, tempFloat);
}
int module = 1;
DigitalModule * digitalModule = DigitalModule::GetInstance(module);
unsigned char relayForward = digitalModule->GetRelayForward();
dash.AddU8(relayForward); // relays (forward)
dash.AddU8(DigitalModule::GetInstance(module)->GetRelayReverse()); // relays (reverse)
dash.AddU16((short)DigitalModule::GetInstance(module)->GetDIO()); // state
dash.AddU16(DigitalModule::GetInstance(module)->GetDIODirection());//direction
for (int i = 1; i <= 10; i++) {
dash.AddU8((unsigned char) DigitalModule::GetInstance(module)->GetPWM(i)); // pwm's
//printf("PWM %d %02X\n" ,i, DigitalModule::GetInstance(module)->GetPWM(i));
}
dash.AddFloat(p->matchTimer->GetTimeRemaining());
dash.AddFloat(ds->GetBatteryVoltage());
dash.AddFloat(p->gyro->GetAngle());
dash.AddFloat(p->leftJoystick->GetX());
dash.AddFloat(p->rightJoystick->GetX());
dash.AddFloat(p->leftJoystick->GetY());
dash.AddFloat(p->rightJoystick->GetY());
std::pair<double, double> lrDistance = p->encoders->GetDistance();
dash.AddFloat((float)lrDistance.first);
dash.AddFloat((float)lrDistance.second);
// Navigation Data
dash.AddFloat(p->navigation->GetX());
dash.AddFloat(p->navigation->GetY());
dash.AddFloat(5);//accel temp
dash.AddFloat(5);//accel temp
dash.AddFloat(p->navigation->GetXVelocity());
dash.AddFloat(p->navigation->GetYVelocity());
dash.AddFloat(sqrt(p->navigation->GetXVar()));
dash.AddFloat(sqrt(p->navigation->GetYVar()));
dash.AddFloat(p->navigation->GetHeading());
dash.AddFloat(p->elevator->GetCurrentPositionFeet());
dash.AddFloat(p->elevator->GetTargetPositionFeet());
// jags++
//+++++++++++++++++++++++
dash.AddFloat((float)p->leftMotorJaguar->GetOutputCurrent());
dash.AddFloat((float)p->rightMotorJaguar->GetOutputCurrent());
dash.AddFloat((float)p->pincerJaguar->GetOutputCurrent());
dash.AddFloat((float)p->armJaguar->GetOutputCurrent());
dash.AddFloat((float)p->elevatorJaguarMotorA->GetOutputCurrent());
dash.AddFloat(35); // pincher % open
dash.AddU32(dashboardIndex);
dash.AddFloat(p->matchTimer->GetElapsedTime());
dash.AddFloat((float)p->systemTimer->Get());
int x = p->GetTargetPole();
int y = (p->GetTargetFoot()+1)/2;
dash.AddU8(x);
dash.AddU8(y);
dash.AddFloat(p->navigation->GetHeadingToPeg(x));
dash.AddFloat(p->navigation->GetHeadingToBait(x));
dash.AddFloat(p->navigation->GetDistanceToPeg(x));
//.........这里部分代码省略.........