The battery pack belongs to the vehicle, not to a constant - #12
Conversation
A `--model json` SITL takes its battery from the simulator: ArduPilot's JSON backend reads voltage and current out of the physics frame every tick, so the autopilot's own SIM_BATT_* parameters have no effect on what it believes about its pack. skysim was therefore the only thing deciding endurance, and it decided the same thing for every vehicle in every world — a 3S 3.3 Ah hobby pack, 12.6 V full, compiled in. That is roughly a fifth of the aircraft the SkyHub fleet actually stands in for, and it was invisible from the gateway side, which set SIM_BATT_CAP_AH to 27 Ah, read it back as 27 Ah, and watched the vehicle reach its reserve in six minutes. The pack moves onto SpawnRequest, so a caller can describe the aircraft it is simulating, and defaults to the old constants so a spawn that says nothing behaves exactly as before. A pack whose empty voltage is not below its full voltage is corrected rather than accepted: inverted sag would make a draining battery report a rising charge. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 48 minutes. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
A
--model jsonSITL takes its battery from the simulator: ArduPilot's JSON backend reads voltage and current out of the physics frame every tick, so the autopilot's ownSIM_BATT_*parameters have no effect on what it believes about its pack.skysim was therefore the only thing deciding endurance, and it decided the same thing for every vehicle in every world — a 3S 3.3 Ah hobby pack, 12.6 V full, compiled in.
That is roughly a fifth of the aircraft the SkyHub fleet stands in for, and it was invisible from the caller's side: the gateway set
SIM_BATT_CAP_AHto 27 Ah, read it back as 27 Ah, and watched the vehicle reach its reserve in six minutes. Three full survey runs were measured against the wrong aircraft before anyone thought to look at the pack voltage — 12.59 V on what was supposed to be a 25.2 V battery.What changes
The pack moves onto
SpawnRequestas aBatteryPack(capacity, full/empty voltage, idle and draw current), so a caller can describe the aircraft it is simulating, and a world can hold a mixed fleet.Defaults are the old constants, so a spawn that says nothing about its battery behaves exactly as before.
A pack whose empty voltage is not below its full voltage is corrected rather than accepted — inverted sag would make a draining battery report a rising charge, which is worse than refusing the request.
battery/resetnow restores that vehicle's own full voltage rather than a compiled-in one.A note on the field name
hover_ais not the current at hover; it multiplies the square of normalised throttle. Reading it as amps-at-hover is about a factor-of-ten error, and calibrating against an assumed cruise demand rather than a measured one has now gone wrong twice downstream. Worth renaming at some point.Testing
All 11 test binaries pass.
test_apicovers the defaults, a fully-specified pack reaching the tick thread, and the inverted-voltage correction.🤖 Generated with Claude Code