visp icon indicating copy to clipboard operation
visp copied to clipboard

error connecting with UR10e robotundefined symbol: _ZNK22vpRobotUniversalRobots12getRobotModeEv

Open shrutichakraborty opened this issue 2 years ago • 6 comments

Hello! I have followed the tutorial on https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-calibration-extrinsic.html

But when I launch the file ./testUniversalRobotsGetData --ip <my robot ip > I get the following error:

./testUniversalRobotsGetData: symbol lookup error: ./testUniversalRobotsGetData: undefined symbol: _ZNK22vpRobotUniversalRobots12getRobotModeEv

I am running the files on an ubuntu22.04 machine and I have installed and built visp from source. Any ideas would be very helpful?

shrutichakraborty avatar Dec 05 '23 14:12 shrutichakraborty

You can launch ldd ./testUniversalRobotsGetData and see which is the libvisp_robot.so library that is used.

One possible reason is that you have multiple ViSP libraries installed and the one that is used isn't build with ur_rtde 3rd party. To check that, run:

$ sudo updatedb 
$ locate libvisp_robot.so

PS: Run sudo apt install locate if updatedb is unknown.

fspindle avatar Dec 05 '23 15:12 fspindle

Hello @fspindle, thanks! I have visp-ros installed as well.. I'm not sure if that is the issue. Here is what I find when I execute locate libvisp_robot.so

Screenshot from 2023-12-05 17-42-57

Here's what I have when I run ldd ./testUniversalRobotsGetData Screenshot from 2023-12-05 17-47-03

I guess I made a listake with my setup, however, I had followed the instructions to build my visp_ws from source (as it said to do so to work with real robot) and prior to that I had installed visp-ros and visp_vision but these folders are in my ros2 workspace.

Could you tell me how to solve this issue?


[EDIT] : I solved the issue by re-building the visp-ws by running cmake -DCMAKE_INSTALL_PREFIX=/opt/ros/$ROS_DISTRO ../visp But I would still like to know how you suggest to organise the different folders and libraries to avoid this kindo fissue in the future.

Also I run into another error :

Screenshot from 2023-12-05 18-17-04 I have a gripper at the end of my UR robot. Do I have to change any default parameters of the code somewhere ?

shrutichakraborty avatar Dec 05 '23 16:12 shrutichakraborty

To use ViSP enabled to use specific 3rd parties linked to hardware (like librealsense, ur_rtde, libfranka, complete list) and ros, I suggest to build everything from source (all the 3rd parties first like librealsense, ur_rtde, libfranka, then visp, then vision_visp and finally visp_ros).

