Ros-Noetic: Python 3 - PyKDL Error

asked 2020-05-24 08:21:08 -0600

mkb_10062949 gravatar image

updated 2020-05-26 08:57:21 -0600

Hello I am trying to read a urdf file but I get error as

python3: /build/orocos-kdl-mPkyII/orocos-kdl-1.4.0/python_orocos_kdl/PyKDL/std_string.sip:52: int convertTo_std_string(PyObject*, void**, int*, PyObject*): Assertion `PyUnicode_Check(s)' failed.

I am using the recommended Ubuntu 20.04 (Focal Fossa) with ROS Noetic

It never used to happen on melodic with python2.7. I am not sure whether its a problem with the package urdf_parser_py or is it with PyKDL?.

I get the error when i try to execute,

from __future__ import print_function
import PyKDL as kdl
import urdf_parser_py.urdf as urdf

     with open(filename) as urdfFile:
                return treeFromUrdfModel(urdf.URDF.from_xml_string(

I think my problem is similar to this,

and I think this is the solution,

But I am not sure how should I edit and incorporate the changes mentioned above.

My urdf file is,

<?xml version="1.0"?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from ur5_joint_limited_robot.urdf.xacro | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot name="ur5">
    <plugin filename="" name="ros_control">
      <!-- <robotNamespace>/</robotNamespace> -->
    <plugin name="gazebo_ros_power_monitor_controller" filename="">
  <!-- camera_link -->
  <gazebo reference="camera_link">
  <!-- camera -->
  <gazebo reference="camera_link">
    <sensor name="camera1" type="camera">
      <camera name="head">
          <!-- Noise is sampled independently per pixel on each frame.
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1]. -->
      <plugin filename="" name="camera_controller">
        <!-- setting hackBaseline to anything but 0.0 will cause a misalignment
            between the gazebo sensor image and the frame it is supposed to
            be attached to -->
  <!-- measured from model -->
  <!--property name="shoulder_height" value="0.089159" /-->
  <!--property name="shoulder_offset" value="0.13585" /-->
  <!-- shoulder_offset - elbow_offset + wrist_1_length = 0.10915 -->
  <!--property name="upper_arm_length" value="0.42500" /-->
  <!--property name="elbow_offset" value="0.1197" /-->
  <!-- CAD measured -->
  <!--property name="forearm_length" value="0.39225" /-->
  <!--property name="wrist_1_length" value="0.093 ...
edit retag flag offensive close merge delete