The go-djiedge package provides Go language bindings for the dji-edge-sdk.
The package supports all functions included in dji-edge-sdk and provides a more friendly API usage.
For more specific functions, please visit DJI Edge-SDK document: https://developer.dji.com/doc/edge-sdk-tutorial/en/
The package only run on Linux systems, it is recommended to use Ubuntu 22.04.1 LTS
- stdc++ >=11 (recommend c++14 or higher)
- openssl >=1.1.1f
- libssh2 >=1.10.0 ,install by command
sudo apt-get install libssh2-1-dev
For more software requirements, please visit DJI-Edge-SDK Document: environment-prepare
Run the command in the project console for Install the go-djiedge package:
go get github.com/lynnplus/go-djiedge
The package does not include the header files and precompiled static libraries of DJI Edge-SDK. you need to download the SDK manually.
git clone https://github.com/dji-sdk/Edge-SDK.git
By default, the package only following cgo compilation instructions are provided, so you need to manually configure the cgo system environment variables
default_build.go
#cgo LDFLAGS: -ledgesdk -lcrypto -lssh2
CGO compilation instructions can be temporarily configured in the console.
For example:
export CGO_CXXFLAGS="-std=c++14 -I{your Edge-SDK path}/include"
export CGO_LDFLAGS="-L{your Edge-SDK path}/lib/{x86_64 or aarch64}"
If you need to customize the build, such as using different compilation instructions, or the name of libedgesdk.a
changes,
this behavior can be disabled by supplying -tags custom_edge_env
when building/running your application.
when building with this tag you will need to supply the complete CGO environment variables yourself.
For example:
export CGO_CXXFLAGS="-std=c++14 -I{your Edge-SDK path}/include"
export CGO_LDFLAGS="-L{your Edge-SDK path}/lib/{x86_64 or aarch64} -ledgesdk -lcrypto -lssh2"
It is very inconvenient to debug real Dji-Edge devices, and Edge-SDK only supports linux (arch:x86_64/aarch64) operating
system.
the package provides a simple simulation implementation,
supports SDK initialization and pushing real-time camera streams,
currently only supports read h264 file[edge_stream.h264].
Construction constraints that currently enable the simulation function //go:build !linux || fake_edge
The implementation file is in edge_simulation.go,can add -tags fake_edge
to open it when
building.
Step Tips:
- Add
fake_edge
build constraints, build executable file
go build -tags fake_edge
- Convert mp4 file to h264 format file
sudo apt-get install ffmpeg ffmpeg -i test.mp4 -codec copy -bsf: h264_mp4toannexb -f h264 edge_stream.h264
- Copy the generated edge_stream.h264 to the same level directory as the executable file
- Run