本文整理汇总了Python中arduino.Arduino.calibration方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.calibration方法的具体用法?Python Arduino.calibration怎么用?Python Arduino.calibration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arduino.Arduino
的用法示例。
在下文中一共展示了Arduino.calibration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WebsocketHandler
# 需要导入模块: from arduino import Arduino [as 别名]
# 或者: from arduino.Arduino import calibration [as 别名]
#.........这里部分代码省略.........
envelopes = self.mongo_envelopes.find({"user_id": ObjectId(message[1])})
envelopes = bson.json_util.dumps(envelopes).replace(",", "§")
self.write_message("colliders," + gestures + "," + envelopes)
elif message[0] == "study_start_trial":
self.mongo_studies.update({"_id": self.current_study_participant}, {
"$set": {
"trials." + message[1] + ".type": message[2],
"trials." + message[1] + ".optitrack_data": [],
"trials." + message[1] + ".touch_data": [],
"trials." + message[1] + ".timestamp": time.time()
}
})
self.data_fetcher.get_data_for_study(self.current_study_participant, message[1])
self.hand.get_data_for_study(self.current_study_participant, message[1])
if message[2][-6:] == "-noems":
self.arduino.study_no_ems = True
self.start_time = time.time()
elif message[0] == "study_end_trial":
fat_var = self.data_fetcher.done_with_study_data()
self.mongo_studies.update({"_id": self.current_study_participant}, {
"$set": {
"trials." + message[1] + ".time": time.time() - self.start_time,
"trials." + message[1] + ".optitrack_data": fat_var
}
})
self.hand.done_with_study_data()
self.arduino.study_no_ems = False
elif message[0] == "calibrate":
self.arduino.calibration(message)
elif message[0] == "load_study":
data = self.mongo_studies.find_one({"participant_id": message[1]})
self.current_study_participant = data["_id"]
self.mongo_studies.update({"_id": self.current_study_participant}, {"$set": {"name": message[2], "trials": {}}})
self.write_message("study_data," + json.dumps(data['order']).replace(",", "§"))
elif message[0] == "save_channels":
self.mongo_users.update({"_id": ObjectId(message[1])}, {"$set": {
"channels." + message[2]: {
"min": message[3],
"max": message[4]
}
}})
elif message[0] == "door":
if message[1] == "e":
self.hand.door_mode = "enter"
elif message[1] == "k":
self.hand.door_mode = "knock"
elif message[0] == "load_user":
self.hand.user = message[2]
gestures = list(self.mongo_gestures.find({"user_id": ObjectId(message[2])}, {"name": True}))
if not message[1] == message[2]:
user_gestures = list(self.mongo_gestures.find({"user_id": ObjectId(message[1])}, {"name": True}))
new_gestures = []
for gesture in gestures:
for gest in user_gestures:
if gest['name'] == gesture['name']:
gest['name'] = gest['name'] + " (modified)"
gesture = gest