Setting other coordinate points does not merge maps correctly
Opened this issue · 1 comments
Setting other coordinate points does not merge maps correctly, and does not merge well in the x-axis direction. Refer to the value of the simulation setting in the code,
map_merge/launch/tb3_simulation/multi_tb3_simulation_launch.py
robots_known_poses = [
{"name": "robot1", "x_pose": 0.0, "y_pose": 0.5, "z_pose": 0.01},
{"name": "robot2", "x_pose": -3.0, "y_pose": 1.5, "z_pose": 0.01},
]
map_merge/config/params.yaml
/robot1/map_merge/init_pose_x: 0.0
/robot1/map_merge/init_pose_y: 0.0
/robot1/map_merge/init_pose_z: 0.0
/robot1/map_merge/init_pose_yaw: 0.0
/robot2/map_merge/init_pose_x: -3.0
/robot2/map_merge/init_pose_y: 1.0
/robot2/map_merge/init_pose_z: 0.0
/robot2/map_merge/init_pose_yaw: 0.0
This default value can just complete the merge, and the effect is also OK.
But would like to use other values. for example
robots_known_poses = [
{"name": "robot1", "x_pose": 0.0, "y_pose": 0.5, "z_pose": 0.01},
{"name": "robot2", "x_pose": -6.0, "y_pose": 1.5, "z_pose": 0.01},
]
/robot2/map_merge/init_pose_x: -6.0
/robot2/map_merge/init_pose_y: 1.0
/robot2/map_merge/init_pose_z: 0.0
/robot2/map_merge/init_pose_yaw: 0.0
After this is changed, the merged map cannot be merged well, and there will always be deviations, and the difference on the X axis will be about 0.5. I tried other coordinate points, and I found that the width and height values of the merged map are always greater than 384, and there will be a merged deviation.
Is there a proper way to set the coordinates for this?
I have found a suitable method to set the coordinate point
Take the middle position of the straight-line distance between the two robots as the coordinate point, then divide X by 10, Y by 10, the A coordinates are all positive values, and the B coordinate points are all negative values.
For example, A:x=6.0,y=1.0 B:x=-4.0,y=2.0 to get the merged map coordinates. A: x=0.5, y=0.05 B: x=-0.5, y=-0.05
For example, A:x=5.0,y=1.2 B:x=-7.0,y=2.8 to get the merged map coordinates. A: x=0.6, y=0.08 B: x=-0.6, y=-0.08
For example, A:x=2.0,y=1.0 B:x=-2.0,y=3.0 to get the merged map coordinates. A: x=0.2, y=0.1 B: x=-0.2, y=-0.1
For example, A:x=6.0,y=2.0 B:x=-6.0,y=2.0 to get the merged map coordinates. A: x=0.6, y=0.0 B: x=-0.6, y=-0.0
The formula is:
Xb1=(abs(X1-X2)/2)/10
Yb1=(abs(Y1-Y2)/2)/10
Xb2=-(abs(X1-X2)/2)/10
Yb2=-(abs(Y1-Y2)/2)/10