1. Python3.3以字节类型返回编码器信息,b'...',BUF: b'xc3KOOx00OOx00OOx00OOx00OOx00x03x00x00x00x00x99Rxc4x01Fxf9'
用字节类型去找编码器数据
给电机发送的命令是字节型bytes
2. Python2.7以字符串类型返回编码器信息,'...','BUF:' 'OOx00OOx00OOx00OO...x00x03x00x00x00x00xa9x0cxcdx01xabz'
用字符串去找编码器数据
给电机发送的命令是列表形式list
3.可以用类型检测函数type(...)判断读取编码器信息的数据类型:
一次订阅多次调用callback的解决:在订阅函数的尾部使用rospy.spin(),但其后面部分程序将不被执行,所以可以将还需要执行的部分放在callback函数里。