Plan translation before choosing motion toward a local goal
This commit is contained in:
@@ -19,7 +19,6 @@ import rclpy
|
||||
import yaml
|
||||
from action_msgs.msg import GoalStatus
|
||||
from configuration import observed_configuration
|
||||
from differential_motion import alignment_angle
|
||||
from navigation.arrival_approach import validate_orientation, orientation_identity
|
||||
from navigation.continuous_control import ContinuousControl
|
||||
from navigation.footprint import Footprint
|
||||
@@ -49,7 +48,6 @@ class Navigation:
|
||||
self.command_generation = 0
|
||||
self.path_context = None
|
||||
self.completed_orientation = None
|
||||
self.attempted_alignment = None
|
||||
self.path = None
|
||||
self.path_planned_at = float('-inf')
|
||||
self.active, self.failure = False, None
|
||||
@@ -205,50 +203,30 @@ class Navigation:
|
||||
and self.node.terminal is not None and self.node.terminal.done()
|
||||
and self.node.terminal.result().status == GoalStatus.STATUS_SUCCEEDED):
|
||||
self.completed_orientation = orientation_key
|
||||
# The tracked rover can change heading without translating. Consider
|
||||
# a native Spin before a large direction change, only if the complete
|
||||
# rectangular body turn fits the obstacle/detector reserve and its
|
||||
# complete newly entered track sweep has measured support.
|
||||
# Unsafe turns leave Smac/DWB free to find an arc. Support and all live
|
||||
# command gates still apply during Spin; completion grants no motion.
|
||||
alignment_key = ('align', tuple(goal[:2]), limit)
|
||||
aligning = (not reverse and value['translation_allowed']
|
||||
and self.action_key == alignment_key and self.node.terminal is not None
|
||||
and not self.node.terminal.done())
|
||||
# A changing local endpoint is still a FollowPath task. Let Smac/DWB
|
||||
# choose its curve; facing the endpoint directly is not a prerequisite
|
||||
# for following that curve. Preempting a live path with Spin on every
|
||||
# >30 degree bearing change creates stop/turn/advance oscillations.
|
||||
# A completed/aborted path and explicit mission recovery may still
|
||||
# select a fully observed in-place turn before starting translation.
|
||||
# Smac plans from the measured heading. A destination bearing is not
|
||||
# a path tangent or evidence of reachability, including after a failed
|
||||
# action. Never turn toward an unplanned translation goal. DWB retains
|
||||
# differential steering/pivots while following a feasible native path;
|
||||
# separate Spin is reserved for an explicit non-translating survey.
|
||||
following = (self.action_key is not None and self.action_key[0] == 'path'
|
||||
and self.node.terminal is not None and not self.node.terminal.done())
|
||||
turn = None
|
||||
if (not reverse and value['translation_allowed'] and not aligning and not following
|
||||
and alignment_key != self.attempted_alignment):
|
||||
turn = alignment_angle(pose, goal, terrain, observed['detected'], self.monitor,
|
||||
value['body_contact_height_m'],
|
||||
collision_terrain=observed['collision_terrain'])
|
||||
orienting = aligning or turn is not None or (not reverse and orientation is not None
|
||||
orienting = (not reverse and orientation is not None
|
||||
and orientation_key != self.completed_orientation
|
||||
and not value['translation_allowed'])
|
||||
if not value['translation_allowed'] and not orienting:
|
||||
self.stop()
|
||||
return self.reply('no-permitted-goal', status='blocked', route_observation=route)
|
||||
if orienting:
|
||||
automatic = aligning or turn is not None
|
||||
delta = (goal[:2] if automatic else np.asarray(orientation['xy']))-pose[:2]
|
||||
delta = np.asarray(orientation['xy'])-pose[:2]
|
||||
heading = math.atan2(delta[1], delta[0])
|
||||
angle = math.atan2(math.sin(heading-yaw_of(pose)), math.cos(heading-yaw_of(pose)))
|
||||
key = alignment_key if automatic else orientation_key
|
||||
key = orientation_key
|
||||
if key != self.action_key:
|
||||
self.revoke_command()
|
||||
# Existing mission budgets use simulation time. Do not invent
|
||||
# a second wall-clock maneuver budget in a slower simulation.
|
||||
# The unchanged command/data leases still gate every output.
|
||||
self.node.spin(angle, 0.)
|
||||
if automatic:
|
||||
self.attempted_alignment = alignment_key
|
||||
local_path = [[0.,0.,0.],[0.,0.,0.]]
|
||||
elif reverse:
|
||||
key = ('backup', tuple(goal[:2]), limit)
|
||||
|
||||
Reference in New Issue
Block a user