Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"play_tune" example and "drone_delivery" example not works well. #1167

Open
ghost opened this issue Sep 25, 2022 · 2 comments
Open

"play_tune" example and "drone_delivery" example not works well. #1167

ghost opened this issue Sep 25, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 25, 2022

Hello, I want to report some problem on example code contained in dronekit package.

[1] play_tune example :
it does not act well with stock pixhawk cube.
if there should be change in parameter, there should be instruction about that.

"Full documentation is provided at http://python.dronekit.io/examples/play_tune.html" <- this is comment on example code
but the web site address is wrong. in current web site of dronekit, I couldn't find "play_tune" document on the example list.

I felt the project was unmanaged by this.

with regard to beginner, it is easy to test the code by LED or buzzer indoors.

most dronekit code runs well on outdoors, so if we test the code indoors LED and buzzer will be the only way to test easily

reference link :
https://github.com/dronekit/dronekit-python/blob/master/examples/play_tune/play_tune.py
https://dronekit-python.readthedocs.io/en/latest/examples/running_examples.html

[2] drone_delivery example :
this example is also not works
because this page does not allow me to upload the photo, I will explain by text.
mapbox map is not pops up , and if I open map image in new tab, I can see the error message like this :

{"message":"Classic styles are no longer supported; see https://blog.mapbox.com/deprecating-studio-classic-styles-d8892ac38cb4 for more information"}

I guess some updates should be performed to example code.

and there is no instruction of creating mapbox id and token.

whether changing mapbox id or not is very confusing for the beginner.

beginner doesn't know what mapbox is.

@ghost
Copy link
Author

ghost commented Sep 28, 2022

I read the cheerypy docs and re-writing example code.

@ghost
Copy link
Author

ghost commented Sep 28, 2022

below code can add marker on static map,
but seems not add marker dynamically. and it collides with pyqt5 thread.

:

import cherrypy

class Root(object):
    @cherrypy.expose
    def index(self):
        center_x = "35.7933"
        center_y = "128.5562"

        marker_x_1 = "35.7933"
        marker_y_1 = "128.5562"

        marker_x_2 = "35.7933"
        marker_y_2 = "128.5562"

        marker_degree_1 = "45"
        marker_degree_2 = "100"

        marker_name_1 = "drone"
        marker_name_2 = "ship"

        zoom = "20"

        style_street = "mapbox://styles/mapbox/streets-v11"
        style_satellite = "mapbox://styles/mapbox/satellite-v9"
        style_light = "mapbox://styles/mapbox/light-v10"

        html = """
        <html>
        <head>
        <meta charset="utf-8">
        <title>Drone Map</title>
        <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
        <link href="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.css" rel="stylesheet">
        <script src="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.js"></script>
        <style>
        body { margin: 0; padding: 0; }
        #map { position: absolute; top: 0; bottom: 0; width: 100%%; }
        </style>
        </head>
        <body>
        <div id="map"></div>

        <script>
            mapboxgl.accessToken = '123456678';
            const map = new mapboxgl.Map({
            container: 'map', // container ID
            // Choose from Mapbox's core styles, or make your own style with Mapbox Studio
            style: '%s', // style URL
            center: [%s, %s], // starting position [lng, lat]
            zoom: %s // starting zoom
            });

            // Create a default marker, colored black, rotated 45 degrees
            const marker1 = new mapboxgl.Marker({ color: 'black', rotation : %s }).setLngLat([%s, %s]).setPopup(new mapboxgl.Popup().setHTML("<h1>%s</h1>")).addTo(map);
            const marker2 = new mapboxgl.Marker({ color: 'blue', rotation : %s }).setLngLat([%s, %s]).setPopup(new mapboxgl.Popup().setHTML("<h1>%s</h1>")).addTo(map);
       
            marker1.togglePopup();
            marker2.togglePopup();
        </script>
        </body>
        </html>""" % (
        style_satellite, center_y, center_x, zoom,
        marker_degree_1, marker_y_1, marker_x_1, marker_name_1,
        marker_degree_2, marker_y_2, marker_x_2, marker_name_2)
        return html


if __name__ == '__main__':
    cherrypy.quickstart(Root(), '/')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants