摘要
由于Python语言自身的执行效率问题,对高精度编码器电机的解读难以满足需求。经过多方比较,最终采用pigpiod C Interface作为开发基础,实现对电机测速和转向判断的面向对象的封装,并利用swig工具将C++类转换成Python调用,结合了C++的高效与Python的便捷。测试结果表明,在树莓派设备上,对于分辨率为11线的霍尔传感器、分辨率为500线的光电传感器,本方案都能够满足精度需求。
Due to the execution efficiency of Python,the interpretation to high-precision encoder motor is difficult to meet the needs.After many comparisons,finally,pigiod C interface is used as the development basis,to implement object-oriented encapsulation of motor speed measurement and steering judgment,and swig tools are used to convert C++classes into Python calls by combining the efficiency of C++with the convenience of Python.The test results show that,on the raspberry pie device,for Hall sensor with 11 line resolution and photoelectric sensor with 500 line resolution,this scheme can meet the accuracy requirements.
作者
边蓓蓓
张东辉
李德胜
BIAN Bei-bei(School of Computer Technology and Engineering,Changchun Institute of Technology,Changchun130012,China)
出处
《长春工程学院学报(自然科学版)》
2020年第2期76-80,共5页
Journal of Changchun Institute of Technology:Natural Sciences Edition
基金
吉林省大学生创新训练项目(202011437110)
吉林省大学生创新训练项目(202011437103)
长春工程学院横向课题(2C20202009)