Giter VIP home page Giter VIP logo

Comments (8)

djnugent avatar djnugent commented on July 17, 2024

Import issue was caused by PATH issues and file permission issues. This has be resolved. Still curious about command line arguments though.

from dronekit-python.

djnugent avatar djnugent commented on July 17, 2024

Ok so I just figured out that "api start script.py" takes its arguments from "mavproxy.py [args]".

from dronekit-python.

tcr3dr avatar tcr3dr commented on July 17, 2024

@djnugent Is this still an issue? Should this be documented better?

from dronekit-python.

hamishwillee avatar hamishwillee commented on July 17, 2024

@tcr3dr @djnugent This is still an issue because I haven't documented command line arguments to api start (at all) and I don't understand enough from this post to do so :-(

  1. When you say this takes its arguments from "mavproxy.py [args]" do you mean that when you run a script with api start filename.py the arguments recieved will be whatever you already passed when you started mavproxy? In most cases that will just be the id of the master/connection?
    • If so, can you pass arbitrary commands to mavproxy and still pick them up in your script (ie launch mavproxy with parameters that mean nothing to mavproxy but which are relevant to the script?
  2. The full question here is "how to interact with the script" - both with command line arguments and by making the script interactive - ie able to wait on and take some form of input. I might (for example) want to be able to send a message to my script from a GCS telling it to change behaviour in some way. Is this reasonable, and if so, can we have a separate issue for it?

from dronekit-python.

tcr3dr avatar tcr3dr commented on July 17, 2024

So I believe the issue is more specifically, "What is sys.argv populated with?" and the answer for this is "The sys.argv visible to mavproxy.py".

To pass "arguments" to your script in the current configuration, the best choice would be environment variables. We could extend api start to fix this.

However, I think punting on this issue is preferable, as in a post-MAVProxy scenario we'd be able to control sys.argv and stdin, leaving it implementation-specific. As such, I'm marking this wontfix.

from dronekit-python.

hamishwillee avatar hamishwillee commented on July 17, 2024

@tcr3dr Makes sense to me. #188 will make a lot of things more "sensible".

from dronekit-python.

hamishwillee avatar hamishwillee commented on July 17, 2024

@tcr3dr Reopening to continue discussion.

Just found that in theory at least you can pass arguments to the script! See http://python.dronekit.io/examples/flight_replay.html

mission_id = int(local_arguments[0])

Any ideas of best place to document this in our current structure? We don't (yet) have best practices or programming idioms doc. Maybe a stand alone doc "Communicating with the script". WOuld be a bit "thin".

from dronekit-python.

tcr3dr avatar tcr3dr commented on July 17, 2024

We can now close this, since a public build of DKPY2 is in the wild.

Recommendation: use sys.argv!

from dronekit-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.