Skip to content

Commit

Permalink
Allow use of normal robot info files (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwason authored Oct 8, 2024
1 parent fec3e11 commit d98b8db
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io
import random
import drekar_launch_process
import yaml

class MotionExecImpl:
def __init__(self, mp_robot_info, base_url, username, password):
Expand Down Expand Up @@ -161,9 +162,16 @@ def main():

with args.mp_robot_info_file:
mp_robot_info_text = args.mp_robot_info_file.read()
mp_robot_info_dict = yaml.safe_load(mp_robot_info_text)
# Workaround to allow loading from normal robot info file
if 'robot_info' not in mp_robot_info_dict:
d = {
"robot_info": mp_robot_info_dict
}
mp_robot_info_dict = d

info_loader = InfoFileLoader(RRN)
mp_robot_info, mp_robot_ident_fd = info_loader.LoadInfoFileFromString(mp_robot_info_text, "experimental.robotics.motion_program.MotionProgramRobotInfo", "mp_robot")
mp_robot_info, mp_robot_ident_fd = info_loader.LoadInfoFileFromDict(mp_robot_info_dict, "experimental.robotics.motion_program.MotionProgramRobotInfo", "mp_robot")

attributes_util = AttributesUtil(RRN)
mp_robot_attributes = attributes_util.GetDefaultServiceAttributesFromDeviceInfo(mp_robot_info.robot_info.device_info)
Expand Down

0 comments on commit d98b8db

Please sign in to comment.