Navigation Messages

Data types for autonomous navigation — goals, paths, maps, and obstacle avoidance.

# simplified
from horus import NavGoal, GoalResult, PathPlan, Waypoint, NavPath, OccupancyGrid, CostMap

Navigation goal — target pose with tolerance.

# simplified
import horus

goal = horus.NavGoal(
    x=5.0, y=3.0, theta=1.57,
    position_tolerance=0.1,
    angle_tolerance=0.05,
    timeout=30.0,
    timestamp_ns=horus.timestamp_ns(),
)
FieldTypeDefaultDescription
x, y, thetafloat0.0Target pose (m, rad)
position_tolerancefloat0.1Position tolerance (m)
angle_tolerancefloat0.1Heading tolerance (rad)
timeoutfloat30.0Goal timeout (seconds)
tolerance_positionfloatPosition tolerance getter (same as position_tolerance)
tolerance_anglefloatAngle tolerance getter (same as angle_tolerance)
timeout_secondsfloatTimeout getter (same as timeout)
goal_idint0Goal identifier
priorityint0Goal priority (higher = more important)
timestamp_nsint0Timestamp in nanoseconds

Methods:

MethodReturnsDescription
with_timeout(seconds)NavGoalReturn a copy with timeout set
with_priority(priority)NavGoalReturn a copy with priority set
is_position_reached(current)boolTrue if current Pose2D is within position tolerance
is_orientation_reached(current)boolTrue if current Pose2D is within angle tolerance
is_reached(current)boolTrue if both position and orientation are reached

GoalResult

Navigation goal outcome.

# simplified
result = horus.GoalResult(goal_id=1, status=0, progress=1.0, timestamp_ns=horus.timestamp_ns())
FieldTypeDefaultDescription
goal_idint0Associated goal identifier
statusint0Result status code
progressfloat0.0Completion progress (0.0-1.0)
distance_to_goalfloat0.0Remaining distance to goal (m)
eta_secondsfloat0.0Estimated time of arrival (seconds)
timestamp_nsint0Timestamp in nanoseconds
MethodReturnsDescription
with_error(message)GoalResultReturn a copy with error message set

Waypoint

Single waypoint in a path.

# simplified
wp = horus.Waypoint(x=2.0, y=3.0, theta=0.0)
FieldTypeDefaultDescription
x, y, thetafloat0.0Waypoint pose (m, rad)
posePose2DWaypoint pose as Pose2D object
velocityTwistDesired velocity at this waypoint
curvaturefloat0.0Path curvature at this point
stop_requiredboolFalseWhether the robot must stop here
MethodReturnsDescription
with_velocity(twist)WaypointReturn a copy with velocity set
with_stop()WaypointReturn a copy with stop_required=True

Ordered list of waypoints. Created with no parameters.

# simplified
path = horus.NavPath()
GetterTypeDescription
waypoint_countintNumber of waypoints
total_lengthfloatTotal path length (m)
duration_secondsfloatEstimated path duration (s)
timestamp_nsintTimestamp
MethodReturnsDescription
add_waypoint(waypoint)NoneAppend a Waypoint to the path
get_waypoints()listGet all waypoints
closest_waypoint_index(pose)int or NoneIndex of closest waypoint to a Pose2D
calculate_progress(pose)floatProgress along path (0.0-1.0) for a Pose2D

PathPlan

Planned path to a goal.

# simplified
plan = horus.PathPlan(goal_x=5.0, goal_y=3.0, goal_theta=1.57, timestamp_ns=horus.timestamp_ns())
FieldTypeDefaultDescription
goal_x, goal_y, goal_thetafloat0.0Goal pose (m, rad)
waypoint_countintNumber of waypoints (getter only)
goal_posetupleGoal as (x, y, theta) tuple (getter only)
timestamp_nsint0Timestamp in nanoseconds

Static Methods:

MethodReturnsDescription
PathPlan.from_waypoints(waypoints, goal_x, goal_y, goal_theta)PathPlanCreate from a list of [x, y, theta] waypoints

Methods:

MethodReturnsDescription
add_waypoint(x, y, theta)boolAdd a waypoint, returns False if full
waypoint(index)tuple or NoneGet waypoint at index as (x, y, theta)
is_empty()boolTrue if no waypoints

OccupancyGrid

2D grid map — each cell is free (0), occupied (100), or unknown (-1).

# simplified
grid = horus.OccupancyGrid(width=100, height=100, resolution=0.05)
FieldTypeDefaultDescription
width, heightint0Grid dimensions (cells)
resolutionfloat0.05Meters per cell
originPose2DMap origin (bottom-left corner)
datalist[int]Occupancy values (-1 to 100)
timestamp_nsint0Timestamp

Methods:

MethodReturnsDescription
occupancy(gx, gy)int or NoneGet occupancy value at grid coordinates
set_occupancy(gx, gy, value)boolSet occupancy value, returns False if out of bounds
is_free(x, y)boolTrue if world point is free (occupancy 0-49)
is_occupied(x, y)boolTrue if world point is occupied (occupancy >= 50)
world_to_grid(x, y)tuple or NoneConvert world coords to grid indices
grid_to_world(gx, gy)tuple or NoneConvert grid indices to world coords

CostMap

Weighted grid for path planning — higher cost = harder to traverse.

# simplified
costmap = horus.CostMap(grid=OccupancyGrid(), inflation_radius=0.55)
FieldTypeDefaultDescription
occupancy_gridOccupancyGridUnderlying occupancy grid (getter)
costslist[int]Cost values (0-255)
inflation_radiusfloat0.55Obstacle inflation radius (m)
cost_scaling_factorfloatCost decay factor
lethal_costintCost threshold for lethal obstacles

Methods:

MethodReturnsDescription
cost(x, y)int or NoneGet cost at world coordinates
compute_costs()NoneRecompute costs from occupancy data

VelocityObstacle / VelocityObstacles

Dynamic obstacle representation for reactive avoidance.

# simplified
vo = horus.VelocityObstacle(
    px=2.0, py_=1.0,
    vx=0.5, vy=0.0,
    radius=0.3,
    time_horizon=1.0,
    obstacle_id=0,
)
vos = horus.VelocityObstacles()  # No parameters
FieldTypeDefaultDescription
pxfloat0.0Position X (m)
py_float0.0Position Y (m) — note trailing underscore
vx, vyfloat0.0Velocity (m/s)
radiusfloat0.0Obstacle radius (m)
time_horizonfloat1.0Planning time horizon (s)
obstacle_idint0Obstacle identifier

VelocityObstacles methods:

MethodReturnsDescription
add_obstacle(obs)NoneAdd a VelocityObstacle
get_obstacles()listGet all obstacles

See Also