RobotHardware-UESTC/Hardware/银星机器人底盘/PiRobot-YH_Firmware v1.0/STM32/User/main.cpp

38 lines
1.1 KiB
C++
Raw Normal View History

2024-01-24 22:08:32 +08:00
/******************** (C) COPYRIGHT 2024 GeBot *********************************
* File Name : main.c
* Current Version : V1.0 & ST 3.5.0
* Author : zhanli 719901725@qq.com
* Date of Issued : 2024.01.23 zhanli: Create.
* Comments : Gebot
********************************************************************************/
2024-01-20 13:19:09 +08:00
#include "robot.h"
2024-01-23 15:06:39 +08:00
2024-01-24 22:08:32 +08:00
/**----------------------------------------------------------------------
* Function : main
* Description : Gebot
* Author : zhanli&719901725@qq.com
* Date : 2023/04/22 zhanli
*---------------------------------------------------------------------**/
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
}
}