ompl_interface::ConstrainedGoalSampler::ConstrainedGoalSampler(const ModelBasedPlanningContext *pc,
                                                               const kinematic_constraints::KinematicConstraintSetPtr &ks,
                                                               const constraint_samplers::ConstraintSamplerPtr &cs) :
  ob::GoalLazySamples(pc->getOMPLSimpleSetup().getSpaceInformation(), boost::bind(&ConstrainedGoalSampler::sampleUsingConstraintSampler, this, _1, _2), false),
  planning_context_(pc), kinematic_constraint_set_(ks), constraint_sampler_(cs), work_state_(pc->getCompleteInitialRobotState()),
  work_joint_group_state_(work_state_.getJointStateGroup(planning_context_->getJointModelGroupName())), verbose_display_(0)
{
  if (!constraint_sampler_)
    default_sampler_ = si_->allocStateSampler();
  logDebug("Constructed a ConstrainedGoalSampler instance at address %p", this);
  startSampling();
}
Esempio n. 2
0
void emu_free(struct emu *e)
{
	logDebug(e,"%s %x\n", __FUNCTION__,(unsigned int)e);
	emu_cpu_free(e->cpu);
	emu_memory_free(e->memory);
	emu_log_free(e->log);
	if (e->errorstr != NULL)
		free(e->errorstr);

	free(e);
	 
}
Esempio n. 3
0
static void deal_timeout_tasks(ScheduleContext *pContext, FastTimerEntry *head)
{
	FastTimerEntry *entry;
	FastTimerEntry *current;
    FastDelayTask *task;

	entry = head->next;
	while (entry != NULL)
	{
		current = entry;
		entry = entry->next;

        current->prev = current->next = NULL; //must set NULL because NOT in time wheel

        task = (FastDelayTask *)current;

        if (!task->new_thread)
        {
            task->task_func(task->func_args);
            fast_mblock_free_object(&pContext->mblock, task);
        }
        else
        {
            struct delay_thread_context delay_context;
            pthread_t tid;
            int result;
            int i;

            task->thread_running = false;
            delay_context.task = task;
            delay_context.schedule_context = pContext;
            if ((result=pthread_create(&tid, NULL,
                            sched_call_delay_func, &delay_context)) != 0)
            {
                logError("file: "__FILE__", line: %d, " \
                        "create thread failed, " \
                        "errno: %d, error info: %s", \
                        __LINE__, result, STRERROR(result));
            }
            else
            {
               usleep(1*1000);
               for (i=1; !task->thread_running && i<100; i++)
               {
                   logDebug("file: "__FILE__", line: %d, "
                           "task args: %p, waiting thread ready, count %d",
                           __LINE__, task->func_args, i);
                   usleep(1*1000);
               }
            }
        }
    }
}
Esempio n. 4
0
void LMS1xx::setScanDataCfg(const scanDataCfg &cfg) {
	char buf[100];
	sprintf(buf, "%c%s %02X 00 %d %d 0 %02X 00 %d %d 0 %d +%d%c", 0x02,
			"sWN LMDscandatacfg", cfg.outputChannel, cfg.remission ? 1 : 0,
			cfg.resolution, cfg.encoder, cfg.position ? 1 : 0,
			cfg.deviceName ? 1 : 0, cfg.timestamp ? 1 : 0, cfg.outputInterval, 0x03);
	logDebug("TX: %s", buf);
	write(sockDesc, buf, strlen(buf));

	int len = read(sockDesc, buf, 100);
	buf[len - 1] = 0;
}
void peano::geometry::builtin::configurations::BuiltinGeometryObjectConfiguration::readGeometryID(
tarch::irr::io::IrrXMLReader* xmlReader){
  // if available, parse geometry ID
  if (xmlReader->getAttributeValue(GEOMETRY_ID.c_str()) != 0){
    _geometryID = xmlReader->getAttributeValueAsInt(GEOMETRY_ID.c_str());
    if (_geometryID < 0){
      assertion1(false, "Read negative geometry ID!");
      exit(EXIT_FAILURE);
    }
    logDebug("readGeometryID()", "Geometry ID: " << _geometryID);
  }
}
Esempio n. 6
0
void LMS1xx::stopMeas() {
	char buf[100];
	sprintf(buf, "%c%s%c", 0x02, "sMN LMCstopmeas", 0x03);

	write(sockDesc, buf, strlen(buf));

	int len = read(sockDesc, buf, 100);
	if (buf[0] != 0x02)
		logWarn("invalid packet recieved");
	buf[len] = 0;
	logDebug("RX: %s", buf);
}
int
startRegistrarServerHunt() {
    serverHuntCnt = 0;

    enrpAnnounceTimer = timerCreate(enrpAnnounceTimeout, NULL, "enrp announce cycle timer");

    if (useEnrpAnnouncements) {
        logDebug("using announcements to find mentor peer");
        sendEnrpPresence(0, 1, 0);
        serverHuntTimer = timerCreate(serverHuntTimeout, NULL, "server hunt timer");
        timerStart(serverHuntTimer, TIMEOUT_SERVER_HUNT);

        return 1;
    }

    logDebug("skipped server hunt, no multicast available");
    registrarState = SERVICING;
    timerStart(enrpAnnounceTimer, PEER_HEARTBEAT_CYCLE);

    return 1;
}
void peano::applications::latticeboltzmann::blocklatticeboltzmann::configurations::PlaneBoundaryConfiguration::
parseSubtag( tarch::irr::io::IrrXMLReader* xmlReader){
  // parse general part (-> boundary type)
  parseBoundaryConfigurationData(xmlReader);

  // parse interval
  if (xmlReader->getAttributeValue(INTERVAL.c_str()) != 0){
    parseInterval(xmlReader->getAttributeValue(INTERVAL.c_str()));
  } else {
    logDebug("parseSubtag()", INTERVAL << " not specified!");
    assertion(false);
  }
  // parse normal
  if ( xmlReader->getAttributeValue( NORMAL.c_str() ) != 0 ) {
    _normal = xmlReader->getAttributeValueAsDoubleVector<DIMENSIONS>(NORMAL.c_str());
    logDebug("parseSubtag()", NORMAL << ": " << _normal);
  } else {
    logDebug( "parseSubtag()", NORMAL << "not specified!");
    assertion(false);
  }
}
void ompl_interface::ConstraintsLibrary::loadConstraintApproximations(const std::string &path)
{
  constraint_approximations_.clear();
  std::ifstream fin((path + "/manifest").c_str());
  if (!fin.good())
  {
    logDebug("Manifest not found in folder '%s'. Not loading constraint approximations.", path.c_str());
    return;
  }
  
  logInform("Loading constrained space approximations from '%s'", path.c_str());
  
  while (fin.good() && !fin.eof())
  {
    std::string group, state_space_parameterization, serialization, filename;
    fin >> group;
    if (fin.eof())
      break;
    fin >> state_space_parameterization;
    if (fin.eof())
      break;
    fin >> serialization;    
    if (fin.eof())
      break;
    fin >> filename;
    const ModelBasedPlanningContextPtr &pc = context_manager_.getPlanningContext(group, state_space_parameterization);
    if (pc)
    {
      moveit_msgs::Constraints msg;
      hexToMsg(serialization, msg);
      ConstraintApproximationStateStorage *cass = new ConstraintApproximationStateStorage(pc->getOMPLSimpleSetup().getStateSpace());
      cass->load((path + "/" + filename).c_str());
      ConstraintApproximationPtr cap;
      if (constraint_factories_.find(msg.name) != constraint_factories_.end())
        cap = constraint_factories_[msg.name]->allocApproximation(context_manager_.getRobotModel(),
                                                                  group, state_space_parameterization, msg, filename, ompl::base::StateStoragePtr(cass));
      else
        cap.reset(new ConstraintApproximation(context_manager_.getRobotModel(),
                                              group, state_space_parameterization, msg, filename, ompl::base::StateStoragePtr(cass)));
      if (cap)
      {
        if (constraint_approximations_.find(cap->getName()) != constraint_approximations_.end())
          logWarn("Overwriting constraint approximation named '%s'", cap->getName().c_str());
        
        constraint_approximations_[cap->getName()] = cap;
        std::size_t sum = 0;
        for (std::size_t i = 0 ; i < cass->size() ; ++i)
          sum += cass->getMetadata(i).size();
        logInform("Loaded %lu states and %lu connections (%0.1lf per state) from %s", cass->size(), sum, (double)sum / (double)cass->size(), filename.c_str());
      }
    }
  }
}
Esempio n. 10
0
u_int8_t* VideoDecoder::nextVideoFrame() {
    videoBufferMutex.lock();

    if(videoNumFrameBuffered < 1 && !videoOutputEnded) {
        logDebug("[VideoPlayer::nextVideoFrame] no new frame available yet!\n");
        return rgbFrames[videoCurrentBufferIndex]->data[0];
    }

    if(!videoOutputEnded) {
        int readingIndex = videoCurrentBufferIndex;
        logDebug("[VideoPlayer::nextVideoFrame] last returned buffer points to index %d\n", readingIndex);
        videoCurrentBufferIndex = (readingIndex + 1) % VIDEOPLAYER_VIDEO_NUM_BUFFERED_FRAMES;
        videoNumFrameBuffered--;
        videoBufferConditional.signal();
        videoBufferMutex.unlock();
        return rgbFrames[readingIndex]->data[0];
    }

    videoBufferMutex.unlock();
    return NULL;
}
Esempio n. 11
0
void VideoDecoder::run() {
    videoBufferMutex.lock();
    while(!videoOutputEnded) {
        while(videoNumFrameBuffered < (VIDEOPLAYER_VIDEO_NUM_BUFFERED_FRAMES - 1) && !videoOutputEnded) {
            int indexToWrite = (videoCurrentBufferIndex + videoNumFrameBuffered) % VIDEOPLAYER_VIDEO_NUM_BUFFERED_FRAMES;

            int frameFinished = false;
            while(!frameFinished) {
                //Keep reading until a video packet is read, or stream is ended.
                while(videoPackets.empty() && readPacket());

                if(videoPackets.empty()) {
                    //End of stream reached, stop filling buffer
                    videoOutputEnded = true;
                    break;
                }

                AVPacket videoPacket = videoPackets.back();
                videoPackets.pop_back();
                videoBufferMutex.unlock();

                if(firstVideoPacket) {
                    firstVideoPacket = false;
                    videoTimestamps[indexToWrite] = timeBase*(double)videoPacket.pts;
                }

                //Decode video
                avcodec_decode_video2(videoCodecContext, frame, &frameFinished, &videoPacket);
                if(frameFinished) {
                    //The frame is finished, so scale it into an RGB frame
                    sws_scale(swsContext, (uint8_t const * const *)frame->data, frame->linesize, 0, videoCodecContext->height, rgbFrames[indexToWrite]->data, rgbFrames[indexToWrite]->linesize);
                    logDebug("[VideoPlayer::run] Filled buffer on position %d with frame %d\n", indexToWrite, numFramesDecoded++);
                    //We are done with the packet, free it, then return status.
                    av_free_packet(&videoPacket);
                    firstVideoPacket = true;
                    //Atomic increment of videoNumFrameBuffered
                    __sync_add_and_fetch(&videoNumFrameBuffered, 1);
                    if(videoBufferMutex.trylock() == 0) {
                        videoBufferConditional.signal();
                        videoBufferMutex.unlock();
                    }
                }
                videoBufferMutex.lock();
            }
        }
        videoBufferConditional.wait();
    }
    videoBufferMutex.unlock();

    if(cleanupFunc != NULL) {
        cleanupFunc(this->customFileBufferFuncData);
    }
}
Esempio n. 12
0
char ConfFile::readCharSafe(boolean& eol, byte& statusRes) {
  eol = true;
  if (!_confFile.available()) {
    logDebug("readCharSafe:unexpected EOF");
    returnStatusV(ERR(0x22),'\0');// unexpected EOF
  }
  char c = _confFile.read();
  if (c == 0x0A) {
    // Linux EOL
    return c;
  } else if (c == 0x0D) {
    // Windows EOL, two chars
    if (!_confFile.available() || _confFile.peek() != 0x0A) {
      logDebug("readCharSafe:no 0A after 0D");
      returnStatusV(ERR(0x21),c);// no 0A after 0D
    }
  } else {
    eol = false;
    return c;
  }
}
void wdaLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) {
    va_list marker;
    
    if(loglevel > pMac->utils.gLogDbgLevel[WDA_DEBUG_LOGIDX])
        return;
   
    va_start( marker, pString );     /* Initialize variable arguments. */
    
    logDebug(pMac, SIR_WDA_MODULE_ID, loglevel, pString, marker);
    
    va_end( marker );              /* Reset variable arguments.      */
}
Esempio n. 14
0
bool ini_addKey(Ini* ini, Section* section, const char* key, const char* value) {
	if (section == NULL) {
		logWarn("The last section is not valid");
		return false;
	}

	logDebug("Adding key '%s=%s' to section '%s'", key, value, section->name);
	list_add(section->keys, (Any)str_dup(key));
	list_add(section->values, (Any)str_dup(value));

	return true;
}
Esempio n. 15
0
bool LMS1xx::getScanData(scanData* scan_data)
{
  fd_set rfds;
  FD_ZERO(&rfds);
  FD_SET(socket_fd_, &rfds);

  // Block a total of up to 100ms waiting for more data from the laser.
  while (1)
  {
    // Would be great to depend on linux's behaviour of updating the timeval, but unfortunately
    // that's non-POSIX (doesn't work on OS X, for example).
    struct timeval tv;
    tv.tv_sec = 0;
    tv.tv_usec = 100000;

    logDebug("entering select()", tv.tv_usec);
    int retval = select(socket_fd_ + 1, &rfds, NULL, NULL, &tv);
    logDebug("returned %d from select()", retval);
    if (retval)
    {
      buffer_.readFrom(socket_fd_);

      // Will return pointer if a complete message exists in the buffer,
      // otherwise will return null.
      char* buffer_data = buffer_.getNextBuffer();

      if (buffer_data)
      {
        parseScanData(buffer_data, scan_data);
        buffer_.popLastBuffer();
        return true;
      }
    }
    else
    {
      // Select timed out or there was an fd error.
      return false;
    }
  }
}
Esempio n. 16
0
int trunk_free_space(const FDFSTrunkFullInfo *pTrunkInfo, \
		const bool bWriteBinLog)
{
	int result;
	struct fast_mblock_node *pMblockNode;
	FDFSTrunkNode *pTrunkNode;

	if (!g_if_trunker_self)
	{
		logError("file: "__FILE__", line: %d, " \
			"I am not trunk server!", __LINE__);
		return EINVAL;
	}

	if (trunk_init_flag != STORAGE_TRUNK_INIT_FLAG_DONE)
	{
		if (bWriteBinLog)
		{
			logError("file: "__FILE__", line: %d, " \
				"I am not inited!", __LINE__);
			return EINVAL;
		}
	}

	if (pTrunkInfo->file.size < g_slot_min_size)
	{
		logDebug("file: "__FILE__", line: %d, " \
			"space: %d is too small, do not need recycle!", \
			__LINE__, pTrunkInfo->file.size);
		return 0;
	}

	pMblockNode = fast_mblock_alloc(&free_blocks_man);
	if (pMblockNode == NULL)
	{
		result = errno != 0 ? errno : EIO;
		logError("file: "__FILE__", line: %d, " \
			"malloc %d bytes fail, " \
			"errno: %d, error info: %s", \
			__LINE__, (int)sizeof(FDFSTrunkNode), \
			result, STRERROR(result));
		return result;
	}

	pTrunkNode = (FDFSTrunkNode *)pMblockNode->data;
	memcpy(&pTrunkNode->trunk, pTrunkInfo, sizeof(FDFSTrunkFullInfo));

	pTrunkNode->pMblockNode = pMblockNode;
	pTrunkNode->trunk.status = FDFS_TRUNK_STATUS_FREE;
	pTrunkNode->next = NULL;
	return trunk_add_free_block(pTrunkNode, bWriteBinLog);
}
Esempio n. 17
0
void Network::monitor(std::istream &i) {
	uint32_t timer = Utils::getVal<uint32_t>(i);
	if (!m_updateTimer && timer) {
		Utils::timedCallback(this, &Network::onUpdateTimer, timer);
		logDebug(
			boost::format(
				"CGComm: Monitoring Networking "
				"(update rate %dms)"
			) % timer
		);
	}
	m_updateTimer = timer;
}
Esempio n. 18
0
void ProgramFile_TestStub::_testProgramming(byte& statusRes) {
  byte progMemPageSize = 6;
  byte progMemPagesCount = 8;
  byte targetPage = 2;
  
  delay(100);
  AVRProgrammer::loadProgramMemoryPageByte(false, 128, 0x12, statusRes); if (statusRes > 0) { logDebug("bad L0"); return; }
  AVRProgrammer::loadProgramMemoryPageByte(true, 128, 0x01, statusRes); if (statusRes > 0) { logDebug("bad H0"); return; }
  AVRProgrammer::loadProgramMemoryPageByte(false, 129, 0x34, statusRes); if (statusRes > 0) { logDebug("bad L1"); return; }
  AVRProgrammer::loadProgramMemoryPageByte(true, 129, 0x23, statusRes); if (statusRes > 0) { logDebug("bad H1"); return; }
  AVRProgrammer::loadProgramMemoryPageByte(false, 130, 0x56, statusRes); if (statusRes > 0) { logDebug("bad L2"); return; }
  AVRProgrammer::loadProgramMemoryPageByte(true, 130, 0x45, statusRes); if (statusRes > 0) { logDebug("bad H2"); return; }

  AVRProgrammer::loadProgramMemoryPageByte(false, 131, 0x68, statusRes); if (statusRes > 0) { logDebug("bad L6"); return; }
  AVRProgrammer::loadProgramMemoryPageByte(true, 131, 0x67, statusRes); if (statusRes > 0) { logDebug("bad H6"); return; }
  AVRProgrammer::writeProgramMemoryPage(0, 128, statusRes); if (statusRes > 0) { logDebug("bad Page"); return; }
  delay(500);

  AVRProgrammer::readProgramMemoryPage(ProgramFile::programBuffer, targetPage, progMemPageSize, statusRes);
  if (statusRes > 0) {
    logErrorB("Page read failed!",targetPage);
    return;
  }
  byte maxByte = 1 << (progMemPageSize + 1);
  for (byte i = 0; i < maxByte; i++) {
    logDebugB("",ProgramFile::programBuffer[i]);
  }
  logDebug("Done!");
  
  // now lets try manual!
  byte bh = AVRProgrammer_TestStub::_testReadProgramMemoryByte(true, 0, 128, statusRes); if (statusRes > 0) { logErrorB("read bh 128 F!",targetPage); return; }
  byte bl = AVRProgrammer_TestStub::_testReadProgramMemoryByte(false, 0, 128, statusRes); if (statusRes > 0) { logErrorB("read bh 128 F!",targetPage); return; }
  logDebugB("bh128:",bh);
  logDebugB("bl128:",bl);
  bh = AVRProgrammer_TestStub::_testReadProgramMemoryByte(true, 0, 129, statusRes); if (statusRes > 0) { logErrorB("read bh 129 F!",targetPage); return; }
  bl = AVRProgrammer_TestStub::_testReadProgramMemoryByte(false, 0, 129, statusRes); if (statusRes > 0) { logErrorB("read bh 129 F!",targetPage); return; }
  logDebugB("bh129:",bh);
  logDebugB("bl129:",bl);
}
Esempio n. 19
0
CTGlobalCron::CTGlobalCron(CTHost* _ctHost) :
	CTCron() {
		
	logDebug() << "Initializing CTGlobalCron" << endl;
	
	d->multiUserCron = true;
	d->systemCron = false;
	d->currentUserCron = false;

    d->userLogin = tr("All users");
		
	ctHost = _ctHost;
}
Esempio n. 20
0
  void OMPLsolver::postSolve()
  {
    ompl_simple_setup_->clearStartStates();
    goal_state_->clearGoalState();
    int v =
        ompl_simple_setup_->getSpaceInformation()->getMotionValidator()->getValidMotionCount();
    int iv =
        ompl_simple_setup_->getSpaceInformation()->getMotionValidator()->getInvalidMotionCount();
    logDebug("There were %d valid motions and %d invalid motions.", v, iv);

    if (ompl_simple_setup_->getProblemDefinition()->hasApproximateSolution())
    logWarn("Computed solution is approximate");
  }
