This project contains the project data to connect a Parrot Mambo drone with kyma using an Linux host, SAP CP API Management and SAP Cloud Connector.
- Drone: Parrot Mambo
- Linux Host (or VM)
- BLE Dongle (on OSX it is not possible to use the host Bluetooth. A dedicated hardware dongle is required)
go build -o server cmd/kyma-drone-server-v2/main.go
go build -o connector cmd/kyma-connector/kyma-connector.go
Detailes Setup Instructions in the Hybris Wiki
The Project contains of two commands. The server and the Registration cli. During the setup, the server can run in TEST mode.
Run server in test mode:
sudo TEST_API=true KYMA_CONFIG=./config ./server --port 8080 --host 0.0.0.0
The server is running on port 8080
. The server is exposed via SAP CP API Management. To setup the connection, the server needs to be available From Cloud to OnPremise
via SAP Cloud Connector.
- Setup Cloud Connector (use
drone
as virtual host name) - Attach service to API Management (use drone as system name)
- Import API's (see
api-management
folder) - Bundle API's as a product and subscribe via developer portal
Int he next step, the api and events needs to be connected to the Kyma Application connector.
Establish Connection (exchange certificates). This is generating new certificates and stores the connection metadata as well as the certificates in the config
folder:
./connector connect -u <APPLICATION CONNECT URL>
The Open API Defenition and Event definition is part of the project. It needs to be registered in the Application Connector:
./connector register -a api-docs.json -e event-docs.json
This is registering a new service on kyma side. The compiled service definition is stored in the config folder using the service UUID (<UUID>.json). To inject the connection details (API Gateway URL, Credentials etc.) adjust the <UUID>.json file in the config
folder by adding the required fields and update the service.
./connector update -i <UUID>
To run the server in production mode connect the BLE Dongle with the VM (in VMWare it is required to disable the "Share Bluetooth connection with VM option"). Start the server in none test mode referencing the drone bluethooth name and config directory.
sudo KYMA_DRONE="Mambo_12345" KYMA_CONFIG=./config ./server --port 8080 --host 0.0.0.0
fly.js
: Simple Lambda functions which is starting the drone and landing it after a few seconds if called.
takeoff.js
: Simple Lambda function to notify slack on takeoff. Subscribe to drone.takeOff
event.
shippackage.js
: Is shipping a package including the OrderID. Subscribe to order.created
event from commerce.
setcompletedstate.js
: Is setting the order completed date in commerce as soon as the drone is reporting the package as shipped. Subscribe to drone.shipped
event.
- Drone is not connecting:
The server is using the gobot library to connect the drone. A good startingpoint for debuging is the example program documented on the gobot webside: https://gobot.io/documentation/platforms/minidrone/