Skip to content

Commit

Permalink
stop bridging action. bridge action topic
Browse files Browse the repository at this point in the history
  • Loading branch information
mqcmd196 committed Oct 22, 2023
1 parent 2c1e84f commit a5b382c
Showing 1 changed file with 44 additions and 22 deletions.
66 changes: 44 additions & 22 deletions jsk_fetch_robot/jsk_fetch_startup/scripts/moveit_noetic_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
AttachedCollisionObject,
CollisionObject,
MotionPlanResponse,
MoveGroupActionGoal,
MoveGroupActionResult,
MoveGroupActionFeedback,
PlanningScene,
PlanningSceneWorld,
RobotState,
Expand Down Expand Up @@ -217,20 +220,38 @@ def __init__(self):
"/plan_kinematic_path", self._melodic_get_motion_plan.GetMotionPlan
)

# Actionlib
self.move_group_as = actionlib.SimpleActionServer(
"/move_group_noetic",
MoveGroupAction,
execute_cb=self._move_group_action_cb,
auto_start=False,
# Topic
self.move_group_goal_sub = rospy.Subscriber(
"/move_group_noetic/goal",
MoveGroupActionGoal,
self._move_group_goal_cb,
)
self.move_group_goal_pub = rospy.Publisher(
"/move_group/goal",
self._melodic_move_group_goal.MoveGroupActionGoal,
queue_size=1,
)
self.move_group_as.start()
self.move_group_ac = actionlib.SimpleActionClient(
"/move_group", self._melodic_move_group_action.MoveGroupAction
self.move_group_result_sub = rospy.Subscriber(
"/move_group/result",
MoveGroupActionResult,
self._move_group_result_cb,
)

# Topic
self.planning_scene_world_cb = rospy.Subscriber(
self.move_group_result_pub = rospy.Publisher(
"/move_group_noetic/result",
self._melodic_move_group_result.MoveGroupActionResult,
queue_size=1,
)
self.move_group_feedback_sub = rospy.Subscriber(
"/move_group/feedback",
self._melodic_move_group_action.MoveGroupActionFeedback,
self._move_group_feedback_cb,
)
self.move_group_feedback_pub = rospy.Publisher(
"/move_group_noetic/feedback",
MoveGroupActionFeedback,
queue_size=1,
)
self.planning_scene_world_sub = rospy.Subscriber(
"/planning_scene_world_noetic",
PlanningSceneWorld,
self._planning_scene_world_cb,
Expand Down Expand Up @@ -305,19 +326,20 @@ def _plan_kinematic_path_srv_cb(self, request):
)
return response

def _move_group_action_cb(self, goal):
self.move_group_ac.send_goal(
self._convert_noetic_move_group_goal_msg_to_melodic(goal),
feedback_cb=self._move_group_feedback_cb,
def _move_group_goal_cb(self, action_goal):
action_goal.goal = self._convert_noetic_move_group_goal_msg_to_melodic(
action_goal.goal
)
self.move_group_ac.wait_for_result()
result = self.move_group_ac.get_result()
self.move_group_as.set_succeeded(
self._convert_melodic_move_group_result_msg_to_noetic(result)
self.move_group_goal_pub.publish(action_goal)

def _move_group_result_cb(self, action_result):
action_result.result = self._convert_melodic_move_group_result_msg_to_noetic(
action_result.result
)
self.move_group_result_pub.publish(action_result)

def _move_group_feedback_cb(self, feedback):
self.move_group_as.publish_feedback(feedback)
def _move_group_feedback_cb(self, action_feedback):
self.move_group_feedback_pub.publish(action_feedback)

def _planning_scene_world_cb(self, msg):
converted_msg = self._convert_noetic_planning_scene_world_msg_to_melodic(msg)
Expand Down

0 comments on commit a5b382c

Please sign in to comment.