-
Notifications
You must be signed in to change notification settings - Fork 0
/
MotorMetaInfo.h
40 lines (31 loc) · 937 Bytes
/
MotorMetaInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include <map>
#include <optional>
#include <stdint.h>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
#include <functional>
#include "Layout.h"
namespace dynamixel::meta {
template <LayoutType Head, LayoutType... Types, typename CB>
void forLayoutTypes(CB&& cb) {
cb(MotorLayoutInfo<Head>{});
if constexpr (sizeof...(Types) > 0) {
forLayoutTypes<Types...>(std::forward<CB>(cb));
}
};
template <typename CB>
void forAllLayoutTypes(CB&& cb) {
forLayoutTypes<LayoutType::MX_V1, LayoutType::MX_V2, LayoutType::Pro, LayoutType::XL320, LayoutType::AX>(std::forward<CB>(cb));
};
struct MotorInfo {
uint16_t modelNumber;
LayoutType layout;
std::string shortName;
std::vector<std::string> motorNames;
};
auto getMotorInfo(uint16_t _modelNumber) -> MotorInfo const*;
auto getMotorInfo(std::string const& _name) -> MotorInfo const*;
}