The good way is:

  • to check if ros-$ROS_DISTRO-visp and ros-$ROS_DISTRO-vision-visp binary packages are installed. If so, remove them
  • to build ViSP from source as you did. Note:
    • sudo make install in /opt/ros/$ROS_DISTRO or in /usr is optional
    • without make install you can set VISP_DIR env var to point simply to VISP build folder
    • when ViSP is not found by a cmake project, just set VISP_DIR env var and relaunch a cmake configuration on your project
  • to build and install vision_visp from source (https://github.com/lagadic/vision_visp rolling branch for ros2)
  • to build and install visp_ros from source (https://github.com/lagadic/visp_ros rolling branch for ros2)

fspindle avatar Dec 06 '23 07:12 fspindle

Concerning testUniversalRobotsGetData.cpp that fails around line 134 a possible reason is that the robot moves a little bit between line 119 and line 132.

This can be checked retrieving the joint positions before these 2 lines to see if the robot has moved

      robot.getPosition(vpRobot::JOINT_STATE, q);
      std::cout << "Joint position before fMe_2 [deg]: " << q.rad2deg().t() << std::endl;

      vpHomogeneousMatrix fMe_2 = robot.get_fMe();
      std::cout << "fMe pose matrix: \n" << fMe_2 << std::endl;
      for (size_t i = 0; i < fMe_2.size(); i++) {
        if (!vpMath::equal(fMe_1.data[i], fMe_2.data[i])) {
          std::cout << "Wrong end-effector pose returned by get_fMe(). Test failed" << std::endl;
          return EXIT_FAILURE;
        }
      }

      if (robot.getRobotMode() == 7) {
        robot.getPosition(vpRobot::JOINT_STATE, q);
        std::cout << "Joint position before fMe_3 [deg]: " << q.rad2deg().t() << std::endl;

        vpHomogeneousMatrix fMe_3 = robot.get_fMe(q_init);
        std::cout << "fMe pose matrix: \n" << fMe_3 << std::endl;
        for (size_t i = 0; i < fMe_3.size(); i++) {
          if (!vpMath::equal(fMe_2.data[i], fMe_3.data[i])) {
            std::cout << "Wrong end-effector forward kinematics . Test failed" << std::endl;
            return EXIT_FAILURE;
          }
        }
      }

fspindle avatar Dec 06 '23 07:12 fspindle

Concerning testUniversalRobotsGetData.cpp that fails around line 134 a possible reason is that the robot moves a little bit between line 119 and line 132.

This can be checked retrieving the joint positions before these 2 lines to see if the robot has moved

      robot.getPosition(vpRobot::JOINT_STATE, q);
      std::cout << "Joint position before fMe_2 [deg]: " << q.rad2deg().t() << std::endl;

      vpHomogeneousMatrix fMe_2 = robot.get_fMe();
      std::cout << "fMe pose matrix: \n" << fMe_2 << std::endl;
      for (size_t i = 0; i < fMe_2.size(); i++) {
        if (!vpMath::equal(fMe_1.data[i], fMe_2.data[i])) {
          std::cout << "Wrong end-effector pose returned by get_fMe(). Test failed" << std::endl;
          return EXIT_FAILURE;
        }
      }

      if (robot.getRobotMode() == 7) {
        robot.getPosition(vpRobot::JOINT_STATE, q);
        std::cout << "Joint position before fMe_3 [deg]: " << q.rad2deg().t() << std::endl;

        vpHomogeneousMatrix fMe_3 = robot.get_fMe(q_init);
        std::cout << "fMe pose matrix: \n" << fMe_3 << std::endl;
        for (size_t i = 0; i < fMe_3.size(); i++) {
          if (!vpMath::equal(fMe_2.data[i], fMe_3.data[i])) {
            std::cout << "Wrong end-effector forward kinematics . Test failed" << std::endl;
            return EXIT_FAILURE;
          }
        }
      }

Thanks a lot @fspindle for your help! The robot does move a bit after the breaks are turned off and the robot starts properly. So I run the code after the robot has started. It seems now there is no movement in the robot and I still have the same error :

Screenshot from 2023-12-06 10-17-26 I do notice that the fMe pose matrix is a bit different but since the robot is not physically moving I am not sure where this is coming from?

shrutichakraborty avatar Dec 06 '23 09:12 shrutichakraborty

Concerning testUniversalRobotsGetData.cpp that fails around line 134 a possible reason is that the robot moves a little bit between line 119 and line 132. This can be checked retrieving the joint positions before these 2 lines to see if the robot has moved

      robot.getPosition(vpRobot::JOINT_STATE, q);
      std::cout << "Joint position before fMe_2 [deg]: " << q.rad2deg().t() << std::endl;

      vpHomogeneousMatrix fMe_2 = robot.get_fMe();
      std::cout << "fMe pose matrix: \n" << fMe_2 << std::endl;
      for (size_t i = 0; i < fMe_2.size(); i++) {
        if (!vpMath::equal(fMe_1.data[i], fMe_2.data[i])) {
          std::cout << "Wrong end-effector pose returned by get_fMe(). Test failed" << std::endl;
          return EXIT_FAILURE;
        }
      }

      if (robot.getRobotMode() == 7) {
        robot.getPosition(vpRobot::JOINT_STATE, q);
        std::cout << "Joint position before fMe_3 [deg]: " << q.rad2deg().t() << std::endl;

        vpHomogeneousMatrix fMe_3 = robot.get_fMe(q_init);
        std::cout << "fMe pose matrix: \n" << fMe_3 << std::endl;
        for (size_t i = 0; i < fMe_3.size(); i++) {
          if (!vpMath::equal(fMe_2.data[i], fMe_3.data[i])) {
            std::cout << "Wrong end-effector forward kinematics . Test failed" << std::endl;
            return EXIT_FAILURE;
          }
        }
      }

Thanks a lot @fspindle for your help! The robot does move a bit after the breaks are turned off and the robot starts properly. So I run the code after the robot has started. It seems now there is no movement in the robot and I still have the same error :

Screenshot from 2023-12-06 10-17-26 I do notice that the fMe pose matrix is a bit different but since the robot is not physically moving I am not sure where this is coming from?

Hello @fspindle , I think the error could due to the TCP, from what I understand the kinematic information of the robot is extracted from the UR robot directly therefore the defined TCP on the robot information is communicated to visp. Am I right ? Is there any way that the program does not get access to this information and therefore calculated the kinematics from the tool flange? Am I supposed to change/provide this information in the code or any of the config files in urtde client?

Thanks a lot!

shrutichakraborty avatar Dec 11 '23 15:12 shrutichakraborty