Skip to content

Commit 91f5dd1

Browse files
authored
Merge pull request #71 from ichiro-its/enhancement/get-name-by-id
[PI Sprint 24/25] [Enhancement] - Get Joint Name by Joint ID
2 parents c3aa0b7 + 6576de7 commit 91f5dd1

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

include/tachimawari/joint/model/joint_id.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class JointId
7171
static const std::array<uint8_t, 24> list;
7272

7373
static const std::map<std::string, uint8_t> by_name;
74+
static const std::map<uint8_t, std::string> by_id;
7475

7576
static const std::array<uint8_t, 2> head_ids;
7677
static const std::array<uint8_t, 22> body_ids;

src/tachimawari/joint/model/joint_id.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,32 @@ const std::map<std::string, uint8_t> JointId::by_name = {
8080
{"right_ankle_roll", RIGHT_ANKLE_ROLL},
8181
{"right_ankle_pitch", RIGHT_ANKLE_PITCH}};
8282

83+
const std::map<uint8_t, std::string> JointId::by_id = {
84+
{NECK_YAW, "neck_yaw"},
85+
{NECK_PITCH, "neck_pitch"},
86+
{LEFT_SHOULDER_PITCH, "left_shoulder_pitch"},
87+
{LEFT_SHOULDER_ROLL, "left_shoulder_roll"},
88+
{LEFT_SHOULDER_YAW, "left_shoulder_yaw"},
89+
{LEFT_ELBOW, "left_elbow"},
90+
{LEFT_GRIPPER, "left_gripper"},
91+
{RIGHT_SHOULDER_PITCH, "right_shoulder_pitch"},
92+
{RIGHT_SHOULDER_ROLL, "right_shoulder_roll"},
93+
{RIGHT_SHOULDER_YAW, "right_shoulder_yaw"},
94+
{RIGHT_ELBOW, "right_elbow"},
95+
{RIGHT_GRIPPER, "right_gripper"},
96+
{LEFT_HIP_YAW, "left_hip_yaw"},
97+
{LEFT_HIP_ROLL, "left_hip_roll"},
98+
{LEFT_HIP_PITCH, "left_hip_pitch"},
99+
{LEFT_KNEE, "left_knee"},
100+
{LEFT_ANKLE_ROLL, "left_ankle_roll"},
101+
{LEFT_ANKLE_PITCH, "left_ankle_pitch"},
102+
{RIGHT_HIP_YAW, "right_hip_yaw"},
103+
{RIGHT_HIP_ROLL, "right_hip_roll"},
104+
{RIGHT_HIP_PITCH, "right_hip_pitch"},
105+
{RIGHT_KNEE, "right_knee"},
106+
{RIGHT_ANKLE_ROLL, "right_ankle_roll"},
107+
{RIGHT_ANKLE_PITCH, "right_ankle_pitch"}};
108+
83109
const std::array<uint8_t, 2> JointId::head_ids = {
84110
NECK_YAW,
85111
NECK_PITCH,

0 commit comments

Comments
 (0)