ros / urdf_parser_py

Standalone URDF parser for Python.
BSD 3-Clause "New" or "Revised" License
86 stars 48 forks source link

Load params from ROS 2 #69

Closed willnil closed 3 years ago

willnil commented 3 years ago

I am using the ROS 2 Foxy branch and the from_parameter_server function has to import rospy (Link), so this is not compatible in the ROS 2 working space.

def from_parameter_server(cls, key='robot_description'):
        """
        Retrieve the robot model on the parameter server
        and parse it to create a URDF robot structure.
        Warning: this requires roscore to be running.
        """
        # Could move this into xml_reflection
        import rospy
        return cls.from_xml_string(rospy.get_param(key))

I compared also the code in ros2 branch and I see the from_paramater_server is removed. So what is the better approach to retrieve the robot model from the ROS 2 parameter server? Thank you

clalancette commented 3 years ago

In ROS 2, there is no parameter server by default. So in ROS 2, urdf_parser_py is a pure parsing library; you can use it to parse an XML, but how you get that XML is up to you.

In the future, please ask questions like this on https://answers.ros.org, which is our centralized place for Questions and Answers. I'm going to close this one out.

willnil commented 3 years ago

Yes I am aware that there is no default parameter server in ROS 2. I cloned the foxy-devel branch and the from_parameter_server function is still there.

clalancette commented 3 years ago

Yes I am aware that there is no default parameter server in ROS 2. I cloned the foxy-devel branch and the from_parameter_server function is still there.

Oh, I see. We removed it from the ros2 branch in #63 , but we never backported that to foxy-devel. Feel free to open up a backport PR, I'll be happy to review.