void cliFuncStop(void *cmd, char *cmdLine) { if (state < ESC_STATE_NOCOMM) { serialPrint(runError); } else { runStop(); cliFuncChangeInput(ESC_INPUT_UART); serialPrint("ESC stopping\r\n"); } }
int main(int argc, char **argv) { ros::init(argc, argv, "RunStop"); ros::NodeHandle nh; std::string runStopPort; if(!nh.getParam("runStop/port", runStopPort)) { ROS_ERROR("Could not get all RunStop parameters"); return -1; } RunStop runStop(nh, runStopPort); ros::spin(); return 0; }
caStripPlot::caStripPlot(QWidget *parent): QwtPlot(parent) { timerID = false; thisXaxisType = TimeScale; HISTORY = 60; thisUnits = Second; thisPeriod = 60; NumberOfCurves = MAXCURVES; onInit = true; timeInterval = 1.0; setAutoReplot(false); setAutoFillBackground(true); Start = true; // define a grid plotGrid = new QwtPlotGrid(); plotGrid->attach(this); plotLayout()->setAlignCanvasToScales(true); // define our axis if(thisXaxisType == TimeScale) { setAxisScale(QwtPlot::xBottom, 0, HISTORY); } else { setAxisScale(QwtPlot::xBottom, -HISTORY, 0); } setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom); setAxisScale(QwtPlot::yLeft, 0, 1000); if(thisXaxisType == TimeScale) { // due to time scale we need some distance scaleWidget = axisWidget(QwtPlot::xBottom); const int fmh = QFontMetrics(scaleWidget->font()).height(); scaleWidget->setMinBorderDist(fmh * 2, fmh * 2); // define time axis QTime timeNow= QTime::currentTime(); setAxisScaleDraw ( QwtPlot::xBottom, new TimeScaleDraw ( timeNow ) ); } // define our curves for(int i=0; i< MAXCURVES; i++) { curve[i] = new QwtPlotCurve(); errorcurve[i] = new QwtPlotIntervalCurve(); fillcurve[i] = new QwtPlotIntervalCurve(); if(i>0) { curve[i]->setZ(curve[i]->z() - i); fillcurve[i]->setZ(fillcurve[i]->z() - i); errorcurve[i]->setZ(errorcurve[i]->z() - i); } curve[i]->attach(this); errorcurve[i]->attach(this); fillcurve[i]->attach(this); showCurve(i, false); thisYaxisLimitsMax[i] = 100; thisYaxisLimitsMin[i] = 0; } // default colors and styles setTitlePlot(""); setTitleX(""); setTitleY(""); setBackground(Qt::black); setForeground(QColor(133, 190, 232)); setScaleColor(Qt::black); setGrid(true); setGridColor(Qt::gray); for(int i=0; i< MAXCURVES; i++) setStyle(Lines, i); setColor(Qt::white, 0); setColor(Qt::red, 1); setColor(Qt::yellow, 2); setColor(Qt::cyan, 3); setColor(Qt::magenta, 4); setColor(Qt::green, 5); setColor(Qt::blue, 6); setXaxisEnabled(true); setYaxisEnabled(true); setLegendEnabled(true); setAxisFont(QwtPlot::xBottom, QFont("Arial", 10)); setAxisFont(QwtPlot::yLeft, QFont("Arial", 10)); installEventFilter(this); // display timer Timer = new QTimer(this); Timer->setInterval(1000); connect(Timer, SIGNAL(timeout()), this, SLOT(TimeOut())); // data collection thread timerThread = new stripplotthread(); timerThread->start(); timerThread->threadSetTimer(100); timerThread->setPriority(QThread::HighPriority); connect(this, SIGNAL(timerThreadStop()), timerThread, SLOT(runStop())); connect(timerThread, SIGNAL(update()), this, SLOT(TimeOutThread()), Qt::DirectConnection); }