当前位置: 首页>>代码示例>>C++>>正文


C++ YARPSemaphore类代码示例

本文整理汇总了C++中YARPSemaphore的典型用法代码示例。如果您正苦于以下问题:C++ YARPSemaphore类的具体用法?C++ YARPSemaphore怎么用?C++ YARPSemaphore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了YARPSemaphore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetJoints

 void SetJoints(JointPos& j)
   {
     mutex.Wait();
     state.joints = j;
     last_neck_time = YARPTime::GetTimeAsSeconds(); 
     mutex.Post();
   }
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:7,代码来源:egomap-working.cpp

示例2: SetGyro

 void SetGyro(double n_yaw, double n_pitch, double n_roll)
   { 
     mutex.Wait();
     state.yaw = n_yaw;  state.pitch = n_pitch;  state.roll = n_roll; 
     last_gyro_time = YARPTime::GetTimeAsSeconds();
     mutex.Post();
   }
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:7,代码来源:egomap-working.cpp

示例3: MarkTarget

void MarkTarget(int id)
{
  printf("Marking current region as target %d\n", id);
  state_mutex.Wait();
  target_manager.Set(id,global_theta,global_phi);
  state_mutex.Post();
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:7,代码来源:egomap-spiderman.cpp

示例4: RegisterName

int YARPSocketNameService::RegisterName(const char *name)
{

  int name_status = -1;
  int result = -1;

  //static YARPInputSocket sock;
  //sock.Register(name);
  //test_global = &sock;

  DBG(5) printf("^^^^^^^^ checking for previous definitions\n");
  if (GetThreadSocket()==NULL)
    {
      DBG(5) printf("^^^^^^^^ checks out okay\n");
      int pid = my_getpid();
      mutex.Wait();
      DBG(5) printf("^^^^^^^^ creating\n");
      YARPInputSocket *is = new YARPInputSocket;
      is_map[pid] = is;
      DBG(5) printf("^^^^^^^^ preparing to register\n");
      is->Register(name);
      result = is->GetAssignedPort();
      mutex.Post();
      DBG(5) printf("^^^^^^^^ Made an input socket handler\n");
      fflush(stdout);
    }

  return result;
}
开发者ID:paulfitz,项目名称:poker,代码行数:29,代码来源:YARPSocketNameService.cpp

示例5: OnRead

 virtual void OnRead()
   {
     assert(Read(0));
     state_mutex.Wait();
     state_joint = Content();
     state_mutex.Post();
   }
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:7,代码来源:egomap-spiderman.cpp

示例6: Get

 int Get(HeadState& dest)
   {
     int result = IsValid();
     mutex.Wait();
     dest = state;
     mutex.Post();
     return result;
   }
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:8,代码来源:egomap-working.cpp

示例7: SetEyes

 void SetEyes(double n_tilt, double n_left_pan, double n_right_pan)
   { 
     mutex.Wait();
     state.tilt = n_tilt;  state.left_pan = n_left_pan;  
     state.right_pan = n_right_pan;
     last_eyes_time = YARPTime::GetTimeAsSeconds(); 
     mutex.Post();
   }
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:8,代码来源:egomap-working.cpp

示例8: ResetControl

void ResetControl()
{
  mutex.Wait();
  HeadMessage& msg = out_cmd.Content();
  msg.type = HeadMsgNonValid;
  out_cmd.Write();
  mutex.Post();
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:8,代码来源:egomap-spiderman.cpp

示例9: IsValid

  int IsValid()
    {
      double now = YARPTime::GetTimeAsSeconds();
      mutex.Wait();
      int result = /*(now-last_gyro_time<1)&&*/(now-last_eyes_time<1)&&
	(now-last_neck_time<1);
      mutex.Post();
      return result;
    }
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:9,代码来源:egomap-working.cpp

示例10: RemovePort

// LATER: find out why this is commented out.
static void RemovePort(YARPPort *port)
{
	ACE_UNUSED_ARG(port);

	port_list_mutex.Wait();

//#ifndef __QNX__
	//  port_list.erase(port);
//#endif
	port_list_mutex.Post();
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:12,代码来源:YARPPort.cpp

示例11: SetNeck

  void SetNeck(double n_tilt, double n_roll,
	       double n_lean, double n_pan)
    {
      mutex.Wait();
      state.neck_tilt = n_tilt;
      state.neck_roll = n_roll;
      state.neck_lean = n_lean;
      state.neck_pan = n_pan;
      //last_neck_time = YARPTime::GetTimeAsSeconds(); 
      mutex.Post();
    }
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:11,代码来源:egomap-working.cpp

示例12:

YARPInputSocket *GetThreadSocket()
{
  int pid = my_getpid();
  YARPInputSocket *result = NULL;
  mutex.Wait();
  if (is_map.find(pid)!=is_map.end())
    {
      result = is_map[pid];
    }
  mutex.Post();
  return result;
}
开发者ID:paulfitz,项目名称:poker,代码行数:12,代码来源:YARPSocketNameService.cpp

示例13: DeactivateAll

void YARPPort::DeactivateAll()
{
	port_list_mutex.Wait();

	PortList::iterator it(port_list);
	it.go_head();		// might not be required.

	while (!it.done())
	{
		(*it)->Deactivate();
		it++;
	}

	port_list_mutex.Post();
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:15,代码来源:YARPPort.cpp

示例14: RequestOrientation

void RequestOrientation(double theta, double phi)
{
  mutex.Wait();
  HeadMessage& msg = out_cmd.Content();
  msg.type = HeadMsgMoveToOrientation;
  msg.j1 = theta;
  msg.j2 = phi;
  msg.j3 = 0;
  msg.j4 = theta;
  msg.j5 = phi;
  msg.j6 = 0;
  msg.j7 = 0;
  out_cmd.Write();
  mutex.Post();
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:15,代码来源:egomap-spiderman.cpp

示例15: main

int main()
{
  in_gyro.Register("/egomap/i:gyro");
  in_eye.Register("/egomap/i:eye");
  out_dir.Register("/egomap/o:dir");

  while (1)
    {
      wake_up_call.Wait();

      HeadState state;
      int ok = head_state_manager.Get(state);
      if (ok)
	{
	  CogGaze dir;
	  dir.Apply(state.joints);
	  
	  printf("LEFT %+8.2f %+8.2f %+8.2f      RIGHT %+8.2f %+8.2f %+8.2f\n", 
		 dir.theta_left*180.0/M_PI, 
		 dir.phi_left*180.0/M_PI,
		 dir.roll_left*180.0/M_PI,
		 dir.theta_right*180.0/M_PI, 
		 dir.phi_right*180.0/M_PI,
		 dir.roll_right*180.0/M_PI);
	}
      //YARPTime::DelayInSeconds(0.05);
    }

  return 0;
}
开发者ID:robotology-legacy,项目名称:yarp1,代码行数:30,代码来源:egomap-working.cpp


注:本文中的YARPSemaphore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。