mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-23 03:06:34 +00:00
Add support for A8 remote control to opi_rtsp test app
This commit is contained in:
@@ -9,13 +9,13 @@ TARGET = a8
|
|||||||
QMAKE_CXXFLAGS = -O0 -g -ggdb -fsanitize=undefined,address,bounds,float-divide-by-zero,integer-divide-by-zero,null,return,signed-integer-overflow,unreachable,shift,alignment,nonnull-attribute,returns-nonnull-attribute,enum
|
QMAKE_CXXFLAGS = -O0 -g -ggdb -fsanitize=undefined,address,bounds,float-divide-by-zero,integer-divide-by-zero,null,return,signed-integer-overflow,unreachable,shift,alignment,nonnull-attribute,returns-nonnull-attribute,enum
|
||||||
QMAKE_LFLAGS = -O0 -g -ggdb -fsanitize=undefined,address,bounds,float-divide-by-zero,integer-divide-by-zero,null,return,signed-integer-overflow,unreachable,shift,alignment,nonnull-attribute,returns-nonnull-attribute,enum
|
QMAKE_LFLAGS = -O0 -g -ggdb -fsanitize=undefined,address,bounds,float-divide-by-zero,integer-divide-by-zero,null,return,signed-integer-overflow,unreachable,shift,alignment,nonnull-attribute,returns-nonnull-attribute,enum
|
||||||
|
|
||||||
QMAKE_CXX = clang++
|
#QMAKE_CXX = clang++
|
||||||
QMAKE_CC = clang
|
#QMAKE_CC = clang
|
||||||
|
|
||||||
# Not nice, but for some reason QtCreator doesn't use /usr/lib/ccache/g++ from the PATH
|
# Not nice, but for some reason QtCreator doesn't use /usr/lib/ccache/g++ from the PATH
|
||||||
linux-g++ {
|
linux-g++ {
|
||||||
QMAKE_CXX = clang++
|
# QMAKE_CXX = clang++
|
||||||
QMAKE_CC = clang
|
# QMAKE_CC = clang
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void RemoteControl::sendResponse(void)
|
|||||||
QJsonDocument responseDocument(mResponseObject);
|
QJsonDocument responseDocument(mResponseObject);
|
||||||
std::string response = responseDocument.toJson(QJsonDocument::Compact).toStdString();
|
std::string response = responseDocument.toJson(QJsonDocument::Compact).toStdString();
|
||||||
|
|
||||||
qDebug().noquote().nospace() << "Sending responce: " << response;
|
// qDebug().noquote().nospace() << "Sending responce: " << response;
|
||||||
|
|
||||||
write(mFifoFdOut, response.c_str(), response.size());
|
write(mFifoFdOut, response.c_str(), response.size());
|
||||||
mIsBusy = false;
|
mIsBusy = false;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void RemoteControl::sendData(uint16_t top, uint16_t left, uint16_t bottom, uint1
|
|||||||
QJsonDocument commandDocument(commandObject);
|
QJsonDocument commandDocument(commandObject);
|
||||||
std::string command = commandDocument.toJson(QJsonDocument::Compact).toStdString();
|
std::string command = commandDocument.toJson(QJsonDocument::Compact).toStdString();
|
||||||
write(mFifoFdOut, command.c_str(), command.size());
|
write(mFifoFdOut, command.c_str(), command.size());
|
||||||
qDebug().noquote().nospace() << "Sent: " << command;
|
//qDebug().noquote().nospace() << "Sent: " << command;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FIFO_TEST
|
#ifdef FIFO_TEST
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
#include <QDebug>
|
||||||
|
#include <QVector>
|
||||||
#include "aienginegimbalcontrol.h"
|
#include "aienginegimbalcontrol.h"
|
||||||
|
|
||||||
|
|
||||||
AiEngineGimbalControl::AiEngineGimbalControl(QObject *parent)
|
AiEngineGimbalControl::AiEngineGimbalControl(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{}
|
{}
|
||||||
@@ -37,6 +38,10 @@ AiEngineRectangle AiEngineGimbalControl::getGroupCoordinates(QVector<AiEngineObj
|
|||||||
|
|
||||||
void AiEngineGimbalControl::inferenceResultSlot(AiEngineInferenceResult result)
|
void AiEngineGimbalControl::inferenceResultSlot(AiEngineInferenceResult result)
|
||||||
{
|
{
|
||||||
|
if (result.objects.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// We got list of all recognized objects, but at least for now we will zoom to all objects at
|
// We got list of all recognized objects, but at least for now we will zoom to all objects at
|
||||||
// once and not for each invidually. Got minimal coordinates which contains the all objects.
|
// once and not for each invidually. Got minimal coordinates which contains the all objects.
|
||||||
AiEngineRectangle groupRect = getGroupCoordinates(result.objects);
|
AiEngineRectangle groupRect = getGroupCoordinates(result.objects);
|
||||||
@@ -46,4 +51,20 @@ void AiEngineGimbalControl::inferenceResultSlot(AiEngineInferenceResult result)
|
|||||||
groupRect.left *= 2;
|
groupRect.left *= 2;
|
||||||
groupRect.bottom *= 2;
|
groupRect.bottom *= 2;
|
||||||
groupRect.right *= 2;
|
groupRect.right *= 2;
|
||||||
|
|
||||||
|
if (groupRect.top > 720 || groupRect.bottom > 720) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupRect.left > 1280 || groupRect.right > 1280) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((groupRect.bottom <= groupRect.top) || (groupRect.right <= groupRect.left)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "TUOMAS!! Zooming to square" << groupRect.top << "x" << groupRect.left << "and" << groupRect.bottom << "x" << groupRect.right;
|
||||||
|
|
||||||
|
mRemoteControl.sendData(groupRect.top, groupRect.left, groupRect.left, groupRect.right);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include "aiengineinference.h"
|
#include "aiengineinference.h"
|
||||||
|
#include "remoteControl.hpp"
|
||||||
|
|
||||||
class AiEngineGimbalControl : public QObject
|
class AiEngineGimbalControl : public QObject
|
||||||
{
|
{
|
||||||
@@ -12,6 +13,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
AiEngineRectangle getGroupCoordinates(QVector<AiEngineObject> &objects);
|
AiEngineRectangle getGroupCoordinates(QVector<AiEngineObject> &objects);
|
||||||
|
RemoteControl mRemoteControl;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void inferenceResultSlot(AiEngineInferenceResult results);
|
void inferenceResultSlot(AiEngineInferenceResult results);
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ HEADERS = $$PWD/*.h
|
|||||||
opi5 {
|
opi5 {
|
||||||
message("OPI5 build")
|
message("OPI5 build")
|
||||||
PKGCONFIG += opencv4 librga stb libturbojpeg
|
PKGCONFIG += opencv4 librga stb libturbojpeg
|
||||||
INCLUDEPATH += /usr/include/rga # not correct in pkg-config file
|
INCLUDEPATH += /usr/include/rga $$PWD/../../misc/camera/a8_remote
|
||||||
QMAKE_CXXFLAGS += -DOPI5_BUILD
|
QMAKE_CXXFLAGS += -DOPI5_BUILD
|
||||||
LIBS += /usr/local/lib/librknnrt.so
|
LIBS += /usr/local/lib/librknnrt.so
|
||||||
SOURCES += $$PWD/src-opi5/*.c $$PWD/src-opi5/*.cpp $$PWD/src-opi5/*.cc
|
SOURCES += $$PWD/src-opi5/*.c $$PWD/src-opi5/*.cpp $$PWD/src-opi5/*.cc $$PWD/../../misc/camera/a8_remote/remoteControl.cpp
|
||||||
HEADERS += $$PWD/src-opi5/*.h
|
HEADERS += $$PWD/src-opi5/*.h
|
||||||
} else {
|
} else {
|
||||||
message("ONNX build")
|
message("ONNX build")
|
||||||
|
|||||||
Reference in New Issue
Block a user