1. CM730.cpp
主要定义了一些和控制板CM730(OP2实际使用的控制板是740)相关的函数,在头文件(CM730.h)中主要声明了三个类,BulkReadData、PlatformCM730、CM730。
BulkReadData类主要作用就是读取指定地址中的值int ReadByte(int address);int ReadWord(int address);参数address必须在start_address和start_address + length之间(start_address length均为成员变量)
CM730类主要是用来实现控制板相关的功能,比如:
开启各个电机的电源(DXLPowerOn()),对指定接口进行写操作(CM730::WriteByte())等
PlatformCM730类比较关键,在官方的架构图中也可以看出来这个类主要作用就是用作接口。
也可以发现,这个类中定义的所有成员函数都是虚函数(virtual),而我们可以发现在LinuxCM730.h头文件中(在Linux/include路径下),实际上LinuxCM730继承了(可能这个说法不严谨)PlatformCM730类(实际上从名字也可以看出来,linux属于一种platform),并且将成员函数重