Exec_script freezing


#1

Hi,

I am using exec_script to execute a few scripts at the same time. But it keeps hanging after execution. None of the scripts get executed. HELP PLEASE.
Thanks!


#2

Sorry for the trouble.
Can you please share the code with which you are running the API.
Are you running the builtin demoapp or your own script?
Is the script a python app or cpp app?
What is your FlytOS version?
What is your Companion Computer?
Can you please share your FlytOS runlog, when this happens.


#3

I am writing my own script on FlytSim. I am trying to run three different scripts which are able to run properly when executed individually. I want to run all three scripts together. Finally I want to run them at boot, so I wanted to write one script to be run at boot which would execute it all. So I wrote the following script in python.

#!/usr/bin/env python
import rospy
from flyt_python import api

drone = api.navigation()

drone.exec_script(‘execute_app’, ‘hello’)
drone.exec_script(‘imu_publisher’, ‘hello’)
drone.exec_script(‘imu_subscriber’, ‘hello’)


#4

Here is the runlog file: https://drive.google.com/open?id=1ABIA-XHF6ejBKd4BX498NdV-W6yRoDyg


#5

I presume the filename of scripts are execute_app.py, imu_publisher.py and imu_subscriber.py

If my presumptions are correct, the correct way to execute the scripts should be:

#!/usr/bin/env python
import rospy
from flyt_python import api

drone = api.navigation()

drone.exec_script(‘execute_app.py’, ‘hello’)
drone.exec_script(‘imu_publisher.py’, ‘hello’)
drone.exec_script(‘imu_subscriber.py’, ‘hello’)

Notice, the .py in the exec_script’s first argument.


#6

Hi, thanks for the reply. But after adding the .py, it still doesn’t run, but after waiting a while, it gives this response.

[WARN] [1526367456.142874, 296.014000]: Inbound TCP/IP connection failed: connection from sender terminated before handshake header received. 0 bytes were received. Please check sender for additional details.


#7

Can you please again share the runlog with the edit.
Moreover, I hope you have copied your .py file to -> /flyt/userapps/onboard_user/install/ folder


#8

here is the runlog after the change:
https://drive.google.com/open?id=1lvgby6fa1p0OC5lULWjJNueS3eayhNSO

And yes, all the scripts to be executed are in the /flyt/userapps/onboard_user/install folder. I have tried running each script from the same folder successfully before trying to write this script.


#9

Well the runlog clearly states this error:

File “/flyt/userapps/onboard_user/install/imu_subscriber.py”, line 5, in
from golu_golu.msg import drone_direction
ImportError: No module named golu_golu.msg

File “/flyt/userapps/onboard_user/install/imu_publisher.py”, line 3, in
from golu_golu.msg import drone_direction
ImportError: No module named golu_golu.msg


#10

You can safely ignore this message. This is a ROS generic warning and has nothing to do with your code.

What exactly is your expected behaviour? Since, you are calling the exec_script API, it would internally launch a shell in a new thread and execute your python app over there. Hence, you won’t get to see any outputs from the scripts on your terminal. you can separately write a file logger in your python app, if you wish to log the status.

Moreover, what is your version of FlytSim? If it is less than v1.55, then please upgrade it to latest version.


#11

One of the three scripts being run is supposed to make the drone takeoff, move and then land. Another one is a publisher. The third one is a subscriber which writes the data being subscribed to into a text file.

I tried running each script separately and they all work fine. When I used exec_script to run just one of the three scripts, it froze again.

I am using flytsim v1.57


#12

Did you use exec_script to run the apps separately?
It would be good if you could share any of your scripts.

Moreover, does the error make any sense to you?

File “/flyt/userapps/onboard_user/install/imu_subscriber.py”, line 5, in
from golu_golu.msg import drone_direction
ImportError: No module named golu_golu.msg