Skip to content

Commit 698f529

Browse files
committed
Move distance to goal chart creation
1 parent 473806b commit 698f529

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/sam_bot_nav2_gz/test/test_reach_goal_pytest.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131

3232

33-
3433
@pytest.fixture(scope="module")
3534
def reach_goal_proc():
3635
reach_goal = Node(
@@ -141,20 +140,6 @@ def sim():
141140
robot_velocity.to_csv("output/robot_velocity.csv")
142141
print("✓ Exported velocity data to output/robot_velocity.csv")
143142

144-
goal_x, goal_y = 0.8, -0.5
145-
146-
# Create waypoint pose for the navigation goal in custom_odom frame
147-
goal_waypoint = Pose(
148-
x=goal_x, y=goal_y, z=0.0, roll=0.0, pitch=0.0, yaw=0.0, frame="custom_odom"
149-
)
150-
151-
# Calculate distance to goal using the new waypoint feature
152-
distance_to_goal_metric = robot.distance_to(goal_waypoint)
153-
# Export waypoint distance to CSV
154-
distance_to_goal_metric.to_csv("output/robot_distance_to_goal_waypoint.csv")
155-
print(
156-
"✓ Exported waypoint distance data to output/robot_distance_to_goal_waypoint.csv"
157-
)
158143

159144
# Export robot xy position in custom_odom frame
160145
robot.pose(frame_id="custom_odom").to_csv(
@@ -242,6 +227,12 @@ def validate_goal_output(output):
242227
# Check if assertion should pass
243228
artefacts_metrics["distance_to_goal"] = waypoint_dist
244229
# asserts
230+
231+
# Export waypoint distance to CSV
232+
distance_to_goal_metric.to_csv("output/robot_distance_to_goal_waypoint.csv")
233+
print(
234+
"✓ Exported waypoint distance data to output/robot_distance_to_goal_waypoint.csv"
235+
)
245236
assert waypoint_dist < 0.5, (
246237
f"Robot did not reach close enough to goal, distance: {waypoint_dist:.3f}m"
247238
)

0 commit comments

Comments
 (0)