SerialInterface.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:robotics1project 作者: pchorak 项目源码 文件源码
def connect(self, port_name='/dev/ttyACM0', baud_rate=9600):
        self.serial_connection = None
        try:
            self.serial_connection = serial.Serial(
                port=port_name,
                baudrate=baud_rate
            )
        except serial.SerialException as e:
            print "Could not connect", e

        time.sleep(2)  # no idea why but robot does not move if speed commands are sent
        # directly after opening serial

        while self.current_status is None:
            print "Waiting for status message"
            time.sleep(1)
        print "received first status message with position", self.current_status.position
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号