Esempio n. 21
0
void particles::pidt::mappings::MoveParticles::leaveCell(
  particles::pidt::Cell&                    fineGridCell,
  particles::pidt::Vertex * const           fineGridVertices,
  const peano::grid::VertexEnumerator&      fineGridVerticesEnumerator,
  particles::pidt::Vertex * const           coarseGridVertices,
  const peano::grid::VertexEnumerator&      coarseGridVerticesEnumerator,
  particles::pidt::Cell&                    coarseGridCell,
  const tarch::la::Vector<DIMENSIONS,int>&  fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "leaveCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );

  double maxVComponentInCell = 0.0;

  dfor2(k)
    const int sourceVertexIndex = fineGridVertices[ fineGridVerticesEnumerator(k) ].getVertexIndex();

    ParticleHeap::HeapEntries& sourceVertexParticles = ParticleHeap::getInstance().getData(sourceVertexIndex);

    for (
      ParticleHeap::HeapEntries::iterator p = sourceVertexParticles.begin();
      p!=sourceVertexParticles.end();
    ) {
      const tarch::la::Vector<DIMENSIONS,int> newDualCellOfParticle = Vertex::getDualCellOfParticle(
        fineGridVerticesEnumerator,
        p->_persistentRecords._x
      );

      const double maxVComponentOfParticle = tarch::la::maxAbs(p->_persistentRecords._v);
      maxVComponentInCell = maxVComponentInCell > maxVComponentOfParticle ? maxVComponentInCell : maxVComponentOfParticle;

      const bool MoveParticleToDifferentDualCell = newDualCellOfParticle!=k;
      if (MoveParticleToDifferentDualCell) {
        Vertex& newVertexOfParticles = fineGridVertices[ fineGridVerticesEnumerator(newDualCellOfParticle) ];
        newVertexOfParticles.particlesWereAddedToThisVertex();
        const int destinationVertexIndex = newVertexOfParticles.getVertexIndex();
        ParticleHeap::getInstance().getData(destinationVertexIndex).push_back(*p);
        p = ParticleHeap::getInstance().getData(sourceVertexIndex).erase(p);
        logDebug( "leaveCell(...)", "reassign particle " << p->toString() << " to vertex " << newDualCellOfParticle );
      }
      else {
        p++;
      }
    }
  enddforx

  if (!fineGridCell.isRefined()) {
    fineGridCell.setMaxVComponent( maxVComponentInCell );
  }

  logTraceOut( "leaveCell(...)" );
}
Esempio n. 22
0
static void printWelcomeMessage(int argc, char** argv) {
  CharString stringBuffer = newCharString();
  CharString versionString = buildInfoGetVersionString();
  char* space;
  int i;

  logInfo("%s initialized, build %ld", versionString->data, buildInfoGetDatestamp());
  // Recycle to use for the platform name
  freeCharString(stringBuffer);
  freeCharString(versionString);

  if(isExecutable64Bit()) {
    logWarn("Running in 64-bit mode, this is experimental. Hold on to your hats!");
  }

  // Prevent a bunch of silly work in case the log level isn't debug
  if(isLogLevelAtLeast(LOG_DEBUG)) {
    stringBuffer = getPlatformName();
    logDebug("Host platform is %s (%s)", getShortPlatformName(), stringBuffer->data);
    logDebug("Application is %d-bit", isExecutable64Bit() ? 64 : 32);
    freeCharString(stringBuffer);

    stringBuffer = newCharString();
    for(i = 1; i < argc; i++) {
      space = strchr(argv[i], ' ');
      if(space != NULL) {
        charStringAppendCString(stringBuffer, "\"");
      }
      charStringAppendCString(stringBuffer, argv[i]);
      if(space != NULL) {
        charStringAppendCString(stringBuffer, "\"");
      }
      charStringAppendCString(stringBuffer, " ");
    }
    logDebug("Launched with options: %s", stringBuffer->data);
    freeCharString(stringBuffer);
  }
}
Esempio n. 23
0
File: scene.cpp Progetto: tapio/weep
void SceneLoader::load(const string& path, Resources& resources)
{
	logDebug("Start loading scene %s", path.c_str());
	uint t0 = Engine::timems();
	m_environment = Json();
	load_internal(path, resources);

	if (!m_environment.is_null() && world->has_system<RenderSystem>()) {
		RenderSystem& renderer = world->get_system<RenderSystem>();
		renderer.env() = parseEnvironment(m_environment, resources, dirname(path));
		renderer.device().setEnvironment(&renderer.env());
	}

	Entity cameraEnt;
	if (world->has_tagged_entity("camera")) {
		cameraEnt = world->get_entity_by_tag("camera");
	} else {
		cameraEnt = world->create();
		cameraEnt.tag("camera");
	}
	if (!cameraEnt.has<Camera>()) {
		cameraEnt.add<Camera>();
		Camera& camera = cameraEnt.get<Camera>();
		float ar = Engine::width() / (float)Engine::height();
		camera.makePerspective(45, ar, 0.1, 1000);
		if (cameraEnt.has<Transform>()) {
			Transform& trans = cameraEnt.get<Transform>();
			camera.updateViewMatrix(trans.position, trans.rotation);
		} else {
			camera.view = glm::lookAt(vec3(0, 0, 1), vec3(0, 0, 0), vec3(0, 1, 0));
		}
	}

	resources.startAsyncLoading();

	uint t1 = Engine::timems();
	logDebug("Loaded scene %s in %dms with %d models, %d bodies, %d lights, %d prefabs", path.c_str(), t1 - t0, numModels, numBodies, numLights, prefabs.size());
}
ompl_interface::ValidConstrainedSampler::ValidConstrainedSampler(const ModelBasedPlanningContext *pc,
                                                                 const kinematic_constraints::KinematicConstraintSetPtr &ks,
                                                                 const constraint_samplers::ConstraintSamplerPtr &cs)
  : ob::ValidStateSampler(pc->getOMPLSimpleSetup().getSpaceInformation().get())
  , planning_context_(pc)
  , kinematic_constraint_set_(ks)
  , constraint_sampler_(cs)
  , work_state_(pc->getCompleteInitialRobotState())
{
  if (!constraint_sampler_)
    default_sampler_ = si_->allocStateSampler();
  inv_dim_ = si_->getStateSpace()->getDimension() > 0 ? 1.0 / (double)si_->getStateSpace()->getDimension() : 1.0;
  logDebug("Constructed a ValidConstrainedSampler instance at address %p", this);
}
Esempio n. 25
0
void LMS1xx::startDevice()
{
  char buf[100];
  sprintf(buf, "%c%s%c", 0x02, "sMN Run", 0x03);

  write(socket_fd_, buf, strlen(buf));

  int len = read(socket_fd_, buf, 100);

  if (buf[0] != 0x02)
    logWarn("invalid packet recieved");
  buf[len] = 0;
  logDebug("RX: %s", buf);
}
Esempio n. 26
0
QList<CTTask*> CTGlobalCron::tasks() const {
	logDebug() << "Global Cron Tasks" << endl;
	QList<CTTask*> tasks;
	
    for(CTCron* cron: ctHost->crons) {
		if (cron->isSystemCron())
			continue;
		
        for(CTTask* task: cron->tasks()) {
			tasks.append(task);
		}
	}
	return tasks;
}
Esempio n. 27
0
void LMS1xx::scanContinous(int start) {
	char buf[100];
	sprintf(buf, "%c%s %d%c", 0x02, "sEN LMDscandata", start, 0x03);

	write(sockDesc, buf, strlen(buf));

	int len = read(sockDesc, buf, 100);

	if (buf[0] != 0x02)
		logError("invalid packet recieved");

	buf[len] = 0;
	logDebug("RX: %s", buf);
}
Esempio n. 28
0
static void *sched_call_delay_func(void *args)
{
    struct delay_thread_context *delay_context;
    ScheduleContext *pContext;
    FastDelayTask *task;

    delay_context = (struct delay_thread_context *)args;
    task = delay_context->task;
    pContext = delay_context->schedule_context;

    logDebug("file: "__FILE__", line: %d, " \
            "delay thread enter, task args: %p", __LINE__, task->func_args);

    task->thread_running = true;
    task->task_func(task->func_args);

    logDebug("file: "__FILE__", line: %d, " \
            "delay thread exit, task args: %p", __LINE__, task->func_args);

    fast_mblock_free_object(&pContext->mblock, task);
    pthread_detach(pthread_self());
	return NULL;
}
Esempio n. 29
0
int tarch::parallel::Node::reserveFreeTag(const std::string& fullQualifiedMessageName) {
  static int result = 0;
  result++;

  tarch::logging::Log _log("parallel::Node<static>");

  logDebug(
    "reserveFreeTag()",
    "assigned message " << fullQualifiedMessageName
      << " the free tag " << result
  );

  return result;
}
Esempio n. 30
0
static void *sched_call_func(void *args)
{
	ScheduleEntry *pEntry;
    void *func_args;
    TaskFunc task_func;
    int task_id;

    pEntry = (ScheduleEntry *)args;
    task_func = pEntry->task_func;
    func_args = pEntry->func_args;
    task_id = pEntry->id;

    logDebug("file: "__FILE__", line: %d, " \
            "thread enter, task id: %d", __LINE__, task_id);

    pEntry->thread_running = true;
    task_func(func_args);

    logDebug("file: "__FILE__", line: %d, " \
            "thread exit, task id: %d", __LINE__, task_id);
    pthread_detach(pthread_self());
	return NULL;
}