37 #ifndef MOVEIT_ROBOT_INTERACTION_INTERACTION_HANDLER_ 38 #define MOVEIT_ROBOT_INTERACTION_INTERACTION_HANDLER_ 43 #include <visualization_msgs/InteractiveMarkerFeedback.h> 53 class EndEffectorInteraction;
54 class JointInteraction;
81 const robot_state::RobotState& initial_robot_state,
85 InteractionHandler(
const RobotInteractionPtr& robot_interaction,
const std::string& name,
89 InteractionHandler(
const std::string& name,
const robot_state::RobotState& initial_robot_state,
92 InteractionHandler(
const std::string& name,
const robot_model::RobotModelConstPtr& model,
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);
228 const geometry_msgs::Pose& offset, geometry_msgs::PoseStamped& tpose);
240 const visualization_msgs::InteractiveMarkerFeedbackConstPtr* feedback,
241 StateChangeCallbackFn* callback);
246 const geometry_msgs::Pose* pose, StateChangeCallbackFn* callback);
251 StateChangeCallbackFn* callback);
256 bool setErrorState(
const std::string& name,
bool new_error_state);
278 std::map<std::string, geometry_msgs::PoseStamped>
pose_map_;
316 boost::function<void(InteractionHandler* handler, bool error_state_changed)>
update_callback_;
325 static std::string
fixName(std::string name);
void clearPoseOffsets()
Clear the pose offset for all end-effectors and virtual joints.
const void * robot_interaction_
robot_state::RobotStateConstPtr getState() const
get read-only access to the state.
void updateStateJoint(robot_state::RobotState *state, const JointInteraction *vj, const geometry_msgs::Pose *pose, StateChangeCallbackFn *callback)
bool getControlsVisible() const
boost::function< void(InteractionHandler *handler, bool error_state_changed)> update_callback_
boost::mutex pose_map_lock_
bool getErrorState(const std::string &name) const
void clearLastMarkerPoses()
Clear the last interactive_marker command poses for all end-effectors and joints. ...
std::set< std::string > error_state_
void clearMenuHandler()
Remove the menu handler for this interaction handler.
const std::string & getName() const
kinematics::KinematicsQueryOptions getKinematicsQueryOptions() const
void setControlsVisible(bool visible)
void setRobotInteraction(RobotInteraction *robot_interaction)
This should only be called by RobotInteraction. Associates this InteractionHandler to a RobotInteract...
void setState(const robot_state::RobotState &state)
Set the state to the new value.
void clearLastJointMarkerPose(const JointInteraction &vj)
Clear the last interactive_marker command pose for the given joint.
virtual ~InteractionHandler()
std::map< std::string, geometry_msgs::Pose > offset_map_
bool getLastJointMarkerPose(const JointInteraction &vj, geometry_msgs::PoseStamped &pose)
Get the last interactive_marker command pose for a joint.
void setKinematicsQueryOptionsForGroup(const std::string &group_name, const kinematics::KinematicsQueryOptions &options)
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.
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...
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...
const std::string planning_frame_
void clearPoseOffset(const EndEffectorInteraction &eef)
Clear the interactive marker pose offset for the given end-effector.
bool getMeshesVisible() const
bool getPoseOffset(const EndEffectorInteraction &eef, geometry_msgs::Pose &m)
Get the offset from EEF to its marker.
std::shared_ptr< interactive_markers::MenuHandler > menu_handler_
static std::string fixName(std::string name)
boost::function< void(InteractionHandler *)> StateChangeCallbackFn
boost::shared_ptr< tf::Transformer > tf_
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...
virtual bool inError(const EndEffectorInteraction &eef) const
Check if the marker corresponding to this end-effector leads to an invalid state. ...
void updateStateGeneric(robot_state::RobotState *state, const GenericInteraction *g, const visualization_msgs::InteractiveMarkerFeedbackConstPtr *feedback, StateChangeCallbackFn *callback)
boost::function< void(InteractionHandler *, bool)> InteractionHandlerCallbackFn
void setIKTimeout(double timeout)
void clearLastEndEffectorMarkerPose(const EndEffectorInteraction &eef)
Clear the last interactive_marker command pose for the given end-effector.
bool transformFeedbackPose(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback, const geometry_msgs::Pose &offset, geometry_msgs::PoseStamped &tpose)
void setKinematicsQueryOptions(const kinematics::KinematicsQueryOptions &opt)
void updateStateEndEffector(robot_state::RobotState *state, const EndEffectorInteraction *eef, const geometry_msgs::Pose *pose, StateChangeCallbackFn *callback)
const InteractionHandlerCallbackFn & getUpdateCallback() const
std::map< std::string, geometry_msgs::PoseStamped > pose_map_
void setUpdateCallback(const InteractionHandlerCallbackFn &callback)
void setMeshesVisible(bool visible)
void clearError(void)
Clear any error settings. This makes the markers appear as if the state is no longer invalid...
Maintain a RobotState in a multithreaded environment.
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...
InteractionHandler(const RobotInteractionPtr &robot_interaction, const std::string &name, const robot_state::RobotState &initial_robot_state, const boost::shared_ptr< tf::Transformer > &tf=boost::shared_ptr< tf::Transformer >())
void setIKAttempts(unsigned int attempts)
boost::mutex offset_map_lock_
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 setGroupStateValidityCallback(const robot_state::GroupStateValidityCallbackFn &callback)
MOVEIT_CLASS_FORWARD(InteractionHandler)
KinematicOptionsMapPtr kinematic_options_map_