Go to the documentation of this file.
39 #include <geometry_msgs/PoseStamped.h>
43 #include <visualization_msgs/InteractiveMarkerFeedback.h>
53 struct EndEffectorInteraction;
54 struct JointInteraction;
55 struct GenericInteraction;
76 class InteractionHandler :
public LockedRobotState
82 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>());
86 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>());
90 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>());
92 InteractionHandler(
const std::string& name,
const moveit::core::RobotModelConstPtr& model,
93 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>());
99 const std::string&
getName()
const
154 void setMenuHandler(
const std::shared_ptr<interactive_markers::MenuHandler>& mh);
159 const std::shared_ptr<interactive_markers::MenuHandler>&
getMenuHandler();
194 const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
199 const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
204 const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
223 const geometry_msgs::Pose& offset, geometry_msgs::PoseStamped& tpose);
225 const std::string
name_;
235 const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback,
251 bool setErrorState(
const std::string& name,
bool new_error_state);
264 std::map<std::string, geometry_msgs::Pose>
offset_map_;
273 std::map<std::string, geometry_msgs::PoseStamped>
pose_map_;
292 std::shared_ptr<interactive_markers::MenuHandler>
menu_handler_;
311 static std::string
fixName(std::string name);
const std::shared_ptr< interactive_markers::MenuHandler > & getMenuHandler()
Get the menu handler that defines menus and callbacks for all interactive markers drawn by this inter...
std::shared_ptr< interactive_markers::MenuHandler > menu_handler_
bool getPoseOffset(const EndEffectorInteraction &eef, geometry_msgs::Pose &m)
Get the offset from EEF to its marker.
const std::string & getName() const
boost::function< void(InteractionHandler *)> StateChangeCallbackFn
bool transformFeedbackPose(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback, const geometry_msgs::Pose &offset, geometry_msgs::PoseStamped &tpose)
void updateStateJoint(moveit::core::RobotState &state, const JointInteraction &vj, const geometry_msgs::Pose &pose, StateChangeCallbackFn &callback)
void clearLastEndEffectorMarkerPose(const EndEffectorInteraction &eef)
Clear the last interactive_marker command pose for the given end-effector.
void setUpdateCallback(const InteractionHandlerCallbackFn &callback)
void setMeshesVisible(bool visible)
std::map< std::string, geometry_msgs::PoseStamped > pose_map_
boost::function< void(InteractionHandler *, bool)> InteractionHandlerCallbackFn
boost::mutex offset_map_lock_
virtual void handleGeneric(const GenericInteraction &g, const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
Update the internal state maintained by the handler using information from the received feedback mess...
KinematicOptionsMapPtr kinematic_options_map_
void clearPoseOffsets()
Clear the pose offset for all end-effectors and virtual joints.
virtual bool inError(const EndEffectorInteraction &eef) const
Check if the marker corresponding to this end-effector leads to an invalid state.
void setMenuHandler(const std::shared_ptr< interactive_markers::MenuHandler > &mh)
Set the menu handler that defines menus and callbacks for all interactive markers drawn by this inter...
bool setErrorState(const std::string &name, bool new_error_state)
void clearError()
Clear any error settings. This makes the markers appear as if the state is no longer invalid.
MOVEIT_CLASS_FORWARD(InteractionHandler)
void setState(const moveit::core::RobotState &state)
Set the state to the new value.
void clearLastMarkerPoses()
Clear the last interactive_marker command poses for all end-effectors and joints.
std::set< std::string > error_state_
boost::function< void(InteractionHandler *handler, bool error_state_changed)> update_callback_
boost::mutex pose_map_lock_
const InteractionHandlerCallbackFn & getUpdateCallback() const
void setControlsVisible(bool visible)
void clearMenuHandler()
Remove the menu handler for this interaction handler.
void clearLastJointMarkerPose(const JointInteraction &vj)
Clear the last interactive_marker command pose for the given joint.
~InteractionHandler() override
bool getControlsVisible() const
bool getLastJointMarkerPose(const JointInteraction &vj, geometry_msgs::PoseStamped &pose)
Get the last interactive_marker command pose for a joint.
moveit::core::RobotStateConstPtr getState() const
get read-only access to the state.
virtual void handleJoint(const JointInteraction &vj, const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
Update the internal state maintained by the handler using information from the received feedback mess...
const std::string planning_frame_
bool getMeshesVisible() const
void clearPoseOffset(const EndEffectorInteraction &eef)
Clear the interactive marker pose offset for the given end-effector.
void updateStateGeneric(moveit::core::RobotState &state, const GenericInteraction &g, const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback, StateChangeCallbackFn &callback)
std::map< std::string, geometry_msgs::Pose > offset_map_
std::shared_ptr< tf2_ros::Buffer > tf_buffer_
bool getLastEndEffectorMarkerPose(const EndEffectorInteraction &eef, geometry_msgs::PoseStamped &pose)
Get the last interactive_marker command pose for an end-effector.
void setPoseOffset(const EndEffectorInteraction &eef, const geometry_msgs::Pose &m)
Set the offset from EEF to its marker.
InteractionHandler(const RobotInteractionPtr &robot_interaction, const std::string &name, const moveit::core::RobotState &initial_robot_state, const std::shared_ptr< tf2_ros::Buffer > &tf_buffer=std::shared_ptr< tf2_ros::Buffer >())
bool getErrorState(const std::string &name) const
virtual void handleEndEffector(const EndEffectorInteraction &eef, const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
Update the internal state maintained by the handler using information from the received feedback mess...
void updateStateEndEffector(moveit::core::RobotState &state, const EndEffectorInteraction &eef, const geometry_msgs::Pose &pose, StateChangeCallbackFn &callback)
static std::string fixName(std::string name)