Skip to content

marble703/QDrive_cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QDrive SDK (C++)

简介

本项目为QDrive上位机 cpp 开发工具

正在开发中,欢迎提 issue 和 pr

已知问题: 在 gui 中,未启动 can 可能导致程序崩溃 点击 disconnect 可能导致程序崩溃

代码结构

Driver(驱动部分) -> io(通信功能封装) -> interfacebase(基础通信协议封装) -> interface(高级通信协议封装) -> motor(电机功能封装) logger(日志功能封装)

开发环境

使用 QD4310 电机进行开发和测试

Ubuntu 22.04 g++ 11.4.0 boost 1.74

Arch Linux

依赖

本项目依赖:

通信基础层:

  • Boost (BSL-1.0 License)

日志模块:

图形化界面:

拉取和编译

(如果需要调试界面可能需要手动安装 glfw3, arch linux 也是)

sudo apt install libglfw3-dev pkg-config

git submodule update --init --recursive

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j

可以设置 WITHOUT_GUI=ON 参数忽略调试界面及其 imgui 依赖 可以设置 WITHOUT_LOGGER=ON 参数忽略日志模块及其 spdlog 依赖 由于 example 依赖 logger 依赖,会同时忽略 example 部分

运行示例

可能包含电机使能,电机旋转等操作,注意运行风险

串口:

单个电机 ./build/example/qdrive_example

多个 ./build/example/qdrive_example_two

终端输出 ./build/example/qdrive_example_reader

can: 单个电机 ./build/example/qdrive_example_can 或是

终端输出 ./build/example/qdrive_example_reader_can 或是使用 candump

脚本

设置 usb rule

chmod +x create-udev-rule.sh
./script/create-udev-rule.sh /dev/ttyACM0 QD4310-0 

工具

调试界面

./build/tool/gui/qdrive_gui

串口调试工具

./build/tool/io/qdrive_tool_serial

CAN调试工具

./build/tool/io/qdrive_tool_can

小指令

启动 can 通信

sudo ip link set can0 up type can bitrate 1000000

搜索 can 设备

ip link show | grep can

发送/接收 can 数据

cansend can0 400#000000
candump can0

开源声明

本项目使用 GNU General Public License v3.0 许可证

Copyright (C) 2025 marble703

本项目与QDriver通过 can/serial 协议进行通信

About

QDrive SDK (C++)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published