GithubHelp home page GithubHelp logo

sichitong / mrobot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zsirui/mrobot

0.0 1.0 0.0 327 KB

ROS下的差分两轮小车机器人,STM32F103主控,配有MPU6050六轴传感器和四组超声波

License: MIT License

Python 6.51% C 84.72% Assembly 5.07% Batchfile 0.07% C++ 3.63%

mrobot's Introduction

mrobot

主要功能:

1.电机控制(PID调速)

2.串口通讯(自定义串口通讯协议)

3.超声波测距

4.电池电量检测(ADC采样)

5.蜂鸣器

6.三色LED闪烁

7.六轴传感器MPU6050

宏定义:

_RGB:切换大小RGB-LED灯,全局定义为使用小灯,全局未定义为使用大灯,默认全局未定义

_TEST:测试按键功能,全局定义为开启测试按键功能,全局未定义为关闭测试按键功能,默认全局定义

_DOUBLE:编码器开启双精度,全局定义为开启双精度编码器,全局未定义为关闭双精度编码器,默认全局未定义

_ENABLE_MPU6050:开启MPU6050功能,全局定义为开启6050,全局未定义为关闭6050,默认全局未定义

_PRINT:串口打印信息功能,全局定义为开启通过串口打印相关信息,全局未定义为关闭打印信息,默认全局未定义(注:开启后会影响串口和车载计算机通讯功能,默认使用串口3)

_DMA_USART:DMA方式串口通讯功能,全局定义为使用DMA方式进行串口通讯,全局未定义为不使用DMA方式,默认全局定义

_REMAP:串口3重映射功能,全局定义为将串口3重映射为PC10,PC11(串口4),全局未定义为不开启串口3重映射,默认全局未定义

串口通信协议:

一帧数据为:[消息头(2字节)] [命令(2字节)] [长度(1字节)] [数据(n字节,n=长度)] [校验(1字节)] [消息尾(2字节)]

消息头固定为[0x55 0xaa],消息尾固定为[0x0d 0x0a]

主控发送用命令参数:

(1)0x5a 0x5a:发送速度信息和电池信息

(2)0x5a 0x55:发送速度信息,电池信息和超声波信息

(3)0x5a 0xaa:发送速度信息,电池信息和六轴传感器信息

(4)0x5a 0xa5:发送速度信息,电池信息,超声波信息和六轴传感器信息

(5)0xa5 0x5a:发送速度信息

(6)0xa5 0x55:发送电池信息

(7)0xa5 0xaa:发送超声波信息

(8)0xa5 0xa5:发送六轴传感器信息

主控接收用命令参数:

(1)0x55 0xaa:请求发送速度信息和电池信息

(2)0x55 0x55:请求发送速度信息,电池信息和超声波信息

(3)0x55 0xa5:请求发送速度信息,电池信息和六轴传感器信息

(4)0x55 0x5a:请求发送速度信息,电池信息,超声波信息和六轴传感器信息

(5)0xaa 0xaa:请求发送速度信息

(6)0xaa 0x55:请求发送电池信息

(7)0xaa 0xa5:请求发送超声波信息

(8)0xaa 0x5a:请求发送六轴传感器信息

主控端发送数据段结构:

(1)0x5a 0x5a:[左轮速度(4字节浮点数),右轮速度(4字节浮点数),电池电量(4字节浮点数),电量百分比(4字节浮点数)]

(2)0x5a 0x55:[左轮速度(4字节浮点数),右轮速度(4字节浮点数),电池电量(4字节浮点数),电量百分比(4字节浮点数),前超声波(4字节浮点数),后超声波(4字节浮点数),左超声波(4字节浮点数),右超声波(4字节浮点数)]

(3)0x5a 0xaa:[左轮速度(4字节浮点数),右轮速度(4字节浮点数),电池电量(4字节浮点数),电量百分比(4字节浮点数),pitch角(4字节浮点数),roll角(4字节浮点数),yaw角(4字节浮点数),温度(4字节浮点数)]

(4)0x5a 0xa5:[左轮速度(4字节浮点数),右轮速度(4字节浮点数),电池电量(4字节浮点数),电量百分比(4字节浮点数),pitch角(4字节浮点数),roll角(4字节浮点数),yaw角(4字节浮点数),温度(4字节浮点数),前超声波(4字节浮点数),后超声波(4字节浮点数),左超声波(4字节浮点数),右超声波(4字节浮点数)]

(5)0xa5 0x5a:[左轮速度(4字节浮点数),右轮速度(4字节浮点数)]

(6)0xa5 0x55:[电池电量(4字节浮点数),电量百分比(4字节浮点数)]

(7)0xa5 0xaa:[前超声波(4字节浮点数),后超声波(4字节浮点数),左超声波(4字节浮点数),右超声波(4字节浮点数)]

(8)0xa5 0xa5:[pitch角(4字节浮点数),roll角(4字节浮点数),yaw角(4字节浮点数),温度(4字节浮点数)]

主控端接收数据段结构:

[左轮速度(4字节整数),右轮速度(4字节整数)]

GUI

使用PyQt编写的GUI小程序,用来检测小车串口通讯是否正常

ROS Node

ROS中node节点cpp文件,是小车和ROS通讯的重要桥梁

mrobot's People

Contributors

zsirui avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.