justagist / panda_robot

A ROS python interface for using the franka robot (requires franka_ros_interface). Simplified control and management API.
https://justagist.github.io/panda_robot
Apache License 2.0
85 stars 17 forks source link

ImportError: PyKDL #12

Closed Cmeo97 closed 3 years ago

Cmeo97 commented 3 years ago

Hi! I'm trying to use the panda_robot package, however when it comes to import PyKDL I have the following problem:

from panda_robot import PandaArm File "/home/cmeo/Desktop/catkin_panda_robot_py/devel/lib/python2.7/dist-packages/panda_robot/init.py", line 34, in exec(__fh.read()) File "", line 18, in File "/home/cmeo/Desktop/catkin_panda_robot_py/src/panda_robot/src/panda_robot/panda_kinematics.py", line 28, in import PyKDL ImportError: /home/cmeo/Desktop/catkin_panda_robot_py/devel/lib/python2.7/dist-packages/PyKDL.so: undefined symbol: _Py_ZeroStruct

What should I do?

This is the building output:

Profile: default Extending: [env] /opt/ros/melodic Workspace: /home/cmeo/Desktop/catkin_panda_robot_py

Build Space: [exists] /home/cmeo/Desktop/catkin_panda_robot_py/build Devel Space: [exists] /home/cmeo/Desktop/catkin_panda_robot_py/devel Install Space: [unused] /home/cmeo/Desktop/catkin_panda_robot_py/install Log Space: [missing] /home/cmeo/Desktop/catkin_panda_robot_py/logs Source Space: [exists] /home/cmeo/Desktop/catkin_panda_robot_py/src DESTDIR: [unused] None

Devel Space Layout: linked Install Space Layout: None

Additional CMake Args: None Additional Make Args: None Additional catkin Make Args: None Internal Make Job Server: True Cache Job Environments: False

Whitelisted Packages: None Blacklisted Packages: None

Workspace configuration appears valid.

[build] Found '17' packages in 0.0 seconds.
[build] Updating package table.
Warning: generated devel space setup files have been deleted. Starting >>> catkin_tools_prebuild
Finished <<< catkin_tools_prebuild [ 1.5 seconds ]
Starting >>> franka_core_msgs
Starting >>> franka_moveit
Starting >>> franka_panda_description
Starting >>> orocos_kdl
Starting >>> panda_hardware_interface
Starting >>> panda_sim_moveit
Finished <<< panda_sim_moveit [ 1.5 seconds ]
Finished <<< panda_hardware_interface [ 1.6 seconds ]
Finished <<< franka_panda_description [ 1.5 seconds ]
Finished <<< franka_moveit [ 1.8 seconds ]
Finished <<< franka_core_msgs [ 2.6 seconds ]
Starting >>> franka_interface
Starting >>> franka_ros_controllers
Starting >>> panda_sim_controllers
Finished <<< orocos_kdl [ 9.7 seconds ]
Starting >>> python_orocos_kdl


Warnings << python_orocos_kdl:cmake /home/cmeo/Desktop/catkin_panda_robot_py/logs/python_orocos_kdl/build.cmake.000.log
CMake Warning (dev) at /usr/src/googletest/CMakeLists.txt:3 (project): Policy CMP0048 is not set: project() command manages VERSION variables. Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

The following variable(s) would be set to empty:

PROJECT_VERSION
PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR
PROJECT_VERSION_PATCH

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/src/googletest/googlemock/CMakeLists.txt:40 (project): Policy CMP0048 is not set: project() command manages VERSION variables. Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

The following variable(s) would be set to empty:

PROJECT_VERSION
PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR
PROJECT_VERSION_PATCH

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/src/googletest/googletest/CMakeLists.txt:47 (project): Policy CMP0048 is not set: project() command manages VERSION variables. Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

The following variable(s) would be set to empty:

PROJECT_VERSION
PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR
PROJECT_VERSION_PATCH

This warning is for project developers. Use -Wno-dev to suppress it.

cd /home/cmeo/Desktop/catkin_panda_robot_py/build/python_orocos_kdl; catkin build --get-env python_orocos_kdl | catkin env -si /usr/bin/cmake /home/cmeo/Desktop/catkin_panda_robot_py/src/orocos_kinematics_dynamics/python_orocos_kdl --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/cmeo/Desktop/catkin_panda_robot_py/devel/.private/python_orocos_kdl -DCMAKE_INSTALL_PREFIX=/home/cmeo/Desktop/catkin_panda_robot_py/install; cd - .................................................................................................................................................................. Finished <<< franka_ros_controllers [ 9.3 seconds ]
Finished <<< panda_sim_controllers [ 9.4 seconds ]
Finished <<< franka_interface [ 11.9 seconds ]
Starting >>> franka_tools
Starting >>> panda_robot
Starting >>> panda_sim_custom_action_server
Finished <<< franka_tools [ 1.9 seconds ]
Finished <<< panda_robot [ 1.9 seconds ]
Finished <<< panda_sim_custom_action_server [ 2.2 seconds ]
Starting >>> panda_gazebo
Finished <<< panda_gazebo [ 9.3 seconds ]
Starting >>> panda_simulator_examples
Finished <<< python_orocos_kdl [ 17.3 seconds ]
Finished <<< panda_simulator_examples [ 2.0 seconds ]
[build] Summary: All 16 packages succeeded!
[build] Ignored: 2 packages were skipped or are blacklisted.
[build] Warnings: 1 packages succeeded with warnings.
[build] Abandoned: None.
[build] Failed: None.
[build] Runtime: 29.6 seconds total.

justagist commented 3 years ago

This looks like it is a compiling issue with your KDL build; this is most likely not because of this package. You should be able to import PyKDL even without this package. Try removing this package (and all of my other packages if you are using them), and see if you are able to import PyKDL; if not, you probably have an outdated KDL package or there is some issue with your build. You can try updating the orocos-kdl package that comes with ROS (sudo apt update && sudo apt install ros-$ROS_DISTRO-orocos-kdl). If you are facing this issue only when the panda_robot package is installed, please let me know how I can reproduce this error.

Cmeo97 commented 3 years ago

I have tried to run it in another PC, but I had the same error. PyKDL works on python2.7, but not with the latest one. Should I set my rospython version to the 2.7? the problem is that when I run it with this version, the quaternion package does not work.

What can I do??

justagist commented 3 years ago

PyKDL works on python2.7, but not with the latest one.

Does not work with the latest what? Have you tried importing PyKDL without installing the packages? If the error is with importing PyKDL, I cannot help you with it as it is an external package. If you tell me how I can reproduce your error, I will try to see if this is some issue in my code.

the problem is that when I run it with this version, the quaternion package does not work.

What do you mean when you say it doesn't work?

justagist commented 3 years ago

What version of Ubuntu, ROS, franka-ros, etc. are you using?

Should I set my rospython version to the 2.7?

If you have ROS Melodic, you should use Python2, if you have Noetic, you should use Python3. This package may not work on any other ROS versions.

Cmeo97 commented 3 years ago

I have ubuntu 18.04 and ros melodic, and the latest franka-ros package ( I think )

Cmeo97 commented 3 years ago

however, when I do rospython, it says me that it is python3.6, and not python2.7, so how it is possible if I have ros melodic?

justagist commented 3 years ago

If you followed the ROS installation instructions, it should have installed Python 2.7 as rospython. I am not sure how you have 3.6 as default version, unless it was manually configured to use 3.6. This package has not been tested with Melodic+Python3 combination, so it is possible that there could be errors. But I think the actual issue is with conflicting Python versions (see this answer in SO, for eg).