本文整理汇总了C++中CANJaguar::GetSpeed方法的典型用法代码示例。如果您正苦于以下问题:C++ CANJaguar::GetSpeed方法的具体用法?C++ CANJaguar::GetSpeed怎么用?C++ CANJaguar::GetSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CANJaguar
的用法示例。
在下文中一共展示了CANJaguar::GetSpeed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateDashboardStatus
void UpdateDashboardStatus()
{
Dashboard &dashHigh = m_ds->GetHighPriorityDashboardPacker();
dashHigh.AddCluster(); // PID (not used for now)
dashHigh.AddDouble(0.0); // P
dashHigh.AddDouble(0.0); // I
dashHigh.AddDouble(0.0); // D
dashHigh.FinalizeCluster();
dashHigh.AddDouble(speedJag.GetSpeed()); // Current position
dashHigh.AddDouble(speedJag.Get()); // Setpoint
dashHigh.AddDouble(speedJag.GetOutputVoltage()); // Output Voltage
dashHigh.Finalize();
}
示例2: output
void output (void)
{
REDRUM;
if (IsAutonomous())
driverOut->PrintfLine(DriverStationLCD::kUser_Line1, "blaarag");
else if (IsOperatorControl())
{
REDRUM;
}
outputCounter++;
if (outputCounter % 30 == 0){
REDRUM;
driverOut->PrintfLine(DriverStationLCD::kUser_Line2, "Top Shooter RPM: %f",(float)LTop.GetSpeed());
driverOut->PrintfLine(DriverStationLCD::kUser_Line3, "Bot Shooter RPM: %f",(float)LBot.GetSpeed());
// driverOut->PrintfLine(DriverStationLCD::kUser_Line6, "Pilot Z-Axis: %f",pilot.GetZ());
}
if (outputCounter % 60 == 0){
REDRUM;
driverOut->PrintfLine(DriverStationLCD::kUser_Line4, "Top CANJag Temp: %f Celcius",LTop.GetTemperature()*(9/5) + 32);
driverOut->PrintfLine(DriverStationLCD::kUser_Line5, "Bot CANJag Temp: %f Celcius",LBot.GetTemperature()*(9/5) + 32);
outputCounter = 1;
}
driverOut->UpdateLCD();
}//nom nom nom
示例3: RunWheels
void RunWheels()
{
// uint32_t t0, t1, t2, t3;
// schedule updates to avoid overloading CAN bus or CPU
switch (report++) {
case 12: // 240 milliseconds
report = 0; // reset counter
case 0:
// Update PID parameters
double newP = SmartDashboard::GetNumber("Shooter P");
double newI = SmartDashboard::GetNumber("Shooter I");
double newD = SmartDashboard::GetNumber("Shooter D");
if (newP != kP || newI != kI || newD != kD) {
kP = newP;
kI = newI;
kD = newD;
#ifdef HAVE_TOP_WHEEL
if (topPID) {
#ifdef HAVE_TOP_CAN1
; // topWheel1->SetPID( kP, kI, kD );
#endif
#ifdef HAVE_TOP_CAN2
topWheel2->SetPID( kP, kI, kD );
#endif
}
#endif
#ifdef HAVE_BOTTOM_WHEEL
if (bottomPID) {
#ifdef HAVE_BOTTOM_CAN1
; // bottomWheel1->SetPID( kP, kI, kD );
#endif
#ifdef HAVE_BOTTOM_CAN2
bottomWheel2->SetPID( kP, kI, kD );
#endif
}
#endif
}
break;
case 4: // 80 milliseconds
#ifdef HAVE_TOP_WHEEL
//t0 = GetFPGATime();
// Get top output voltage, current and measured speed
#ifdef HAVE_TOP_CAN1
double topI1 = topWheel1->GetOutputCurrent();
#endif
#ifdef HAVE_TOP_CAN2
double topI2 = topWheel2->GetOutputCurrent();
topJagSpeed = topWheel2->GetSpeed();
#endif
//t1 = GetFPGATime();
topTachSpeed = topTach->PIDGet();
#ifdef HAVE_TOP_CAN1
// stupid floating point!
Log(LOG_CURRENT, 1, (uint32_t)(topI1 * 1000 + 0.5));
#endif
#ifdef HAVE_TOP_CAN2
Log(LOG_CURRENT, 2, (uint32_t)(topI2 * 1000 + 0.5));
Log(LOG_SPEED, 2, (uint32_t)(topJagSpeed + 0.5));
#endif
// Send values to SmartDashboard
#ifdef HAVE_TOP_CAN1
SmartDashboard::PutNumber("Top Current 1", topI1);
#endif
#ifdef HAVE_TOP_CAN2
SmartDashboard::PutNumber("Top Current 2", topI2);
SmartDashboard::PutNumber("Top Jag ", topJagSpeed);
#endif
SmartDashboard::PutNumber("Top Tach ", topTachSpeed);
// Get setpoint
topSpeed = SmartDashboard::GetNumber("Top Set ");
//t2 = GetFPGATime();
if (spinFastNow) {
if (topPID) {
if (topJagSpeed < topSpeed * vbusThreshold) {
topPID = false;
// below threshold: switch both motors to full output
#ifdef HAVE_TOP_CAN1
jagVbus(topWheel1, maxOutput);
Log(LOG_MODE, 1, 1);
#endif
#ifdef HAVE_TOP_PWM1
topWheel1->Set(maxOutput);
Log(LOG_MODE, 1, 1);
#endif
#ifdef HAVE_TOP_CAN2
jagVbus(topWheel2, maxOutput);
Log(LOG_MODE, 2, 1);
#endif
} else {
; // above threshold: run motor 1 off, PID on motor 2
#ifdef HAVE_TOP_CAN1
topWheel1->Set(0.0);
#endif
#ifdef HAVE_TOP_PWM1
//.........这里部分代码省略.........