diff --git a/frame_editor/CMakeLists.txt b/frame_editor/CMakeLists.txt index 3d7717c..33d6972 100644 --- a/frame_editor/CMakeLists.txt +++ b/frame_editor/CMakeLists.txt @@ -63,6 +63,7 @@ add_service_files( AlignFrame.srv EditFrame.srv GetFrame.srv + GetFrameNames.srv RemoveFrame.srv SetFrame.srv SetParentFrame.srv diff --git a/frame_editor/src/frame_editor/interface_services.py b/frame_editor/src/frame_editor/interface_services.py index f29276a..5f860a2 100644 --- a/frame_editor/src/frame_editor/interface_services.py +++ b/frame_editor/src/frame_editor/interface_services.py @@ -25,6 +25,7 @@ def __init__(self, frame_editor): rospy.Service("~align_frame", AlignFrame, self.callback_align_frame) rospy.Service("~edit_frame", EditFrame, self.callback_edit_frame) rospy.Service("~get_frame", GetFrame, self.callback_get_frame) + rospy.Service("~get_frame_names", GetFrameNames, self.callback_get_frame_names) rospy.Service("~remove_frame", RemoveFrame, self.callback_remove_frame) rospy.Service("~set_frame", SetFrame, self.callback_set_frame) rospy.Service("~set_parent", SetParentFrame, self.callback_set_parent_frame) @@ -112,6 +113,18 @@ def callback_get_frame(self, request): response.pose = ToPose(f.position, f.orientation) return response + + + def callback_get_frame_names(self, request): + print("> Request to get frame names") + + response = GetFrameNamesResponse() + response.error_code = 0 + + for frame in self.editor.frames.values(): + response.names.append(frame.name) + + return response def callback_remove_frame(self, request): diff --git a/frame_editor/srv/GetFrameNames.srv b/frame_editor/srv/GetFrameNames.srv new file mode 100644 index 0000000..eee7ce5 --- /dev/null +++ b/frame_editor/srv/GetFrameNames.srv @@ -0,0 +1,3 @@ +--- +int32 error_code +string[] names