GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
载入中...
搜索中...
未找到
lookup.hpp
1#pragma once
2
3#include <string_view>
4#include "device/motor/dji.h"
5#include "device/motor/j6006.h"
6#include "device/motor/m9025.h"
7
8namespace roboctrl::device {
9
10inline motor_base& find_motor(std::string_view type, const std::string& name) {
11 if (type == "dji") return roboctrl::get<dji_motor>(name);
12 if (type == "j6006") return roboctrl::get<j6006>(name);
13 if (type == "m9025") return roboctrl::get<m9025>(name);
14 throw std::invalid_argument(std::format("unknown motor type '{}' for {}", type, name));
15}
16
17} // namespace roboctrl::device
DJI 电机及分组抽象。