Skip to content

Remove MoveIt CPP wrapper and use MoveIt directly from Python #6

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

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7a0c81c
Add iras_interfaces msgs
SahWag Oct 27, 2023
3915385
Rework robot_client and submodule nodes
SahWag Oct 27, 2023
8bbe77c
Allow for attaching/detaching
SahWag Nov 6, 2023
ff425d2
Swap the robot_client for individual nodes
SahWag Nov 16, 2023
212c39a
Make objects update their pose from /monitored_planning_scene
SahWag Nov 17, 2023
977dc40
Update object location affter placing
SahWag Nov 17, 2023
3ed95e4
code cleanup
SahWag Nov 21, 2023
e618811
Bugfixes and proper link calling
SahWag Nov 24, 2023
00829e0
Add moveit_Wrapper functionality to moveit_client
SahWag Nov 28, 2023
5d030fc
Fix spelling mistakes
SahWag Nov 28, 2023
13b9f0d
Rename to robot_client and add gripper and maurob functionalities
SahWag Dec 8, 2023
df4feb8
corrected the dependency from std_srv -> std_srvs
Dec 14, 2023
15303fe
formatting and backup as v2 will be introduced based on master
muritane Apr 29, 2024
af4ae67
add and run pre-commit
muritane Apr 30, 2024
4562bdf
Reorganize interface CMakeFile for readability.
destogl Oct 11, 2023
dd3d78d
Better check for pyassimp installation and version.
destogl Oct 19, 2023
ab56b46
comment out unneded goal request args
muritane Apr 30, 2024
5431c85
Apply pre-commit to repository (#8)
mamueluth Jan 15, 2024
1718ad6
refactor robot and moveit clients
muritane May 3, 2024
9133479
update planner profile parsing
muritane May 16, 2024
9e399ae
Delete .pre-commit-config.yaml
destogl May 16, 2024
35634bd
use planning group
muritane May 16, 2024
5069bb1
add planning_group
muritane May 17, 2024
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
Prev Previous commit
Next Next commit
Bugfixes and proper link calling
  • Loading branch information
SahWag committed Nov 24, 2023
commit e6188111cac8ee8bdabf1a42813b406039d59913
17 changes: 11 additions & 6 deletions sr_moveit2_utils/sr_moveit2_utils/moveit_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def __init__(self):
self.tool_link = self.get_parameter("tool_link").value
self.declare_parameter("allowed_touch_links", ["tcp_link", "gripper_base"])
self.allowed_touch_links = self.get_parameter("allowed_touch_links").value
self.declare_parameter("fixed_frame", "world")
self.fixed_frame = self.get_parameter("fixed_frame").value

self.tcp_transforms = TCPTransforms(self)
self.visualization_publisher = VisualizatonPublisher(self)
Expand Down Expand Up @@ -213,11 +215,11 @@ def plan_move_to_execute_cb(self, goal_handle: ServerGoalHandle):

else:
for i, target in enumerate(request.targets):
if (target.pose.header.frame_id != self.chain_base_link):
if (target.pose.header.frame_id != self.fixed_frame):
pose = self.compute_manip_pose(target.pose)
else:
pose = target.pose.pose

self.visualization_publisher.publish_pose_as_transform(pose, self.fixed_frame, "base_position", is_static=True)
self.plan_move_to_feedback.state.plan_message = f"planning for target {i}/{len(request.targets)}"
self.plan_move_to_feedback.state.exec_message = f"executing for target {i}/{len(request.targets)}"
goal_handle.publish_feedback(self.plan_move_to_feedback)
Expand Down Expand Up @@ -300,7 +302,7 @@ def compute_manip_pose(self, source_pose: PoseStamped,
self.get_logger().debug(f'Manip computed pose source frame ({pose_source_frame.header.frame_id}).')
return self.tcp_transforms.to_from_tcp_pose_conversion(pose_source_frame.pose,
pose_source_frame.header.frame_id,
self.chain_base_link, apply_tool_offset)
self.fixed_frame, apply_tool_offset)

def manip_execute_cb(self, goal_handle: ServerGoalHandle):
self.get_logger().info('executing')
Expand Down Expand Up @@ -341,19 +343,22 @@ def manip_execute_cb(self, goal_handle: ServerGoalHandle):
request.pick.pre_grasp_approach.desired_distance)
if reach_pose_robot_base_frame is None:
break
self.visualization_publisher.publish_pose_as_transform(reach_pose_robot_base_frame, self.chain_base_link, "pre_grasp_pose_base_link", is_static=True)
self.visualization_publisher.publish_pose_as_transform(reach_pose_robot_base_frame, self.fixed_frame, "pre_grasp_pose_base_link", is_static=True)
if manip == ManipType.MANIP_REACH_PREPLACE:
# compute pre-place pose
reach_pose_robot_base_frame = self.compute_manip_pose(request.place.place_pose, True,
request.place.pre_place_approach.direction,
request.place.pre_place_approach.desired_distance)
if reach_pose_robot_base_frame is None:
break
self.visualization_publisher.publish_pose_as_transform(reach_pose_robot_base_frame, self.chain_base_link, "pre_place_pose_base_link", is_static=True)
self.visualization_publisher.publish_pose_as_transform(reach_pose_robot_base_frame, self.fixed_frame, "pre_place_pose_base_link", is_static=True)

