ArduPilot / ArduPilot/MissionPlanner

CS Values Accessed in Python Script Not being Updated

Open
#1,938 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
2.9k
Avg merge
19h 16m
Merged PRs (30d)
4

Description

#### Issue details
If a python script is started before connecting an aircraft (as occurs when conducting a command line launch with the -script flag) or starting a simulation some cs values (cs.lat, cs.lng, etc.) do not properly update. If no craft or simulation has been connected in this run of Mission Planner the reported values for latitude and longitude are both 0. If a user connects an aircraft, runs a script, disconnects the aircraft and then reconnects values are repeated. These appear to be the last values prior to the connection interruption. If you stop the script and re-run it after a flight controller is connected the issue resolves itself.

This issue was observed using both a quadcopter simulation, and pixhawk 2 flight controller

Sample Code For Testing:
`while cs.connected is False:
print "Waiting for Platform"
Script.Sleep(1000)

while True:
print "LAT:", cs.lat
print "LNG:", cs.lng
Script.Sleep(1000)`

#### Version
1.3.53 and 1.3.58

#### Platform
[ ] All
[ ] AntennaTracker
[ X] Copter
[ ] Plane
[ ] Rover
[ ] Sub

Note: Not tested with other platforms

#### Airframe type
quad simulation

#### Hardware type
pixhawk2

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Mission Planner scripting path invoked by the command-line `-script` flag, focusing on the `cs.connected`, `cs.lat`, and `cs.lng` entry points shown in the sample. Reproduce the behavior with the provided loop using a quadcopter simulation or Pixhawk 2, including connection and reconnection. Done means latitude and longitude update after the initial connection and after reconnecting without stopping and rerunning the script.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.