Boost error when creating custom InteractiveMarkerServer callback

asked 2020-08-05 19:21:00 -0500

updated 2022-01-22 16:10:42 -0500

Evgeny gravatar image

I am working on a piece of code to be ran in rviz that takes code from the following two tutorials:

https://github.com/ros-visualization/... (from the void makeChessPieceMarker as well as alignMarker functions)

https://wiki.ros.org/rviz/Tutorials/I... (I used code from this as the skeleton for my code)


include ros/ros.h
include interactive_markers/interactive_marker_server.h
include tf/tf.h
//the includes in my actual code have # and <> but I couldn't get it to format for this post
using namespace visualization_msgs;
void processFeedback(
    const InteractiveMarkerFeedbackConstPtr &feedback ){
  ROS_INFO_STREAM( feedback->marker_name << " is now at "
      << feedback->pose.position.x << ", " << feedback->pose.position.y
      << ", " << feedback->pose.position.z );
}
void alignMarker( const InteractiveMarkerFeedbackConstPtr &feedback, interactive_markers::InteractiveMarkerServer &server ){
  geometry_msgs::Pose pose = feedback->pose;
  pose.position.x = round(pose.position.x-0.5)+0.5;
  pose.position.y = round(pose.position.y-0.5)+0.5;
  ROS_INFO_STREAM( feedback->marker_name << ":"
      << " aligning position = "
      << feedback->pose.position.x
      << ", " << feedback->pose.position.y
      << ", " << feedback->pose.position.z
      << " to "
      << pose.position.x
      << ", " << pose.position.y
      << ", " << pose.position.z );
  server.setPose( feedback->marker_name, pose );
  server.applyChanges(); 
}
void createCube(const tf::Vector3 &position,interactive_markers::InteractiveMarkerServer &server){
   // create an interactive marker for our server
  InteractiveMarker int_marker;
  int_marker.header.frame_id = "base_link";
  int_marker.header.stamp=ros::Time::now();
  int_marker.name = "my_marker";
  int_marker.description = "Simple 1-DOF Control";
  // create a grey box marker
  Marker box_marker;
  box_marker.type = Marker::CUBE
  box_marker.scale.x = 0.45;
  box_marker.scale.y = 0.45;
  box_marker.scale.z = 0.45;
  box_marker.color.r = 0.5;
  box_marker.color.g = 0.5;
  box_marker.color.b = 0.5;
  box_marker.color.a = 1.0;
  // create a non-interactive control which contains the box
  visualization_msgs::InteractiveMarkerControl box_control;
  box_control.always_visible = true;
  box_control.orientation.w = 1;
  box_control.orientation.x = 0;
  box_control.orientation.y = 1;
  box_control.orientation.z = 0; 
  box_control.interaction_mode = InteractiveMarkerControl::MOVE_PLANE;
  box_control.markers.push_back( box_marker );
  // add the control to the interactive marker
  int_marker.controls.push_back( box_control );
  // add the interactive marker to our collection &
  // tell the server to call processFeedback() when feedback arrives for it
  server.insert(int_marker);
  server.setCallback(int_marker.name, &processFeedback);
  server.setCallback(int_marker.name, &alignMarker, InteractiveMarkerFeedback::POSE_UPDATE); 
 //Problem occurs on this line ^^^^^^^^^^^^^^
}
int main(int argc, char** argv){
  ros::init(argc, argv, "simple_marker");
  // create an interactive marker server on the topic namespace simple_marker
  interactive_markers::InteractiveMarkerServer server("simple_marker");
  tf::Vector3 position;
  position = tf::Vector3(0,0,0);
  createCube(position, server);
  // 'commit' changes and send to all clients
  server.applyChanges();
  // start the ROS main loop
  ros::spin();
}
My problem occurs on the line
 server.setCallback(int_marker.name, &alignMarker, InteractiveMarkerFeedback::POSE_UPDATE); 
The error message I get is:
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
                 from /usr/include/boost/function/detail/function_iterate.hpp:14,
                 from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
                 from /usr/include/boost/function.hpp:64,
                 from /opt/ros/melodic/include/ros/forwards.h:40,
                 from /opt/ros/melodic/include/ros/common.h:37,
                 from /opt/ros/melodic/include/ros/ros.h:43,
                 from /home/slanderkin/catkin_ws/src ...
(more)
edit retag flag offensive close merge delete