ros-industrial / reach_ros2

ROS2 packages for REACH
Apache License 2.0
15 stars 4 forks source link

Localization of interactive markers #34

Open WZHwerk5 opened 4 months ago

WZHwerk5 commented 4 months ago

Hi, I'm implementing this package to my own robot and to-be-processed workpiece. Since the pose of my workpiece would be changed frequently, I set the collision_mesh_frame as well as points_frame for target_pose_generator as my workpiece link(object_link) in config file. However, the interactive markers based on point cloud still remain at the base frame of robot (link_0), they are not aligned with my mesh model which is located correctly for robot processing. Could you please tell me how to fix this? Thanks in advance!

Here is my config file:

# Anchors
planning_group: &planning_group arm
collision_mesh_filename: &collision_mesh_filename package://reach_ros/iiwa/config/chair_seat_col.ply

optimization:
  radius: 0.2
  max_steps: 10
  step_improvement_threshold: 0.01

ik_solver:
  name: MoveItIKSolver
  distance_threshold: 0.0
  planning_group: *planning_group
  collision_mesh_frame: object_link
  collision_mesh_filename: *collision_mesh_filename
  touch_links: []

evaluator:
  name: MultiplicativeEvaluator
  plugins:
    - name: ManipulabilityMoveIt
      planning_group: *planning_group
    - name: DistancePenaltyMoveIt
      planning_group: *planning_group
      distance_threshold: 0.025
      exponent: 2
      collision_mesh_filename: *collision_mesh_filename
      touch_links: []

display:
  name: ROSDisplay
  collision_mesh_filename: *collision_mesh_filename
  collision_mesh_frame: object_link
  kinematic_base_frame: link_0
  marker_scale: 0.05

target_pose_generator:
  name: PointCloudTargetPoseGenerator
  pcd_file: package://reach_ros/iiwa/config/chair_seat_col.pcd
  points_frame: object_link
  target_frame: link_0

logger:
  name: BoostProgressConsoleLogger

Here is the visualization in Rviz: Screenshot from 2024-03-04 10-46-26

marip8 commented 4 months ago

Try using the TransformedPointCloudTargetPoseGenerator class instead. The poses for the reach study ultimately need to be defined relative to the base frame of the kinematic chain that you are using to solve IK, so this plugin will use TF to transform points defined in an arbitrary frame (object_link) to the defined kinematic base frame (link0). The PointCloudTargetPoseGenerator just assumes the point cloud file is already defined in the kinematic base frame.

target_pose_generator:
-  name: PointCloudTargetPoseGenerator
+  name: TransformedPointCloudTargetPoseGenerator
  pcd_file: package://reach_ros/iiwa/config/chair_seat_col.pcd
  points_frame: object_link
  target_frame: link_0
WZHwerk5 commented 4 months ago

Thanks, it has been solved!