Exemplo n.º 1
0
void MotionCore::init() {
    if (type_ == CORE_INIT) {
        FrameInfoBlock *frame_info;
        memory_.getBlockByName(frame_info,"frame_info");
        if (frame_info->source == MEMORY_SIM) {
            std::cout << "MOTION CORE: SIM" << std::endl;
            type_ = CORE_SIM;
        } else if (frame_info->source == MEMORY_ROBOT) {
            std::cout << "MOTION CORE: ROBOT" << std::endl;
            type_ = CORE_ROBOT;
        } else {
            std::cerr << "Unknown memory type when init vision core" << std::endl;
            exit(1);
        }
    }

    inst_ = this;

    setMemoryVariables();

    initMemory();
    initModules();

    fps_time_ = frame_info_->seconds_since_start;
    time_motion_started_ = frame_info_->seconds_since_start;
}
RobotinoLaserRangeFinderNode::RobotinoLaserRangeFinderNode()
	: nh_("~")
{
	nh_.param<std::string>("hostname", hostname_, "127.0.0.1" );
	nh_.param<int>("laserRangeFinderNumber", laserRangeFinderNumber_, 0 );

	std::ostringstream os;
	os << "LaserRangeFinder" << laserRangeFinderNumber_;
	com_.setName( os.str() );

	initModules();
}
Exemplo n.º 3
0
BOSS_Synthesis::BOSS_Synthesis(BOSS::Config & c): cl(c), scheduler(NULL)
{
  cerr << "BOSS_Synthesis constructor" << endl;
  BOSS::t_SVector inventories = c.listInv();
  for (unsigned i=0;i<inventories.size();i++) {
    string inv = inventories[i];
    cerr << "Setting up configuration for inventory \"" << inv << "\":" << endl;
    if (cl.setInv(inv))
      initModules(inv);
    else {
      cerr << "No configuration options defined for inventory - exiting!"
	   << endl;
      exit(EXIT_FAILURE);
    }
  }
}
Exemplo n.º 4
0
RobotinoNode::RobotinoNode()
	: nh_("~")
{
	nh_.param<std::string>("hostname", hostname_, "172.26.1.1" );
	nh_.param<double>("max_linear_vel", max_linear_vel_, 0.2 );
	nh_.param<double>("min_linear_vel", min_linear_vel_, 0.05 );
	nh_.param<double>("max_angular_vel", max_angular_vel_, 1.0 );
	nh_.param<double>("min_angular_vel", min_angular_vel_, 0.1 );

	distances_clearing_pub_ = nh_.advertise<sensor_msgs::PointCloud>("/distance_sensors_clearing", 1, true);
	joint_states_pub_= nh_.advertise<sensor_msgs::JointState>("/robotino_joint_states", 1, false);

	com_.setName( "RobotinoNode" );

	initModules();
	initMsgs();
}
Exemplo n.º 5
0
BaseGame::BaseGame(Vector2 windowSize, ScreenType screenType, string screenTitle, double fps) : fps(fps),
                   windowSize(windowSize), running(true)
{
	initScreen(screenType, screenTitle);
	initModules();

	al_get_keyboard_state(&keyState);
	al_get_mouse_state(&mouseState);

	eventQueue = al_create_event_queue();
	timer = al_create_timer(1/this->fps);

	//Events to read
	al_register_event_source(eventQueue, al_get_keyboard_event_source());
	al_register_event_source(eventQueue, al_get_timer_event_source(timer));
	al_register_event_source(eventQueue, al_get_display_event_source(display));
	al_register_event_source(eventQueue, al_get_mouse_event_source());
}
Exemplo n.º 6
0
/**
 * @fn Reportabug
 */
