Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup RobotInteraction #1287

Merged
merged 2 commits into from
Jan 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ API changes in MoveIt! releases
- KinematicsBase: Deprecated `initialize(robot_description, ...)` in favour of `initialize(robot_model, ...)`.
Adapt your kinematics plugin to directly receive a `RobotModel`. See the [KDL plugin](https://github.com/ros-planning/moveit/tree/melodic-devel/moveit_kinematics/kdl_kinematics_plugin) for an example.
- ``RDFLoader`` / ``RobotModelLoader``: removed TinyXML-based API (https://github.com/ros-planning/moveit/pull/1254)
- Deprecated `EndEffectorInteractionStyle` got removed from `RobotInteraction` (https://github.com/ros-planning/moveit/pull/1287)
Use [the corresponding `InteractionStyle` definitions](https://github.com/ros-planning/moveit/pull/1287/files#diff-24e57a8ea7f2f2d8a63cfc31580d09ddL240) instead

## ROS Kinetic

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,29 @@ class RobotInteraction
// enable/disable subscription of the topics to move interactive marker
void toggleMoveInteractiveMarkerTopic(bool enable);

const std::vector<EndEffectorInteraction>& getActiveEndEffectors() const
{
return active_eef_;
}
const std::vector<JointInteraction>& getActiveJoints() const
{
return active_vj_;
}

private:
// called by decideActiveComponents(); add markers for end effectors
void decideActiveEndEffectors(const std::string& group);
void decideActiveEndEffectors(const std::string& group, InteractionStyle::InteractionStyle style);

// called by decideActiveComponents(); add markers for planar and floating
// joints
// called by decideActiveComponents(); add markers for planar and floating joints
void decideActiveJoints(const std::string& group);

void moveInteractiveMarker(const std::string name, const geometry_msgs::PoseStampedConstPtr& msg);
// register the name of the topic and marker name to move
// interactive marker from other ROS nodes
// register the name of the topic and marker name to move interactive marker from other ROS nodes
void registerMoveInteractiveMarkerTopic(const std::string marker_name, const std::string& name);
// return the diameter of the sphere that certainly can enclose the AABB of the link
double computeLinkMarkerSize(const std::string& link);
// return the diameter of the sphere that certainly can enclose the AABB of
// the links in this group
// return the diameter of the sphere that certainly can enclose the AABB of the links in this group
double computeGroupMarkerSize(const std::string& group);
void computeMarkerPose(const InteractionHandlerPtr& handler, const EndEffectorInteraction& eef,
const robot_state::RobotState& robot_state, geometry_msgs::Pose& pose,
Expand Down Expand Up @@ -225,53 +231,7 @@ class RobotInteraction
std::string topic_;

// options for doing IK
// Locking is done internally
KinematicOptionsMapPtr kinematic_options_map_;

public:
// DEPRECATED. This is included for backwards compatibility.
// These classes/enums used to be subclasses of RobotInteraction. This
// allows client code to continue to work as if they are.

/// DEPRECATED. Instead use
/// robot_interaction::InteractionStyle::InteractionStyle in interaction.h
enum EndEffectorInteractionStyle
{
EEF_POSITION_ARROWS = InteractionStyle::POSITION_ARROWS,
EEF_ORIENTATION_CIRCLES = InteractionStyle::ORIENTATION_CIRCLES,
EEF_POSITION_SPHERE = InteractionStyle::POSITION_SPHERE,
EEF_ORIENTATION_SPHERE = InteractionStyle::ORIENTATION_SPHERE,
EEF_POSITION_EEF = InteractionStyle::POSITION_EEF,
EEF_ORIENTATION_EEF = InteractionStyle::ORIENTATION_EEF,
EEF_FIXED = InteractionStyle::FIXED,
EEF_POSITION = InteractionStyle::POSITION,
EEF_ORIENTATION = InteractionStyle::ORIENTATION,
EEF_6DOF = InteractionStyle::SIX_DOF,
EEF_6DOF_SPHERE = InteractionStyle::SIX_DOF_SPHERE,
EEF_POSITION_NOSPHERE = InteractionStyle::POSITION_NOSPHERE,
EEF_ORIENTATION_NOSPHERE = InteractionStyle::ORIENTATION_NOSPHERE,
EEF_6DOF_NOSPHERE = InteractionStyle::SIX_DOF_NOSPHERE
};
// DEPRECATED. Use InteractionStyle::InteractionStyle version.
void decideActiveComponents(const std::string& group, EndEffectorInteractionStyle style);
// DEPRECATED. Use InteractionStyle::InteractionStyle version.
void decideActiveEndEffectors(const std::string& group, EndEffectorInteractionStyle style);
// DEPRECATED
const std::vector<EndEffectorInteraction>& getActiveEndEffectors() const
{
return active_eef_;
}
// DEPRECATED
const std::vector<JointInteraction>& getActiveJoints() const
{
return active_vj_;
}
// DEPRECATED
static bool updateState(
robot_state::RobotState& state, const EndEffectorInteraction& eef, const geometry_msgs::Pose& pose,
unsigned int attempts, double ik_timeout,
const robot_state::GroupStateValidityCallbackFn& validity_callback = robot_state::GroupStateValidityCallbackFn(),
const kinematics::KinematicsQueryOptions& kinematics_query_options = kinematics::KinematicsQueryOptions());
};
}

Expand Down
48 changes: 10 additions & 38 deletions moveit_ros/robot_interaction/src/robot_interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,26 +485,26 @@ void RobotInteraction::addInteractiveMarkers(const InteractionHandlerPtr& handle
visualization_msgs::InteractiveMarker im = makeEmptyInteractiveMarker(marker_name, pose, mscale);
if (handler && handler->getControlsVisible())
{
if (active_eef_[i].interaction & EEF_POSITION_ARROWS)
addPositionControl(im, active_eef_[i].interaction & EEF_FIXED);
if (active_eef_[i].interaction & EEF_ORIENTATION_CIRCLES)
addOrientationControl(im, active_eef_[i].interaction & EEF_FIXED);
if (active_eef_[i].interaction & (EEF_POSITION_SPHERE | EEF_ORIENTATION_SPHERE))
if (active_eef_[i].interaction & InteractionStyle::POSITION_ARROWS)
addPositionControl(im, active_eef_[i].interaction & InteractionStyle::FIXED);
if (active_eef_[i].interaction & InteractionStyle::ORIENTATION_CIRCLES)
addOrientationControl(im, active_eef_[i].interaction & InteractionStyle::FIXED);
if (active_eef_[i].interaction & (InteractionStyle::POSITION_SPHERE | InteractionStyle::ORIENTATION_SPHERE))
{
std_msgs::ColorRGBA color;
color.r = 0;
color.g = 1;
color.b = 1;
color.a = 0.5;
addViewPlaneControl(im, mscale * 0.25, color, active_eef_[i].interaction & EEF_POSITION_SPHERE,
active_eef_[i].interaction & EEF_ORIENTATION_SPHERE);
addViewPlaneControl(im, mscale * 0.25, color, active_eef_[i].interaction & InteractionStyle::POSITION_SPHERE,
active_eef_[i].interaction & InteractionStyle::ORIENTATION_SPHERE);
}
}
if (handler && handler->getMeshesVisible() &&
(active_eef_[i].interaction & (EEF_POSITION_EEF | EEF_ORIENTATION_EEF)))
(active_eef_[i].interaction & (InteractionStyle::POSITION_EEF | InteractionStyle::ORIENTATION_EEF)))
addEndEffectorMarkers(handler, active_eef_[i], control_to_eef_tf, im,
active_eef_[i].interaction & EEF_POSITION_EEF,
active_eef_[i].interaction & EEF_ORIENTATION_EEF);
active_eef_[i].interaction & InteractionStyle::POSITION_EEF,
active_eef_[i].interaction & InteractionStyle::ORIENTATION_EEF);
ims.push_back(im);
registerMoveInteractiveMarkerTopic(marker_name, handler->getName() + "_" + active_eef_[i].parent_link);
ROS_DEBUG_NAMED("robot_interaction", "Publishing interactive marker %s (size = %lf)", marker_name.c_str(),
Expand Down Expand Up @@ -678,22 +678,6 @@ bool RobotInteraction::showingMarkers(const InteractionHandlerPtr& handler)
return true;
}

// TODO: can we get rid of this? Only used in moveit_ros/benchmarks_gui/src/tab_states_and_goals.cpp right now.
bool RobotInteraction::updateState(robot_state::RobotState& state, const EndEffectorInteraction& eef,
const geometry_msgs::Pose& pose, unsigned int attempts, double ik_timeout,
const robot_state::GroupStateValidityCallbackFn& validity_callback,
const kinematics::KinematicsQueryOptions& kinematics_query_options)
{
if (state.setFromIK(state.getJointModelGroup(eef.parent_group), pose, eef.parent_link,
kinematics_query_options.lock_redundant_joints ? 1 : attempts, ik_timeout, validity_callback,
kinematics_query_options))
{
state.update();
return true;
}
return false;
}

void RobotInteraction::moveInteractiveMarker(const std::string name, const geometry_msgs::PoseStampedConstPtr& msg)
{
std::map<std::string, std::size_t>::const_iterator it = shown_markers_.find(name);
Expand Down Expand Up @@ -836,16 +820,4 @@ void RobotInteraction::processingThread()
}
}
}

// DEPRECATED FUNCTIONALITY for backwards compatibility
void RobotInteraction::decideActiveComponents(const std::string& group, EndEffectorInteractionStyle style)
{
decideActiveComponents(group, (InteractionStyle::InteractionStyle)(int)style);
}

// DEPRECATED FUNCTIONALITY for backwards compatibility
void RobotInteraction::decideActiveEndEffectors(const std::string& group, EndEffectorInteractionStyle style)
{
decideActiveEndEffectors(group, (InteractionStyle::InteractionStyle)(int)style);
}
}