int main (int argc, char** argv) { ros::init(argc, argv, "plane_extraction"); if (argc != 2 && argc != 4) { ROS_ERROR("Usage: %s <filename.pcd> [min_z max_z]", argv[0]); return 1; } PointCloud::Ptr cloud(new PointCloud); pcl::io::loadPCDFile(argv[1], *cloud); if (argc == 4) { float min_z = boost::lexical_cast<float>(argv[3]); float max_z = boost::lexical_cast<float>(argv[4]); pcl::PassThrough<PointT> pass_through; pass_through.setFilterFieldName("z"); pass_through.setFilterLimits(min_z, max_z); pass_through.setKeepOrganized(true); pass_through.setInputCloud(cloud); pass_through.filter(*cloud); ROS_INFO("Keep points in %.2f to %.2f range.", min_z, max_z); } PlaneExtractionTest pet(cloud); pet.run(); return 0; }
void Watchdog::sendMsg(char *msg) { // pet HW watchdog, part 1. // to do this you must call pet() before you do anything, then pet2() // before leaving this function (sendMsg). pet(); /* check time. if > 60 seconds since the last time we sent a message, send */ //grab current time and compare to the last time we sent _curmillis = millis(); if (_curmillis - _watchdog_millis > HW_SENDMSG_TIME) { _uptime += HW_SENDMSG_TIME; sprintf(_message, "%s %d.%d.%d.%d %lu ", msg, _arduino_ip[0], _arduino_ip[1], _arduino_ip[2], _arduino_ip[3], _uptime/1000); _client.beginPacket(_server_ip, _server_port); _client.write(_message); _client.endPacket(); if (_wd_debug == 1) Serial.println(_message); //update time so the next send happens in 60 s _watchdog_millis = millis(); } //pet HW watchdog, part 2 pet2(); }
void Watchdog::sendMsg(char *msg) { //Serial.println("sendmsg\n"); // pet HW watchdog pet(); if (_client.connected()) { _curmillis = millis(); /* if (Serial) { Serial.println(_curmillis - _watchdog_millis); } */ if (_curmillis - _watchdog_millis > 60000) { _uptime += 60000; sprintf(_message, "%s %d.%d.%d.%d %lu ", msg, _arduino_ip[0], _arduino_ip[1], _arduino_ip[2], _arduino_ip[3], _uptime/1000); _client.write(_message); if (Serial) Serial.println(_message); _watchdog_millis = millis(); } } else { _curmillis = millis(); if (_curmillis - _watchdog_millis > 60000) { _uptime += 60000; _watchdog_millis = millis(); } } // if the server's disconnected, loop to reconnect if (!_client.connected()) { if (millis() - _reconnect_millis > HW_RECONNECT_TIME) { _reconnect_millis = millis(); _client.stop(); if (Serial) Serial.println("Reconnecting, v2..."); if (_client.connect(_server_ip, _server_port)) { if (Serial) Serial.println("Connected"); } else { // if you didn't get a connection to the server: if (Serial) Serial.println("Failed connection"); } } } //pet HW watchdog, part 2 pet2(); /* if (Serial) { if (pin_low == true) Serial.println("pin low\n"); else Serial.println("pin high:\n"); }*/ }
/** * @brief Sestaveni celeho okna kalkulaci a pozicovani objektu */ MainWindow::MainWindow(QWidget *parent) : /* nize je napozicovany kazdy jednotlivy objekt kalkulacky, a take spusteni signalu */ QMainWindow(parent) { this->setWindowTitle("Kalkulačka Vořežpruti"); lcd = new QLCDNumber(10, this); lcd -> setGeometry(QRect(QPoint(50,50), QSize(200, 50))); clear_button = new QPushButton("C",this); clear_button -> setGeometry(QRect(QPoint(200,300), QSize(50,50))); connect(clear_button, SIGNAL(released()), this, SLOT(clear())); napoveda_button = new QPushButton("?", this); napoveda_button -> setGeometry(QRect(QPoint(125,400), QSize(50,50))); connect(napoveda_button, SIGNAL(released()), this, SLOT(napoveda())); rovno_button = new QPushButton("=", this); rovno_button -> setGeometry(QRect(QPoint(50,350), QSize(200,50))); connect(rovno_button, SIGNAL(released()), this, SLOT(rovno())); scitani_button = new QPushButton("+", this); scitani_button -> setGeometry(QRect(QPoint(50,100), QSize(50,50))); connect(scitani_button, SIGNAL(released()), this, SLOT(scitani())); nasobeni_button = new QPushButton("x", this); nasobeni_button -> setGeometry(QRect(QPoint(150,100), QSize(50,50))); connect(nasobeni_button, SIGNAL(released()), this, SLOT(nasobeni())); deleni_button = new QPushButton("/", this); deleni_button -> setGeometry(QRect(QPoint(200,100), QSize(50,50))); connect(deleni_button, SIGNAL(released()), this, SLOT(deleni())); odcitani_button = new QPushButton("-", this); odcitani_button -> setGeometry(QRect(QPoint(100,100), QSize(50,50))); connect(odcitani_button, SIGNAL(released()), this, SLOT(odcitani())); nula_button = new QPushButton("0", this); nula_button -> setGeometry(QRect(QPoint(50,300), QSize(50,50))); connect(nula_button, SIGNAL(released()), this, SLOT(nula())); jedna_button = new QPushButton("1", this); jedna_button -> setGeometry(QRect(QPoint(50,250), QSize(50,50))); connect(jedna_button, SIGNAL(released()), this, SLOT(jedna())); dva_button = new QPushButton("2", this); dva_button -> setGeometry(QRect(QPoint(100,250), QSize(50,50))); connect(dva_button, SIGNAL(released()), this, SLOT(dva())); tri_button = new QPushButton("3", this); tri_button -> setGeometry(QRect(QPoint(150,250), QSize(50,50))); connect(tri_button, SIGNAL(released()), this, SLOT(tri())); ctyri_button = new QPushButton("4", this); ctyri_button -> setGeometry(QRect(QPoint(50,200), QSize(50,50))); connect(ctyri_button, SIGNAL(released()), this, SLOT(ctyri())); pet_button = new QPushButton("5", this); pet_button -> setGeometry(QRect(QPoint(100,200), QSize(50,50))); connect(pet_button, SIGNAL(released()), this, SLOT(pet())); sest_button = new QPushButton("6", this); sest_button -> setGeometry(QRect(QPoint(150,200), QSize(50,50))); connect(sest_button, SIGNAL(released()), this, SLOT(sest())); sedm_button = new QPushButton("7", this); sedm_button -> setGeometry(QRect(QPoint(50,150), QSize(50,50))); connect(sedm_button, SIGNAL(released()), this, SLOT(sedm())); osm_button = new QPushButton("8", this); osm_button -> setGeometry(QRect(QPoint(100,150), QSize(50,50))); connect(osm_button, SIGNAL(released()), this, SLOT(osm())); devet_button = new QPushButton("9", this); devet_button -> setGeometry(QRect(QPoint(150,150), QSize(50,50))); connect(devet_button, SIGNAL(released()), this, SLOT(devet())); tecka_button = new QPushButton(".", this); tecka_button -> setGeometry(QRect(QPoint(100,300), QSize(50,50))); connect(tecka_button, SIGNAL(released()), this, SLOT(tecka())); faktorial_button = new QPushButton("!", this); faktorial_button -> setGeometry(QRect(QPoint(200,150), QSize(50,50))); connect(faktorial_button, SIGNAL(released()), this, SLOT(faktorial())); mocnina_button = new QPushButton("^", this); mocnina_button -> setGeometry(QRect(QPoint(200,200), QSize(50,50))); connect(mocnina_button, SIGNAL(released()), this, SLOT(mocnina())); odmocnina_button = new QPushButton("sqrt", this); odmocnina_button -> setGeometry(QRect(QPoint(200,250), QSize(50,50))); connect(odmocnina_button, SIGNAL(released()), this, SLOT(odmocnina())); negate_button = new QPushButton("+/-", this); negate_button -> setGeometry(QRect(QPoint(150,300), QSize(50,50))); connect(negate_button, SIGNAL(released()), this, SLOT(negate())); }