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
code cleanup
  • Loading branch information
SahWag committed Nov 21, 2023
commit 3ed95e43b29c1360b3f0e23c36a522f944947402
3 changes: 1 addition & 2 deletions sr_moveit2_utils/sr_moveit2_utils/move_client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import PoseStamped, Vector3, Pose
from geometry_msgs.msg import Pose
from sr_manipulation_interfaces.srv import MoveToPose, MoveToPoseSeq
from visualization_msgs.msg import MarkerArray
from std_srvs.srv import Trigger


Expand Down
23 changes: 1 addition & 22 deletions sr_moveit2_utils/sr_moveit2_utils/moveit_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from sr_manipulation_interfaces.msg import ManipType, PlanExecState, ServiceResult
from sr_manipulation_interfaces.srv import AttachObject, DetachObject

from geometry_msgs.msg import PoseStamped, Vector3, Vector3Stamped, Pose
from geometry_msgs.msg import PoseStamped, Vector3Stamped, Pose
from moveit_msgs.msg import Grasp
from sr_moveit2_utils.move_client import MoveClient
import moveit_msgs.msg
Expand Down Expand Up @@ -277,7 +277,6 @@ def manip_goal_cb(self, goal: Manip.Goal):
self.active_goal = goal
self.get_logger().debug('Manip goal accepted.')
return GoalResponse.ACCEPT
request.manipulation_sequence[0]

def manip_cancel_cb(self, request):
#TODO stop current execution cleanly ?
Expand Down Expand Up @@ -481,24 +480,6 @@ def did_manip_plan_succeed(self, plan_exec_success: bool, action_name: str, goal
self.get_logger().debug(f'{action_name} failed.')
goal_handle.abort()
return False


self.get_logger().debug('PlanMoveTo execution done.')
if not goal_handle.is_cancel_requested:
if ret:
result.state.plan_state = PlanExecState.PLAN_SUCCESS
result.state.exec_state = PlanExecState.EXEC_SUCCESS
result.success = True
self.get_logger().debug('PlanMoveTo succeeded.')
goal_handle.succeed()
else:
result.state.plan_state = PlanExecState.PLAN_ERROR
result.state.exec_state = PlanExecState.EXEC_ERROR
result.success = False
self.get_logger().debug('PlanMoveTo failed.')
goal_handle.abort()
self.active_goal = None
return result

def send_move_request(self, pose:Pose, cartesian_trajectory:bool=True, planner_profile:str="", velocity_scaling_factor=None):
# use default velocity scaling if not defined
Expand All @@ -511,7 +492,6 @@ def attach(self, id:str, attach_link:str, allowed_touch_links:list[str]):
req.link_name = attach_link
req.touch_links = allowed_touch_links
response = self.attach_object_cli.call(req)
# response = wait_for_response(future, self)
if response.result.state != ServiceResult.SUCCESS:
self.get_logger().error(f"Attach object {id} has failed.")
return False
Expand All @@ -522,7 +502,6 @@ def detach(self, id:str):
req = DetachObject.Request()
req.id = id
response = self.detach_object_cli.call(req)
# response = wait_for_response(future, self)
if response.result.state != ServiceResult.SUCCESS:
self.get_logger().error(f"Detach object {id} has failed.")
return False
Expand Down
13 changes: 0 additions & 13 deletions sr_moveit2_utils/sr_moveit2_utils/scene_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,11 @@ 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
# Load in the object once more
# self.object_in_the_scene_storage[object_id] = attached_collision_object_to_detach.object
# self.object_in_the_scene_storage[object_id].pose = attached_collision_object_to_detach.object.pose
# self.object_in_the_scene_storage[object_id].operation = CollisionObject.ADD
# self.get_logger().info(f"storage id {object_id} is put in: {attached_collision_object_to_detach.object}")
self.get_logger().info(f"Object {attached_collision_object_to_detach} is successfully detached.")
return True

def detach_collision_object(self, attached_collision_object: AttachedCollisionObject, detach_to_link: str):

#object_pose_in_attach_link_name = self.tcp_transforms.to_from_tcp_pose_conversion(object.pose, object.header.frame_id, link_name, False)
detached_collision_object = attached_collision_object

# Add object again to the scene
Expand All @@ -318,9 +312,6 @@ def detach_collision_object(self, attached_collision_object: AttachedCollisionOb
collision_object_to_add.header.frame_id = detach_to_link # TODO(gwalck) unsure about that but is in the tuto
collision_object_to_add.operation = CollisionObject.ADD

#object_pose_in_detach_to_link_name = self.tcp_transforms.to_from_tcp_pose_conversion(collision_object_to_add.pose, collision_object_to_add.header.frame_id, detach_to_link, False)
#collision_object_to_add.mesh_poses = [object_pose_in_detach_to_link_name]

detached_collision_object.object.operation = CollisionObject.REMOVE
#detached_collision_object.object.mesh_poses = [object_pose_in_attach_link_name]

Expand All @@ -333,10 +324,6 @@ def detach_collision_object(self, attached_collision_object: AttachedCollisionOb
planning_scene.robot_state.attached_collision_objects.append(detached_collision_object)
planning_scene.robot_state.is_diff = True
ret = self.apply_planning_scene(planning_scene)
if ret:
# store the object back to the scene
# self.object_in_the_scene_storage[collision_object_to_add.id] = collision_object_to_add
pass
return ret

def attach_object_cb(self,
Expand Down
2 changes: 1 addition & 1 deletion sr_moveit2_utils/sr_moveit2_utils/scene_manager_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from rclpy.node import Node
from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
from rclpy.executors import MultiThreadedExecutor
from sr_manipulation_interfaces.srv import AddObjects, RemoveObjects, AttachObject, DetachObject
from sr_manipulation_interfaces.srv import AttachObject, DetachObject
from sr_manipulation_interfaces.msg import ServiceResult


Expand Down