leggedrobotics / xpp

Visualization of Motions for Legged Robots in ros-rviz
http://wiki.ros.org/xpp
BSD 3-Clause "New" or "Revised" License
325 stars 100 forks source link

Failed to build on ros noetic on ubuntu 2004 #20

Open cyoahs opened 3 years ago

cyoahs commented 3 years ago

Hello,

I tried to install this package on ubuntu 2004. I tried package management tools, but apt only contains ros-noetic-xpp-msgs, ros-noetic-xpp-states and ros-noetic-xpp-states-dbgsym. When I try to build from source, error occured as

Errors     << xpp_vis:make /home/ycshao/repo/catkin_workspace/logs/xpp_vis/build.make.003.log
/home/ycshao/repo/catkin_workspace/src/xpp/xpp_vis/src/urdf_visualizer.cc: In member function ‘void xpp::UrdfVisualizer::StateCallback(const RobotStateJoint&)’:
/home/ycshao/repo/catkin_workspace/src/xpp/xpp_vis/src/urdf_visualizer.cc:73:85: error: no matching function for call to ‘robot_state_publisher::RobotStatePublisher::publishTransforms(std::map<std::__cxx11::basic_string<char>, double>&, ros::Time, std::string&)’
   73 |   robot_publisher->publishTransforms(joint_positions, ::ros::Time::now(), tf_prefix_);
      |                                                                                     ^
In file included from /home/ycshao/repo/catkin_workspace/src/xpp/xpp_vis/include/xpp_vis/urdf_visualizer.h:45,
                 from /home/ycshao/repo/catkin_workspace/src/xpp/xpp_vis/src/urdf_visualizer.cc:30:
/opt/ros/noetic/include/robot_state_publisher/robot_state_publisher.h:83:16: note: candidate: ‘virtual void robot_state_publisher::RobotStatePublisher::publishTransforms(const std::map<std::__cxx11::basic_string<char>, double>&, const ros::Time&)’
   83 |   virtual void publishTransforms(const std::map<std::string, double>& joint_positions, const ros::Time& time);
      |                ^~~~~~~~~~~~~~~~~
/opt/ros/noetic/include/robot_state_publisher/robot_state_publisher.h:83:16: note:   candidate expects 2 arguments, 3 provided
/home/ycshao/repo/catkin_workspace/src/xpp/xpp_vis/src/urdf_visualizer.cc:74:43: error: cannot convert ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘bool’
   74 |   robot_publisher->publishFixedTransforms(tf_prefix_);
      |                                           ^~~~~~~~~~
      |                                           |
      |                                           std::string {aka std::__cxx11::basic_string<char>}
In file included from /home/ycshao/repo/catkin_workspace/src/xpp/xpp_vis/include/xpp_vis/urdf_visualizer.h:45,
                 from /home/ycshao/repo/catkin_workspace/src/xpp/xpp_vis/src/urdf_visualizer.cc:30:
/opt/ros/noetic/include/robot_state_publisher/robot_state_publisher.h:84:44: note:   initializing argument 1 of ‘virtual void robot_state_publisher::RobotStatePublisher::publishFixedTransforms(bool)’
   84 |   virtual void publishFixedTransforms(bool use_tf_static = false);
      |                                       ~~~~~^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/xpp_vis.dir/build.make:63: CMakeFiles/xpp_vis.dir/src/urdf_visualizer.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:586: CMakeFiles/xpp_vis.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

It seems in ros noetic, robot_publisher->publishFixedTransforms and robot_publisher->publishTransforms have different defination with previous ros distro. I finally fixed this problem by simply changing those two lines mentioned in the error messages. But this change breaks the TF relationship and results in incorrect display in rviz for links.

thvhauwe commented 3 years ago

see my pull request #21 for a possible fix...

Veverest commented 3 years ago

Hi, I have run into the same issue. Did you find a workaround until the bug is fixed?

cyoahs commented 3 years ago

Hi, I have run into the same issue. Did you find a workaround until the bug is fixed?

For me, I simpily remove those arguments. As a result, the robot can not be visualized correctly but we can still see the correct base and end effector motion. Maybe you can try @thvhauwe 's solution. @Veverest

CharlyMae commented 3 years ago

Hey I had the same Problem. Thanks for the "fix" now at least its installed and semi-running. If anyone has updates, they are much appreciated.