Reportabug::Reportabug(QWidget *parent, bool debugCmd, QMap<QString, QString> params)
    : QMainWindow(parent),
      debug(debugCmd),
      dynamic(params),
      ui(new Ui::Reportabug)
{
    // read settings
    // main
    if (!dynamic.contains(QString("OWNER")))
        dynamic[QString("OWNER")] = QString(OWNER);
    if (!dynamic.contains(QString("PROJECT")))
        dynamic[QString("PROJECT")] = QString(PROJECT);
    if (!dynamic.contains(QString("TAG_ASSIGNEE")))
        dynamic[QString("TAG_ASSIGNEE")] = QString(TAG_ASSIGNEE);
    if (!dynamic.contains(QString("TAG_BODY")))
        dynamic[QString("TAG_BODY")] = QString(TAG_BODY);
    if (!dynamic.contains(QString("TAG_LABELS")))
        dynamic[QString("TAG_LABELS")] = QString(TAG_LABELS);
    if (!dynamic.contains(QString("TAG_MILESTONE")))
        dynamic[QString("TAG_MILESTONE")] = QString(TAG_MILESTONE);
    if (!dynamic.contains(QString("TAG_TITLE")))
        dynamic[QString("TAG_TITLE")] = QString(TAG_TITLE);
    // github module
    if (!dynamic.contains(QString("GITHUB_COMBOBOX")))
        dynamic[QString("GITHUB_COMBOBOX")] = QString(GITHUB_COMBOBOX);
    if (!dynamic.contains(QString("ISSUES_URL")))
        dynamic[QString("ISSUES_URL")] = QString(ISSUES_URL);
    // gitreport module
    if (!dynamic.contains(QString("CAPTCHA_URL")))
        dynamic[QString("CAPTCHA_URL")] = QString(CAPTCHA_URL);
    if (!dynamic.contains(QString("GITREPORT_COMBOBOX")))
        dynamic[QString("GITREPORT_COMBOBOX")] = QString(GITREPORT_COMBOBOX);
    if (!dynamic.contains(QString("PUBLIC_URL")))
        dynamic[QString("PUBLIC_URL")] = QString(PUBLIC_URL);

    ui->setupUi(this);
    initModules();
    createComboBox();
    createActions();
}
Exemplo n.º 7
0
int main(int argc, char **argv)
{
  unsigned long valuemask;		/* mask for create windows */
  XSetWindowAttributes attributes;	/* attributes for create windows */
  void InternUsefulAtoms(void);
  void InitVariables(void);
  int  i, len;
  extern int x_fd;
  char *display_string;
  char message[255];
  Bool single = False;
  Bool option_error = FALSE;
  MenuRoot *mr;

  g_argv = argv;
  g_argc = argc;

  OpenConsole();
  DBUG("main", "Entered, about to parse args");

  for (i = 1; i < argc; i++) {
    if (strncasecmp(argv[i], "-debug", 6) == 0) {
      debugging = True;
    } else if (strncasecmp(argv[i], "-s", 2) == 0) {
      single = True;
    } else if (strncasecmp(argv[i], "-d", 2) == 0) {
      if (++i >= argc)
	usage();
      display_name = argv[i];
    } else if (strncasecmp(argv[i], "-f", 2) == 0) {
      if (++i >= argc)
	usage();
      config_command = (char *) malloc(6 + strlen(argv[i]));
      strcpy(config_command, "Read ");
      strcat(config_command, argv[i]);
      free_config_command = True;
    } else if (strncasecmp(argv[i], "-cmd", 4) == 0) {
      if (++i >= argc)
	usage();
      config_command = argv[i];
    } else if (strncasecmp(argv[i], "-file", 5) == 0) {
      if (++i >= argc)
	usage();
      output_file = argv[i];
    } else if (strncasecmp(argv[i], "-h", 2) == 0) {
      usage();
      exit(0);
    } else if (strncasecmp(argv[i], "-blackout", 9) == 0) {
      Blackout = True;
    } else if (strncasecmp(argv[i], "-version", 8) == 0) {
      fvwm_msg(INFO, "main", "Fvwm95 Version %s compiled on %s at %s\n",
	       VERSION, __DATE__, __TIME__);
    } else {
      fvwm_msg(ERR, "main", "Unknown option: `%s'\n", argv[i]);
      option_error = TRUE;
    }
  }

  DBUG("main", "Done parsing args");

  if (option_error) {
    usage();
  }

  DBUG("main", "Installing signal handlers");

  newhandler(SIGINT);
  newhandler(SIGHUP);
  newhandler(SIGQUIT);
  newhandler(SIGTERM);
  signal(SIGUSR1, Restart);
  signal(SIGPIPE, DeadPipe);

  ReapChildren();

  if (!(dpy = XOpenDisplay(display_name))) {
    fvwm_msg(ERR, "main", "can't open display %s",
	     XDisplayName(display_name));
    exit(1);
  }
  Scr.screen = DefaultScreen(dpy);
  Scr.NumberOfScreens = ScreenCount(dpy);

  master_pid = getpid();

  if (!single) {
    int myscreen = 0;
    char *cp;

    strcpy(message, XDisplayString(dpy));

    XCloseDisplay(dpy);

    for (i = 1; i < Scr.NumberOfScreens; i++) {
      if (fork() == 0) {
	myscreen = i;
	break;
      }
    }
    /*
     * Truncate the string 'whatever:n.n' to 'whatever:n',
     * and then append the screen number.
     */
    cp = strchr(message, ':');
    if (cp != NULL) {
      cp = strchr(cp, '.');
      if (cp != NULL)
	*cp = '\0';		/* truncate at display part */
    }
    sprintf(message + strlen(message), ".%d", myscreen);
    dpy = XOpenDisplay(message);
    Scr.screen = myscreen;
    Scr.NumberOfScreens = ScreenCount(dpy);
  }

  x_fd = XConnectionNumber(dpy);
  fd_width = GetFdWidth();

  if (fcntl(x_fd, F_SETFD, 1) == -1) {
    fvwm_msg(ERR, "main", "close-on-exec failed");
    exit(1);
  }

  /*  Add a DISPLAY entry to the environment, in case we were started
   *  with fvwm -display term:0.0
   */
  len = strlen(XDisplayString(dpy));
  display_string = safemalloc(len + 10);
  sprintf(display_string, "DISPLAY=%s", XDisplayString(dpy));
  putenv(display_string);

  /* Add a HOSTDISPLAY environment variable, which is the same as
   * DISPLAY, unless display = :0.0 or unix:0.0, in which case the full
   * host name will be used for ease in networking . */

  /* Note: Can't free the rdisplay_string after putenv, because it
   * becomes part of the environment! */

  if (strncmp(display_string, "DISPLAY=:", 9) == 0) {
    char client[MAXHOSTNAME], *rdisplay_string;

    mygethostname(client, MAXHOSTNAME);
    rdisplay_string = safemalloc(len + 14 + strlen(client));
    sprintf(rdisplay_string, "HOSTDISPLAY=%s:%s", client,
	    &display_string[9]);
    putenv(rdisplay_string);
  } else if (strncmp(display_string, "DISPLAY=unix:", 13) == 0) {
    char client[MAXHOSTNAME], *rdisplay_string;

    mygethostname(client, MAXHOSTNAME);
    rdisplay_string = safemalloc(len + 14 + strlen(client));
    sprintf(rdisplay_string, "HOSTDISPLAY=%s:%s", client,
	    &display_string[13]);
    putenv(rdisplay_string);
  } else {
    char *rdisplay_string;

    rdisplay_string = safemalloc(len + 14);
    sprintf(rdisplay_string, "HOSTDISPLAY=%s", XDisplayString(dpy));
    putenv(rdisplay_string);
  }

  Scr.Root = RootWindow(dpy, Scr.screen);
  if (Scr.Root == None) {
    fvwm_msg(ERR, "main", "Screen %d is not a valid screen",
	     (char *) Scr.screen);
    exit(1);
  }

#ifdef SHAPE
  ShapesSupported =
      XShapeQueryExtension(dpy, &ShapeEventBase, &ShapeErrorBase);
#endif	/* SHAPE */

  InternUsefulAtoms();

  /* Make sure property priority colors is empty */
  XChangeProperty(dpy, Scr.Root, _XA_MIT_PRIORITY_COLORS,
		  XA_CARDINAL, 32, PropModeReplace, NULL, 0);

  XSetErrorHandler((XErrorHandler) CatchRedirectError);
  XSetIOErrorHandler((XIOErrorHandler) CatchFatal);

  XSelectInput(dpy, Scr.Root,
	       LeaveWindowMask | EnterWindowMask | PropertyChangeMask |
	       SubstructureRedirectMask | KeyPressMask |
	       SubstructureNotifyMask |
	       ButtonPressMask | ButtonReleaseMask);

  XSync(dpy, 0);

  XSetErrorHandler((XErrorHandler) FvwmErrorHandler);

  BlackoutScreen();

  CreateCursors();
  InitVariables();
  InitEventHandlerJumpTable();
  initModules();

  InitPictureCMap(dpy, Scr.Root);	/* for the pixmap cache... */

  Scr.gray_bitmap =
      XCreateBitmapFromData(dpy, Scr.Root, g_bits, g_width, g_height);

  DBUG("main", "Setting up rc file defaults...");
  SetRCDefaults();

  DBUG("main", "Running config_command...");
  ExecuteFunction(config_command, NULL, &Event, C_ROOT, -1);
  DBUG("main", "Done running config_command");

/*
  CaptureAllWindows();
  MakeMenus();
*/

#if 0	/* this seems to cause problems for FvwmCpp/M4 startup actually */
  /* if not a direct 'Read', we'll capture all windows here, in case cmd
     fails we'll still have defaults */
  if (strncasecmp(config_command, "Read", 4) != 0 &&
      strncasecmp(config_command, "PipeRead", 8) != 0) {
    /* so if cmd (FvwmM4/Cpp most likely) fails, we can still have
       borders & stuff... */
    StartupStuff();
  }
#endif	/* 0 */

  if (free_config_command) {
    free(config_command);
  }

  if (Scr.d_depth < 2) {
    Scr.gray_pixmap =
	XCreatePixmapFromBitmapData(dpy, Scr.Root, g_bits, g_width,
				    g_height, Scr.WinColors.fore,
				    Scr.WinColors.back, Scr.d_depth);
    Scr.light_gray_pixmap =
	XCreatePixmapFromBitmapData(dpy, Scr.Root, l_g_bits, l_g_width,
				    l_g_height, Scr.WinColors.fore,
				    Scr.WinColors.back, Scr.d_depth);
  }

  /* create a window which will accept the keyboard focus when no other 
     windows have it */
  attributes.event_mask = KeyPressMask | FocusChangeMask;
  attributes.override_redirect = True;
  Scr.NoFocusWin = XCreateWindow(dpy, Scr.Root, -10, -10, 10, 10, 0, 0,
				 InputOnly, CopyFromParent,
				 CWEventMask | CWOverrideRedirect,
				 &attributes);
  XMapWindow(dpy, Scr.NoFocusWin);

  SetMWM_INFO(Scr.NoFocusWin);

  XSetInputFocus(dpy, Scr.NoFocusWin, RevertToParent, CurrentTime);

  XSync(dpy, 0);
  if (debugging)
    XSynchronize(dpy, 1);

  Scr.SizeStringWidth = XTextWidth(Scr.StdFont.font,
				   " +8888 x +8888 ", 15);
  attributes.border_pixel = Scr.WinColors.fore;
  attributes.background_pixel = Scr.WinColors.back;
  attributes.bit_gravity = NorthWestGravity;
  attributes.save_under = True;
  valuemask = (CWBorderPixel | CWBackPixel | CWBitGravity | CWSaveUnder);

  /* create the window for coordinates */
  Scr.SizeWindow = XCreateWindow(dpy, Scr.Root,
				 Scr.MyDisplayWidth / 2 -
				 (Scr.SizeStringWidth +
				  SIZE_HINDENT * 2) / 2,
				 Scr.MyDisplayHeight / 2 -
				 (Scr.StdFont.height +
				  SIZE_VINDENT * 2) / 2,
				 (unsigned int) (Scr.SizeStringWidth +
						 SIZE_HINDENT * 2),
				 (unsigned int) (Scr.StdFont.height +
						 SIZE_VINDENT * 2),
				 (unsigned int) 0, 0,
				 (unsigned int) CopyFromParent,
				 (Visual *) CopyFromParent,
				 valuemask, &attributes);

#ifndef NON_VIRTUAL
  initPanFrames();
#endif

  XGrabServer(dpy);

#ifndef NON_VIRTUAL
  checkPanFrames();
#endif
  XUngrabServer(dpy);
  UnBlackoutScreen();
  DBUG("main", "Entering HandleEvents loop...");
  HandleEvents();
  DBUG("main", "Back from HandleEvents loop?  Exiting...");

  return 0;
}
Exemplo n.º 8
0
void ofApp::setup() {

    ofSetLogLevel(OF_LOG_NOTICE);

    ofLogNotice() << "setup()";

    if (ofApp::isSemibreve()) ofLogNotice() << "Going to run Semibreve version";

    if (ofApp::isOsx())     ofLogNotice() << "OSX detected";
    if (ofApp::isIos())     ofLogNotice() << "iOS detected";
    if (ofApp::isAndroid()) ofLogNotice() << "Android detected";

    if (ofApp::isPhone())   ofLogNotice() << "Phone detected";
    if (ofApp::isTablet())  ofLogNotice() << "Tablet detected";

    // if (ofApp::isIphone())  ofLogNotice() << "iPhone detected";
    // if (ofApp::isIpad())    ofLogNotice() << "iPad detected";

    // if (ofApp::isAndroidPhone())   ofLogNotice() << "Android phone detected";
    // if (ofApp::isAndroidTablet())  ofLogNotice() << "Android tablet detected";

    #if defined TARGET_OSX
    ofLogNotice() << "Running OSX version";
    ofSetDataPathRoot("../Resources/data/");
    #endif

    #if defined TARGET_SEMIBREVE
    ofLogNotice() << "Running SEMIBREVE version";
    oscReceiver.setup(RECEIVE_PORT);
    oscSender.setup(HOST, SEND_PORT);
    #endif

    #if defined TARGET_OF_IOS
     if (ofApp::isTablet()) {
        ofSetOrientation(OF_ORIENTATION_90_LEFT);
        swiper.setup();
        ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe);
        swiping = false;
    } else {
        swiper.setup();
        ofAddListener(swiper.swipeRecognized, this, &ofApp::onSwipe);
        swiping = false;
    }
    #endif