# perform the action
# do the actual planning and execution

reach_pose_robot_base_frame.orientation.x = -reach_pose_robot_base_frame.orientation.x
reach_pose_robot_base_frame.orientation.y = -reach_pose_robot_base_frame.orientation.y
reach_pose_robot_base_frame.orientation.z = -reach_pose_robot_base_frame.orientation.z
reach_pose_robot_base_frame.orientation.w = -reach_pose_robot_base_frame.orientation.w
if manip == ManipType.MANIP_REACH_PREGRASP:
ret = self.move_client.send_move_request(reach_pose_robot_base_frame, cartesian_trajectory=False,
planner_profile=request.planner_profile if request.planner_profile else "ompl", plan_only=self.plan_first)
Expand Down
13 changes: 7 additions & 6 deletions sr_moveit2_utils/sr_moveit2_utils/scene_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ def planning_scene_cb(self, msg):
# We can update the positions in our dictionary if collision objects match
for obj in msg.world.collision_objects:
self.object_in_the_scene_storage[obj.id] = obj
self.get_logger().info(f"Found object {obj.id} with position {obj.pose.position} in scene with frame {obj.header.frame_id}")

if len(msg.robot_state.attached_collision_objects)>0:
# We can update the positions in our dictionary if collision objects match
for attached_obj in msg.robot_state.attached_collision_objects:
self.attached_object_store[attached_obj.object.id] = attached_obj
self.get_logger().info(f"Found ATTACHED object {attached_obj.object.id} with position {attached_obj.object.pose.position} in scene")



Expand Down Expand Up @@ -235,14 +237,15 @@ def get_object_pose_cb(self,
request: GetObjectPose.Request,
response: GetObjectPose.Response) -> GetObjectPose.Response:
# check if the object exists at all
self.get_logger().debug('Scene Manager get object pose')
self.get_logger().debug('Scene Manager get object pose')
# self.get_logger().warn(f'Looking for {request.id} in\n{self.object_in_the_scene_storage.keys()}')
if not request.id in self.object_in_the_scene_storage:
response.result.state = ServiceResult.NOTFOUND
else:
pose = self.get_object_stamped_pose(request.id)
if pose is not None:
response.result.state = ServiceResult.SUCCESS
response.result.pose = pose
response.pose = pose
else:
response.result.state = ServiceResult.FAILED
return response
Expand All @@ -251,9 +254,8 @@ def get_object_stamped_pose(self, object_id: str):
if not object_id in self.object_in_the_scene_storage.keys():
self.get_logger().error(f"Object '{object_id}' is not known to the scene manager. Did you add it?")
return None

object = self.object_in_the_scene_storage[object_id]

# self.get_logger().warn(f'Scene Manager get object pose {object}')
pose = PoseStamped()
pose.header = deepcopy(object.header)
pose.pose = deepcopy(object.pose)
Expand Down Expand Up @@ -296,7 +298,7 @@ def detach_object(self, object_id: str, detach_to_link=None):
# re-add the object to the store
self.attached_object_store[object_id] = attached_collision_object_to_detach
return False
self.get_logger().info(f"Object {attached_collision_object_to_detach} is successfully detached.")
self.get_logger().info(f"Object {object_id} is successfully detached.")
return True

def detach_collision_object(self, attached_collision_object: AttachedCollisionObject, detach_to_link: str):
Expand Down Expand Up @@ -356,7 +358,6 @@ def attach_object(self, object_id: str, link_name: str, touch_links: list[str]):
collision_object_to_remove.header.frame_id = self.scene_base_frame # TODO(gwalck) unsure about that but is in the tuto
collision_object_to_remove.operation = CollisionObject.REMOVE

self.get_logger().info(f"Attach_object is {object_to_attach}")
#TODO(gwalck) cleanup the duplicate objects coming form the fusion of 2 functions
#object_pose_in_attach_link_name = self.tcp_transforms.to_from_tcp_pose_conversion(object.pose, object.header.frame_id, link_name, False)
#self.get_logger().debug(f"Calculated target pose of {object_to_attach.id} in {link_name} is {object_pose_in_attach_link_name}")
Expand Down