Complete local XY goals without artificial terminal rotations
This commit is contained in:
@@ -110,6 +110,51 @@ def main():
|
||||
assert bridge.native_command() is None
|
||||
bridge.stop()
|
||||
report['unacknowledged_terminal_status'] = terminal.status
|
||||
# Local route/recovery goals have a position, not a terminal heading.
|
||||
# Feed measured poses to the real controller at the planned endpoint:
|
||||
# an artificial path yaw must not cause a rotate/progress-timeout loop.
|
||||
original_pose = list(pose)
|
||||
endpoint = planned.poses[-1].pose
|
||||
heading = 2 * math.atan2(endpoint.orientation.z, endpoint.orientation.w)
|
||||
arrival = float(config['controller_server']['ros__parameters']
|
||||
['goal_checker']['xy_goal_tolerance'])
|
||||
report['position_goal_cases'] = []
|
||||
for error in (.58, math.pi, -math.pi, 2.04, -2.04):
|
||||
distance = arrival - .015
|
||||
yaw = heading + error
|
||||
pose[:] = [endpoint.position.x - distance, endpoint.position.y,
|
||||
original_pose[2], 0., 0., math.sin(yaw/2), math.cos(yaw/2)]
|
||||
time.sleep(.3) # Let the native TF buffer receive the new fixture pose.
|
||||
row = dict(distance_m=distance, yaw_error_rad=error)
|
||||
report['position_goal_cases'].append(row)
|
||||
began = time.monotonic()
|
||||
with bridge.condition:
|
||||
first_sequence = bridge.command_sequence
|
||||
bridge.follow(planned)
|
||||
try:
|
||||
terminal = bridge.await_result(bridge.terminal, 2.)
|
||||
finally:
|
||||
row['elapsed_s'] = time.monotonic() - began
|
||||
row['status'] = (bridge.terminal.result().status
|
||||
if bridge.terminal.done() else None)
|
||||
with bridge.condition:
|
||||
row['commands'] = [list(command) for command in bridge.history
|
||||
if command[0] > first_sequence]
|
||||
assert terminal.status == GoalStatus.STATUS_SUCCEEDED, row
|
||||
assert bridge.native_command() is None
|
||||
bridge.stop()
|
||||
# Position remains mandatory, even with the correct heading.
|
||||
distance = arrival + .05
|
||||
pose[:] = [endpoint.position.x - distance, endpoint.position.y,
|
||||
original_pose[2], 0., 0., math.sin(heading/2), math.cos(heading/2)]
|
||||
time.sleep(.3)
|
||||
bridge.follow(planned)
|
||||
time.sleep(.4)
|
||||
assert not bridge.terminal.done(), 'Outside-radius pose completed the action'
|
||||
bridge.stop()
|
||||
report['outside_position_radius_remains_active'] = True
|
||||
pose[:] = original_pose
|
||||
time.sleep(.3)
|
||||
spin = bridge.spin(.5, 3.)
|
||||
assert spin is not None and spin[1] == 0 and spin[2] > 0
|
||||
# A command from an inactive publisher cannot acquire velocity ownership.
|
||||
|
||||
@@ -94,7 +94,12 @@ def configuration(inputs, robot):
|
||||
required_movement_radius=0.05, movement_time_allowance=8.0),
|
||||
goal_checker=dict(plugin='nav2_controller::SimpleGoalChecker', stateful=True,
|
||||
xy_goal_tolerance=float(inputs['mission']['arrival_radius_m']),
|
||||
yaw_goal_tolerance=0.15),
|
||||
# Mission/local goals specify XY, not a terminal heading.
|
||||
# Keep travel alignment in the explicit Spin behavior;
|
||||
# do not rotate at an already reached intermediate point.
|
||||
# Pinned Humble 1.1.17 compares with strict '<',
|
||||
# so include exactly opposite orientations too.
|
||||
yaw_goal_tolerance=math.nextafter(math.pi, math.inf)),
|
||||
FollowPath={
|
||||
'plugin': 'dwb_core::DWBLocalPlanner',
|
||||
# Upstream default: score acceleration-integrated trajectories
|
||||
|
||||
Reference in New Issue
Block a user