#ifndef TARGET_OSX
    if (isAndroid() || isIos()) {
        ofxAccelerometer.setup();
        accelCount = 0;
        crop = 0;
    }
#endif
    
    if (!ofApp::isIos()) {
        ofLogNotice() << "Registering for touch events if not ios";
        ofRegisterTouchEvents(this);
    }

    ofSetFrameRate(FRAME_RATE);
    ofSetCircleResolution(CIRCLE_RESOLUTION);

    if (multitouch) ofHideCursor();

    ofApp::language = ofApp::getSystemLanguage();
    ofLogNotice() << "Language is " << ofApp::language;

    initTranslations();
    initModules();
    setupModules();
    loadModuleSounds();

    initImages();

    appState = ABOUT;

    inactivityState = ACTIVE;

    // init global vars
    aboutY = 0;
    splashAlpha = 255;
    arrowDownY = ofGetHeight()/3*2;
    arrowDownYBase = arrowDownY;
    arrowDownDir = 1;
    showSwipeInfo = true;
    ofApp::maxParticleY = round(ofGetHeight() * (1-LIMIT_PARTICLE));

    uint swipeFontSize;
    if (isTablet()) swipeFontSize = 26;
    else swipeFontSize = 20;
    swipeFont.load(UI_FONT_FACE, swipeFontSize);

}