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

Initial commit for Botui QT5 and Tello Support #73

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

EugeneDMyers
Copy link

This commit is the initial commit incorporating Tello support
into Botui. Tello support is a work-in-progress. With these
patches to Botui along with the Tello support patches for
libwallaby, one should be able to (1) start a Tello, (2) command
that Tello start transmitting video, (3) then go the video page
and see video output from the Tello.

QT5 Support

An artifact of adding Tello support is that Botui now uses QT5.
This seems to perform quite well.

Issues:

(1) Need to integrate the code that finds and commands the Tello
to start sending video into Botui.

(2) Several graphics such as sensor output, etc. do not appear.
Fixing these should be no problem for a QT expert.

(3) The Qt4->Qt5 conversion was done by hand w/o the Qt tools, so
there may be a couple of data structures that the Author did not
get quite right.

(4) This is not an all-inclusive list of issues, but we now have
a working example of Botui using Qt5.

Signed-off-by: Eugene Myers cedarhouse@comcast.net

This commit is the initial commit incorporating Tello support
into Botui. Tello support is a work-in-progress.  With these
patches to Botui along with the Tello support patches for
libwallaby, one should be able to (1) start a Tello, (2) command
that Tello start transmitting video, (3) then go the video page
and see video output from the Tello.

QT5 Support

An artifact of adding Tello support is that Botui now uses QT5.
This seems to perform quite well.

Issues:

(1) Need to integrate the code that finds and commands the Tello
to start sending video into Botui.

(2) Several graphics such as sensor output, etc. do not appear.
Fixing these should be no problem for a QT expert.

(3) The Qt4->Qt5 conversion was done by hand w/o the Qt tools, so
there may be a couple of data structures that the Author did not
get quite right.

(4) This is not an all-inclusive list of issues, but we now have
a working example of Botui using Qt5.

Signed-off-by: Eugene Myers <cedarhouse@comcast.net>
Copy link
Member

@bmcdorman bmcdorman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Have a note about printf use, but everything else looks great. Thanks for putting this together!

@@ -87,6 +91,9 @@ void CvWidget::scaleImage()

cv::Mat resized;
cv::resize(m_image, resized, cv::Size(width(), height()));
::printf("CvWidget::scaleImage - width() %d height() %d\n", width(), height());fflush(NULL);
::printf("CvWidget::scaleImage - m_image.rows %d cols %d resized.rows %d cols %d\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put these behind a DEBUG #ifdef or remove them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And switching them to C++ style cout or qDebug() messages would also be great.

@Zacharyprime
Copy link
Member

This gives the same result as Braden and I's attempts at updating to Qt5.
It gives a segmentation fault when trying to launch.

It happens before any of the main program is even started (the seg fault exits before my print statement at the beginning of main).
The fact that the CPU is returning SIGILL makes me think that some dependency was installed for the wrong architecture.

The stack error is the same as both of the previous attempts as well. It's almost certainly a dependency that was installed way back in development that does not play well with Qt5. I'm gonna try a few more things and hopefully try building all the software from a fresh image so I know all the dependencies are good and see if that will fix it.

This is why I don't like the idea of just propagating the same OS image and snowballing bugs/errors/issues.
I'd like BOS-Hydrogen to be a clean slate that has clear build-from-scratch instructions.

Here is the gdb output:
(gdb) run
Starting program: /usr/local/bin/botui
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x6fbcc270 (LWP 1403)]
Cannot access memory at address 0x0

Program received signal SIGILL, Illegal instruction.
Cannot access memory at address 0x0
0x7685be08 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0

(gdb) backtrace
#0 0x7685be08 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
#1 0x768584d4 in OPENSSL_cpuid_setup ()
from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
#2 0x76fdf608 in call_init (l=, argc=1, argv=0x7efff774,
env=0x7efff77c) at dl-init.c:78
#3 0x76fdf6e4 in _dl_init (main_map=0x76fff968, argc=1, argv=0x7efff774,
env=0x7efff77c) at dl-init.c:126
#4 0x76fcfce4 in _dl_start_user () from /lib/ld-linux-armhf.so.3
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

