fix(simulation): use PX4 rover offboard control level

This commit is contained in:
DCCONSTRUCTIONS
2026-07-24 22:40:44 +03:00
parent 8ace0cd102
commit 6ad1803aaa
2 changed files with 21 additions and 49 deletions
+8 -13
View File
@@ -59,10 +59,8 @@ class _Message:
class _Messages:
OffboardControlMode = _Message
RoverSpeedSetpoint = _Message
RoverThrottleSetpoint = _Message
RoverSteeringSetpoint = _Message
RoverAttitudeSetpoint = _Message
RoverRateSetpoint = _Message
class _Publisher:
@@ -173,8 +171,8 @@ def test_worker_agent_command_dispatch_fails_closed_on_unsafe_envelope() -> None
)
def test_px4_adapter_publishes_speed_steering_without_direct_actuators() -> None:
publishers = [_Publisher() for _ in range(5)]
def test_px4_adapter_maps_speed_to_stock_rover_throttle_without_direct_actuators() -> None:
publishers = [_Publisher() for _ in range(3)]
Ros2Px4AckermannControl._publish_setpoint(
_Messages,
@@ -185,14 +183,11 @@ def test_px4_adapter_publishes_speed_steering_without_direct_actuators() -> None
)
offboard = publishers[0].messages[0]
speed = publishers[1].messages[0]
throttle = publishers[1].messages[0]
steering = publishers[2].messages[0]
attitude = publishers[3].messages[0]
rate = publishers[4].messages[0]
assert offboard.velocity is True
assert offboard.velocity is False
assert offboard.thrust_and_torque is True
assert offboard.direct_actuator is False
assert speed.speed_body_x == 1.0
assert isnan(speed.speed_body_y)
assert throttle.throttle_body_x == pytest.approx(1.0 / 3.1)
assert isnan(throttle.throttle_body_y)
assert steering.normalized_steering_setpoint == -0.55
assert isnan(attitude.yaw_setpoint)
assert isnan(rate.yaw_rate_setpoint)