本文整理汇总了Python中OpenRTM_aist.setTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Python OpenRTM_aist.setTimestamp方法的具体用法?Python OpenRTM_aist.setTimestamp怎么用?Python OpenRTM_aist.setTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRTM_aist
的用法示例。
在下文中一共展示了OpenRTM_aist.setTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
print "Please input number: ",
self._data.data = long(sys.stdin.readline())
OpenRTM_aist.setTimestamp(self._data)
print "Sending to subscriber: ", self._data.data
self._outport.write()
return RTC.RTC_OK
示例2: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
"""
The execution action that is invoked periodically
former rtc_active_do()
\param ec_id target ExecutionContext Id
\return RTC::ReturnCode_t
"""
if self._commandIn.isNew():
self._d_command = self._commandIn.read()
if self._d_command.data[0] == 2:
self.cw_angle = self._d_command.data[1]
self.ccw_angle = self._d_command.data[2]
self.move_time = self._d_command.data[3]
# Servo: Moving CW
self._d_motion.data = [0, self.servo_id,
self.servo_offset + self.ccw_angle, self.move_time_ccw]
OpenRTM_aist.setTimestamp(self._d_motion)
self._motionOut.write()
time.sleep(self.move_time_ccw / 100.0 + self.margin_time / 1000.0)
# Servo: Moving CCW
self._d_motion.data = [0, self.servo_id,
self.servo_offset + self.cw_angle, self.move_time_cw]
OpenRTM_aist.setTimestamp(self._d_motion)
self._motionOut.write()
time.sleep(self.move_time_cw / 100.0 + self.margin_time / 1000.0)
return RTC.RTC_OK
示例3: onDeactivated
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onDeactivated(self, ec_id):
"""
The deactivated action (Active state exit action)
former rtc_active_exit()
\param ec_id target ExecutionContext Id
\return RTC::ReturnCode_t
"""
# Servo Motor: Torque OFF
self._d_on_off.data = [0, self.servo_id, 0]
OpenRTM_aist.setTimestamp(self._d_on_off)
self._on_offOut.write()
# URG: Measurement stop
self._d_urg.data = [0]
OpenRTM_aist.setTimestamp(self._d_urg)
self._urgOut.write()
print('onDeactivated')
return RTC.RTC_OK
示例4: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
#データを新規に受信した場合に、データをm_last_sensor_dataを格納する
if self._distance_sensorIn.isNew():
data = self._distance_sensorIn.read()
if len(data.data) == 4:
self._last_sensor_data = data.data[:]
#センサの計測値がstop_distance以上の時に前進しないようにする
if self._forward_velocity[0] > 0:
for d in self._last_sensor_data:
if d > self._stop_distance[0]:
self._d_target_velocity.data.vx = 0
self._d_target_velocity.data.vy = 0
self._d_target_velocity.data.va = 0
OpenRTM_aist.setTimestamp(self._d_target_velocity)
self._target_velocityOut.write()
return RTC.RTC_OK
#コンフィギュレーションパラメータで設定した速度を送信する
self._d_target_velocity.data.vx = self._forward_velocity[0]
self._d_target_velocity.data.vy = 0
self._d_target_velocity.data.va = self._rotate_velocity[0]
OpenRTM_aist.setTimestamp(self._d_target_velocity)
self._target_velocityOut.write()
return RTC.RTC_OK
示例5: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
#self._data.data = "Guten tag"
#self._data.data = "Einen schönen Tag."
self._data.data = "Ich habe Zwillinge, Danke, Danke."
OpenRTM_aist.setTimestamp(self._data)
self._outport.write()
time.sleep(5)
return RTC.RTC_OK
示例6: __call__
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def __call__(self, info, cdrdata):
data = OpenRTM_aist.ConnectorDataListenerT.__call__(self, info, cdrdata, RTC.TimedFloatSeq(RTC.Time(0,0),[]))
if len(data.data) >= 2:
self._out.data.vx = data.data[1] * self._velocity_by_position[0]
self._out.data.vy = 0
self._out.data.va = data.data[0] * self._rotation_by_position[0]
OpenRTM_aist.setTimestamp(self._out)
self._outOut.write()
示例7: onDeactivated
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onDeactivated(self, ec_id):
#停止する
self._d_target_velocity.data.vx = 0
self._d_target_velocity.data.vy = 0
self._d_target_velocity.data.va = 0
OpenRTM_aist.setTimestamp(self._d_target_velocity)
self._target_velocityOut.write()
return RTC.RTC_OK
示例8: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
sys.stdin.readline()
OpenRTM_aist.setTimestamp(self._data)
self._data.data = "Base"
self._outport.write()
return RTC.RTC_OK
示例9: send_data
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def send_data(self, data):
if len(data) == 4:
self.motion_data = data
elif len(data) == 3:
print('Servo ON/OFF: %s' % data)
self._d_on_off.data = data
OpenRTM_aist.setTimestamp(self._d_on_off)
self._on_offOut.write()
示例10: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
self._data.data = "おはよう"
OpenRTM_aist.setTimestamp(self._data)
self._outport.write()
time.sleep(5)
self._data.data = "こんにちは"
OpenRTM_aist.setTimestamp(self._data)
self._outport.write()
time.sleep(5)
return RTC.RTC_OK
示例11: move_initial
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def move_initial(self, grip, order = [3, 2, 1]):
data = []
pos = self.ik.calc_ik(140, 0, 50)
data.append([0, order[0], pos[order[0] - 1], self.move_time])
data.append([0, order[1], pos[order[1] - 1], self.move_time])
data.append([0, order[2], pos[order[2] - 1], self.move_time])
data.append([0, 4, grip + int(self.ik.calb_4), self.move_time])
for temp in data:
self._d_motion.data = temp
OpenRTM_aist.setTimestamp(self._d_motion)
self._motionOut.write()
time.sleep(self.move_time / 100.0)
示例12: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
for i in range(self._intnum):
pname = "intport%s" % (i,)
self._intdata[pname].data = randint(1, 10)
OpenRTM_aist.setTimestamp(self._intdata[pname])
self._intports[pname].write(self._intdata[pname])
if randint(1, 10) > 3:
self._strdata.data = "normal"
else:
self._strdata.data = "emergency"
OpenRTM_aist.setTimestamp(self._strdata)
self._strport.write(self._strdata)
return RTC.RTC_OK
示例13: onDeactivated
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onDeactivated(self, ec_id):
#停止する
self._d_velocity_out.data.vx = 0
self._d_velocity_out.data.vy = 0
self._d_velocity_out.data.va = 0
OpenRTM_aist.setTimestamp(self._d_velocity_out)
self._velocity_outOut.write()
#ブザーを止める
self._d_buzzer.data = 0
OpenRTM_aist.setTimestamp(self._d_buzzer)
self._buzzerOut.write()
return RTC.RTC_OK
示例14: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
if self._StringInport.isNew():
data = self._StringInport.read()
ans = data.data
w_ans = data.data.decode(self.InputCode[0])
if self.InputCode[0] != self.OutputCode[0]:
ans = w_ans.encode(self.OutputCode[0])
self._StringOutdata.data = ans
OpenRTM_aist.setTimestamp(self._StringOutdata)
self._StringOutport.write()
self._WStringOutdata.data = w_ans
OpenRTM_aist.setTimestamp(self._WStringOutdata)
self._WStringOutport.write()
if self._WStringInport.isNew():
data = self._WStringInport.read()
ans = data.data.encode(self.OutputCode[0])
w_ans = data.data
self._StringOutdata.data = ans
OpenRTM_aist.setTimestamp(self._StringOutdata)
self._StringOutport.write()
self._WStringOutdata.data = w_ans
OpenRTM_aist.setTimestamp(self._WStringOutdata)
self._WStringOutport.write()
return RTC.RTC_OK
示例15: onExecute
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import setTimestamp [as 别名]
def onExecute(self, ec_id):
if not self.client:
print 'Wating connection...'
self.client, address = self.sock.accept()
payload = self.client.recv(4096)
if payload:
print "Speech Recognition Result: %s" % payload
self._d_speech.data = payload
OpenRTM_aist.setTimestamp(self._d_speech)
self.client.send(payload)
self._speechOut.write()
else:
self.client.close()
self.client = None
return RTC.RTC_OK