@EugeneDMyers
Copy link
Author

I ran into exactly this problem when I put this together. Give me a couple of days, because there is something there that I was able to take out the resolved this issue.

I did have to beat this thing into submission to get everything to work... the onus is on me to let you know which stick I used.

Also, the illegal instruction issue is a problem with gdb interacting with the nuances of libcrypto.

Try doing a continue when you see this. Hopefully, you will get to the real problem.

@EugeneDMyers
Copy link
Author

to get past gdb/ssl do this:

Program received signal SIGILL /lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
You can tell gdb to not stop on signals.

(gdb) handle SIGILL nostop noprint

will allow your program to continue, gdb will just tell you that the signal was received.

@Zacharyprime
Copy link
Member

I rebuilt OpenSSL from source using the following steps.
It built and allowed me to start the program without doing any gdb trickery.
I still need to test it some more but that seems to have solved the segfault.

If you follow this, it would probably be better to use version 1.1.1k and not 1.0.2o

#Mumbo Jumbo
sudo apt update
sudo apt install checkinstall zlib1g-dev -y

#Extract
cd /usr/local/src/
wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
tar -xf openssl-1.0.2o.tar.gz
cd /usr/local/src/openssl-1.0.2o

#Build
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
make
make test
sudo make install

cd /etc/ld.so.conf.d/
echo "/usr/local/ssl/lib"  > openssl-1.0.2o.conf  

#Reload Dynamic Libraries (output should have libcrypto and libssl at 1.0.0 under /usr/local/ssl/lib)
sudo ldconfig -v

#Make some backups
mv /usr/bin/c_rehash /usr/bin/c_rehash.BEKUP
mv /usr/bin/openssl /usr/bin/openssl.BEKUP

#Setup env
vim /etc/environment

Paste This: 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/ssl/bin"

source /etc/environment

#Check install
echo $PATH
which openssl
openssl version -a

@Zacharyprime
Copy link
Member

After testing the UI the things that don't work are:

  • The Sensor Graph (black background, laggy, buggy screen, crashes sometimes)
  • Camera View (takes up more than the entire screen, black background, laggy)
  • Channel->Edit->Configure (black background, laggy, items glitch out, super buggy crashes botui)

@EugeneDMyers
Copy link
Author

Good to see that you got it working. The (similar) problem I had when it crashed at that stage was that the qt4 and qt5 libraries got mixed and some shared libraries did not linked.

I will test the camera view with a USB camera this weekend to see how it goes. I do need to fix the viewing size and there is a wierd bug in it that I have to resolve.

Note: this has only been tested with the Tello camera. To get that all to work I needed to (1) update ffmpeg (needed the hardware codecs to support Tello), (2) update openCV (because the new ffmpeg did not play well with the loaded openCV), (3) the camera functions in libwallaby have been updated as well. I'm working to get this out as well.

I'm thinking of using the ardrone widgets as a model to allow to switching between the USB camera and the Tello as well.

@Zacharyprime Zacharyprime linked an issue Jun 7, 2021 that may be closed by this pull request
@Zacharyprime Zacharyprime mentioned this pull request Jun 7, 2021
@Zacharyprime Zacharyprime changed the base branch from master to qt5-support June 7, 2021 14:28
@Zacharyprime Zacharyprime changed the base branch from bradenQt5Upgrade to qt5-support-main June 7, 2021 14:29
@Zacharyprime Zacharyprime merged commit 07306a8 into kipr:qt5-support-main Jun 7, 2021
@Zacharyprime Zacharyprime mentioned this pull request Jun 7, 2021
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

Successfully merging this pull request may close these issues.

Update to Modern Qt
4 participants