2024-01-20 13:19:09 +08:00
|
|
|
#include "robot.h"
|
2024-01-23 15:06:39 +08:00
|
|
|
|
2024-01-20 13:19:09 +08:00
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
//初始化
|
2024-01-23 15:06:39 +08:00
|
|
|
Robot::get()->Init();
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
while (1) {
|
|
|
|
// 检测接收的命令
|
2024-01-23 15:06:39 +08:00
|
|
|
Robot::get()->CheckCommand();
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
// 运动解算 把上位机下发的机器人的速度(线速度角速度)转为各个轮子的速度
|
2024-01-23 15:06:39 +08:00
|
|
|
Robot::get()->DoKinmatics();
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
// 根据轮子的编码器计算得到机器人的里程计
|
2024-01-23 15:06:39 +08:00
|
|
|
Robot::get()->CalcOdom();
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
// 读取imu的值
|
2024-01-23 15:06:39 +08:00
|
|
|
Robot::get()->GetImuData();
|
2024-01-20 13:19:09 +08:00
|
|
|
|
|
|
|
// 检测处理ps2的按键信息
|
2024-01-23 15:06:39 +08:00
|
|
|
Robot::get()->CheckJoystick();
|
2024-01-20 13:19:09 +08:00
|
|
|
}
|
|
|
|
}
|