How to get started with python?



  • Hey all,

    I'm new to the hardware side of things. I've been playing around with CoDrone for a bit, it's pretty fun. I'd really like to get started with using python for the CoDrone. I'm looking for any tips on how to get started there. I've read whatever is currently available but none actually talk about how to upload your python code.

    I've set up VSCode, I have python-arduino installed. I've ensured I can upload .ino files successfully.

    Here is my arduino.json:

    {
        "port": "/dev/cu.SLAB_USBtoUART",
        "board": "rokit:avr:SmartInventor-mega32_v2",
        "sketch": "hover/main.py",
        "output": "./output"
    }
    

    When I try to verify the...sketch?, it fails with this error, same when uploading:

    [Starting] Verify sketch - hover/main.py
    Loading configuration...
    Initializing packages...
    Preparing boards...
    Verifying...
    java.io.IOException: No valid code files found
    	at processing.app.Sketch.listSketchFiles(Sketch.java:117)
    	at processing.app.Sketch.<init>(Sketch.java:54)
    	at processing.app.Base.<init>(Base.java:390)
    	at processing.app.Base.main(Base.java:144)
    [Error] Exit with code=1
    

    Any pointers would be awesome!

    Thanks



  • @aimbotd We're still putting together instructions for the Python side of things, which is why there's so little documentation on Python at the moment. It's still a bit early, so the setup can be quite cumbersome.

    I'll tag @robolink_arnold to see if he can help you with the messages you're seeing. If you're feeling ambitious, we can set some time to help you with setup. Otherwise, we should be publishing Python setup instructions in 2 months.

    Let me know if you'd like to set up a video call for a walkthrough of the setup.



  • @robolink_wes Hey! Yea, I was reading that. I'm actually fairly proficient with python but working on hardware is completely new to me. Do you or anyone else know of a resource that guides you to able to upload python code to the Smart Inventor? I feel like I need some sort of pre-processing to happen on the code to make it a valid sketch, or so I've read.

    I've found some literature on it but I don't think it was the right stuff since I still can't verify/upload it.

    Here's the directory tree:

    ├── Pipfile
    ├── Pipfile.lock
    ├── hover
    │   └── main.py
    └── output
    

    The code itself is adopted from the Takeoff-Landing example. Similar to whats found here: https://www.youtube.com/watch?v=FD_Fer9xn7g

    I'm not sure a video call is necessary since I have it working without python code. However, I only bought it because I read that python is a thing.



  • @aimbotd We don't currently support uploading Python to the Smart Inventor, since it's an Arduino board. You'd probably need a translator of some sort to compile Python into Arduino. I think @robolink_arnold would be able to answer your question better. He's out for about a week, but I'll see if I can get someone else on the team to give you an answer. Sorry for the delay!



  • @aimbotd Sorry for catch up late.

    Thank you for your patience. I think you are trying to use the Python Arduino library. We have our own Python library.
    Use python pip install CoDrone and you can download the CoDrone library for Python.

    In that library, we are not using the Arduino board. The YouTube video link you posted also uses the same library. If you need more information for Python library function, you can check out documentation at docs.robolink.com.

    If you have any questions, please don't hesitate to reply this post.


Log in to reply
 

Looks like your connection to Robolink community was lost, please wait while we try to reconnect.