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


Python Arduino.calibration方法代码示例

本文整理汇总了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
开发者ID:PedroLopes,项目名称:affordance,代码行数:70,代码来源:websocket_handler.py


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