int main(int argc, char** argv)
{

    if (argc != 3)
    {
        die_printf("Usage: %s <nitf/xml-file/nitf-dir> <sidd|sicd>\n", argv[0]);
    }

    // Is the data type SICD or SIDD
    std::string dataType = argv[2];

    // Ignore case to be safe
    str::lower(dataType);

    // And check that everything is ok
    if (dataType != "sicd" && dataType != "sidd")
        die_printf("Error - data type should be sicd or sidd");

    // Do this prior to reading any XML
    registerHandlers();

    // The input file (an XML or a NITF file)
    sys::Path inputFile(argv[1]);
    std::vector<sys::Path> paths;

    if (inputFile.isDirectory())
    {
        std::vector<std::string> listing = inputFile.list();
        for (unsigned int i = 0; i < listing.size(); ++i)
        {
            if (str::endsWith(listing[i], "ntf") || str::endsWith(listing[i],
                                                                  "nitf")
                    || str::endsWith(listing[i], "xml"))
            {
                paths.push_back(sys::Path(inputFile, listing[i]));
            }
        }
    }
    else
    {
        paths.push_back(inputFile);
    }
    for (unsigned int i = 0; i < paths.size(); ++i)
    {
        std::cout << "Parsing file: " << paths[i].getPath() << std::endl;
        run(paths[i].getPath(), dataType);
    }
    return 0;
}
Exemple #2
0
bool Oomd::prepareRun() {
  if (cgroups_.size() == 0) {
    XLOG(ERR) << "OOM detection or OOM killer classes not injected";
    return false;
  }

  if (!tunables_) {
    XLOG(ERR) << "Tunables not injected";
    return false;
  }

  if (!registerHandlers()) {
    XLOG(ERR) << "Unable to register signal handlers";
    return false;
  }

  updateTunables();
  return true;
}
Exemple #3
0
int main( int argc, const char **argv)
{
    int maxfd = 1, select_resp = 0;
    char stdin_buffer[256] = {0}, serial_buffer[256] = {0};
    int stdin_idx = 0;
    int c = 0;
    struct timeval timeout;
    fd_set readfd, writefd;
    fd_set readfd_b, writefd_b;		
    
	ps = new protocol::PacketServer();
	registerHandlers(ps);
	ps->start();

    createPacketBoards();

	int i,j;
	double left, right;

	double sensors_value[8];
	int sensors[6];
	// Pesos de pre definidos para la rueda izquierda (-s# para la derecha)
	double w0 = -0.9, w2 = -0.2, w5 = 0.35, w7 = 0.6;
	// Pesos de prueba para la rueda izquierda (-s# para la derecha)
	double w1 = -0.85, w3 = 0.6, w4 = 0.5, w6 = 0.8;
	// Definicion de los pesos para braitenberg
	double bc[8][2] = { {w0,-w0}, {w1,-w1}, {w2,-w2}, {w3,w3}, 
						{w4,w4}, {w5,-w5}, {w6,-w6}, {w7,-w7}};

	/* main loop */
	for (;;) {
		
		/* get sensors values */
		//Derecha
		distanceSensorHandler2->getValue(sensors, 6);
		for (i = 0; i < 4; i++) {
			sensors_value[i] = sensors[i];
		}
		//Izquierda
		distanceSensorHandler0->getValue(sensors, 6);
		for (i = 0; i < 4; i++) {
			sensors_value[7-i] = sensors[i];
		}
		
		left = 40.0;
		right = 40.0;
		for (j = 0; j < 8; j++) {
			left += bc[j][0] * sensors_value[j];
			right += bc[j][1] * sensors_value[j];
			printf("Valor (%d): %g\n",j,sensors_value[j]);
		}
		
		// Para que vaya mas rapido...
		//left *=20;
		//right *=20;
		
		/* set speed values */
		dcMotorHandler0->setSpeed(right);
		dcMotorHandler1->setSpeed(left);

		printf("Left: %g\tRight: %g\n", left, right);

		delay_centecimos(1);

	}
    
    return 0;
}
Exemple #4
0
//--------------------------------------------------------------------------------
kissmq::kissmq() : Server("localhost", "9100", 1)
{
  kisscpp::LogStream log(-1, __PRETTY_FUNCTION__, "/tmp/kissmq.log", true);
  registerHandlers();
}