parent_and_child_interactive_marker_server.h
Go to the documentation of this file.
1 #ifndef JSK_INTERACTIVE_MARKER_PARENT_AND_CHILD_INTERACTIVE_MARKER_SERVER_H_
2 #define JSK_INTERACTIVE_MARKER_PARENT_AND_CHILD_INTERACTIVE_MARKER_SERVER_H_
3 
5 #include <std_srvs/Empty.h>
6 #include <jsk_interactive_marker/GetTransformableMarkerPose.h>
7 #include <jsk_interactive_marker/SetParentMarker.h>
8 #include <jsk_interactive_marker/RemoveParentMarker.h>
11 #include <boost/shared_ptr.hpp>
12 
13 namespace jsk_interactive_marker
14 {
16  public:
17  ParentMarkerInformation(std::string p_t_n, std::string p_m_n, Eigen::Affine3d r_p)
18  {
19  parent_topic_name = p_t_n;
20  parent_marker_name = p_m_n;
21  relative_pose = r_p;
22  }
24  {
25  }
26  std::string parent_topic_name;
27  std::string parent_marker_name;
28  Eigen::Affine3d relative_pose;
29  };
30 
32  {
33  public:
35  public:
36  FeedbackSynthesizer(FeedbackCallback c1, FeedbackCallback c2) {cb1=c1; cb2=c2;}
37  FeedbackCallback cb1, cb2;
38  void call_func(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback) {if(cb1) cb1(feedback); if(cb2) cb2(feedback);}
39  };
40 
41  ParentAndChildInteractiveMarkerServer(const std::string &topic_ns, const std::string &server_id="", bool spin_thread = false);
42  bool setParentService(jsk_interactive_marker::SetParentMarker::Request &req, jsk_interactive_marker::SetParentMarker::Response &res);
43  void renewPoseWithParent(std::map <std::string, ParentMarkerInformation>::iterator assoc_it_, geometry_msgs::Pose parent_pose, std_msgs::Header parent_header);
44  bool removeParentService(jsk_interactive_marker::RemoveParentMarker::Request &req, jsk_interactive_marker::RemoveParentMarker::Response &res);
45  bool removeParent(std::string child_marker_name);
46  bool registerAssociationItself(std::string parent_marker_name, std::string parent_topic_name, std::string child_marker_name, geometry_msgs::PoseStamped child_pose_stamped);
47  bool registerAssociationWithOtherNode(std::string parent_marker_name, std::string parent_topic_name, std::string child_marker_name, geometry_msgs::PoseStamped child_pose_stamped);
48  bool registerAssociation(std::string parent_marker_name, std::string parent_topic_name, std::string child_marker_name, geometry_msgs::PoseStamped child_pose_stamped, geometry_msgs::PoseStamped parent_pose_stamped);
49  bool getMarkerPose(std::string target_name, geometry_msgs::PoseStamped &pose_stamped);
50  bool getMarkerPoseService(jsk_interactive_marker::GetTransformableMarkerPose::Request &req,jsk_interactive_marker::GetTransformableMarkerPose::Response &res);
51  geometry_msgs::Pose getRelativePose(geometry_msgs::PoseStamped parent_pose_stamped, geometry_msgs::PoseStamped child_pose_stamped);
52  void selfFeedbackCb(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback);
53  void parentUpdateCb(const visualization_msgs::InteractiveMarkerUpdateConstPtr &update, std::string parent_topic_name);
54  void parentFeedbackCb(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback, std::string parent_topic_name);
55  // overwrite public functions
56  void applyChanges(); // selfUpdateDb
57  bool setCallback(const std::string &name, FeedbackCallback feedback_cb, uint8_t feedback_type=DEFAULT_FEEDBACK_CB);
58  void insert(const visualization_msgs::InteractiveMarker &int_marker);
59  void insert(const visualization_msgs::InteractiveMarker &int_marker, FeedbackCallback feedback_cb, uint8_t feedback_type=DEFAULT_FEEDBACK_CB);
60  bool erase(const std::string &name);
62 
67  std::string topic_server_name_;
68  // map of association including self association
69  std::map <std::string, ParentMarkerInformation> association_list_;
70  // map of subscriber
71  // access: parent server -> subscriber
72  std::map <std::string, ros::Subscriber> parent_update_subscribers_; // self association is not included
73  std::map <std::string, ros::Subscriber> parent_feedback_subscribers_; // self association is not included
74  std::map <std::string, std::shared_ptr <FeedbackSynthesizer> > callback_map_;
75  std::map <std::string, int> parent_subscriber_nums_;
76  };
77 }
78 
79 #endif
ParentMarkerInformation(std::string p_t_n, std::string p_m_n, Eigen::Affine3d r_p)
void call_func(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
bool update(const T &new_val, T &my_val)
std::map< std::string, std::shared_ptr< FeedbackSynthesizer > > callback_map_


jsk_interactive_marker
Author(s): furuta
autogenerated on Sat Mar 20 2021 03:03:33