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

FlyNetSim.py #2

Open
Tedz10F opened this issue Feb 29, 2020 · 20 comments
Open

FlyNetSim.py #2

Tedz10F opened this issue Feb 29, 2020 · 20 comments

Comments

@Tedz10F
Copy link

Tedz10F commented Feb 29, 2020

Hello,

Firstly thank you for all of the detailed instructions, I'm currently undertaking an Undergraduate dissertation to do with evolutionary drone positioning, and read your thesis and might use the simulator to run some of my tests.

Just something that might be worth noting,

  • FlyNetSim.py was located in FlySim, rather than FlyNetSim
  • FlyNetSim.py when ran couldn't find the bundled NS3 installation, there was one to many ../ on line 77. sorted it by doing home_path = os.path.abspath('../../') rather than '../../..' .

Not complaining, thought I'd let you know. Kudos for the work put into this

-Toby

@saburhb
Copy link
Owner

saburhb commented Feb 29, 2020

Thanks Toby for pointing out the mistakes. I will correct those in the code and instructions. Apart from the syntactical issues, some other functional issues may arise as some people tried out different cases. I have a plan to release an improved version of it. However, it may take a while, as I moved to other projects and have to manage time to work on it.
Thanks,
Sabur

@Tedz10F
Copy link
Author

Tedz10F commented Feb 29, 2020 via email

@alicesquivel
Copy link

Hi guys,
Totally agree with Tedz10F. Thank you saburhb for sharing your project and for all the details you provided!! I really appreciate it!!

I've been trying to make the simulator work as well. However, I faced the same issues, and I think, the simulator is not communicating with ns-3.
This screenshot is so far where I started to have issues. I'm exploring the code and I will go further to see if I can fix things. Any advice or comments are more than welcome as well!
Screen Shot 2020-03-02 at 11 15 51 AM

Thank you,
Alicia

@saburhb
Copy link
Owner

saburhb commented Mar 2, 2020

@Tedz10F, @alicesquivel , could you please run "FlyNetSim_direct_no_ns3.py" that directly connects GCS and UAV bypassing ns-3. If that works fine, you can confirm that problem could be from ns-3. Also while running, do run with "-v 3" to print with verbose mode.

@alicesquivel, your log doesn't look like ns-3 problem, as it shows "CONTROL: sending" and "CONTROL: message received". That means the first command from GCS goes through the ns-3 and reaches the UAV. However, at the UAV, it shows the error in Mavlink connection which is the connection of Ardupilot and the simulated vehicle. You probably need to debug your Ardupilot simulator separately. You can read more about that here : https://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html.

@alicesquivel
Copy link

Hi @saburhb,

Thanks for following up!
If I run the simulator with ---> python FlyNetSim.py I don't get any errors. But the ARM bottom doesn't work.
image

I got this error when I run ---> python FlyNetSim_direct_no_ns3.py -v 3
image

I will try debugging my Ardupilot simulator separately and then come back here! Thanks again!

Alicia

@Tedz10F
Copy link
Author

Tedz10F commented Mar 3, 2020

Hello @saburhb @alicesquivel ,

I did test the FlyNetSim_direct_no_ns3.py with the following results:
image
It does appear to be working without NS3, although the box in the top right corner remains blank.
and with -v 3 it doesn't want to arm
image

Do you have any suggestions to integrate NS3? I am happy to manually install/configure it if you are able to let us know what NS builds/modules you used.

Again, thank you for your time with this!

Best Regards,
Toby

@alicesquivel
Copy link

Hi guys,

Thanks for your recommendations @saburhb, they were more than useful!

I'm in the same step with you @Tedz10F
image

Looking forward to your suggestions @saburhb And thanks for your time and for following up on this with us!
Really appreciate it.

Best,
Alicia

@saburhb
Copy link
Owner

saburhb commented Mar 4, 2020

@Tedz10F, @alicesquivel,

Since the FlyNetSim_direct_no_ns3.py works fine and the code FlyNetSim.py is failing, the problem should be indeed from ns-3. I would suggest you to try two things:

  1. Try to run only the ns-3 alone. It would need the config.xml in its home folder (ns-3.27/) though.
    Check if any runtime error happens. The successful execution should connect to the ports and wait for messages from GCS.
  2. If the previous step works fine, redirect the console output of ns-3 in a log file while running along with FlySim part.
    In the file FlyNetSim.py wherever " waf --run" is called, you redirect the output to a file and then run the FlyNetSim.py . When it crashes, check the log file and show the log if there are errors.

@alicesquivel
Copy link

Hi @Tedz10F,
Before trying your last comment, I found out, there is another error, it happened really quickly, that I needed to record a video and then screenshot it. This happens when running FlyNetSim.py. I was comparing the experiment with the screenshots in the paper. Just after this error happens, the Network Simulator terminal closes.

image

I got this error, in the Network Simulator:
image

What do you think it is? An ns-3 problem?
image

Thanks for all your comments and help! :D
Alicia

@saburhb
Copy link
Owner

saburhb commented Mar 24, 2020

@alicesquivel .. The "address already in use" error comes from the port number which is still active by some other process. It could be caused by running the FlyNetSim multiple times and if the last process did not close the sockets gracefully; Or the port number is used by some other process in the same machine. The probability of the first reason is high.
I would suggest two things : (i) If restarting your machine is feasible, do restart and run the code. You should not see that specific error,
Or, (ii) Change the port numbers in the code. Note that the port numbers need to be changed in both FlySim and NetSim component as per the diagram shown in the github.

@alicesquivel
Copy link

Hey @saburhb,
Yes, that was an issue!!! Thankss for helped me to figure it out! However, I tried your previous comment and I got this error when running ns-3 alone.

image

And I think, its this error:
image

I looked for that to comment it out, but I didn't find it.

Thanks for all your help!!
Alicia

@alicesquivel
Copy link

I think I found the file in the czmq folder. I commented out the #include <syslog.h> line, but I'm still getting the same issue. Is there a specific czmq version I need to use? I have this folder in the home folder (ns-3.27/).

I followed this for the installation:
http://czmq.zeromq.org/manual:czmq

Any comments or suggestions are more than welcome!! :))))

Thanks!!!
A

@saburhb
Copy link
Owner

saburhb commented Apr 5, 2020

@alicesquivel
There should be a file : "/usr/include/czmq_prelude.h" and you should comment the line with "#include <syslog.h>" in that file.

@alicesquivel
Copy link

Great!!!
It's beautifully working!!! Thanks @saburhb!!! for all your help!!

image

I will run some experiments and try to integrate a map UI. I will let you know about my experiments!
Thanks for all your help, comments, and suggestions!
Alicia

@durgesh2020
Copy link

Hello @saburhb
Thank you for the FlyNetSim. I am sorry to ask you this very basic question. Whenever I try to install below:
sudo apt-get install libzmq5 libzmq-dev libczmq4 libczmq-dev czmq libxml2 libxml2-dev

I get error like no candidate for czmq and libczmq4. I tried to add other repositories but no luck. Can you please tell me how to resolve this?
Thank you once again and I wish a healthy and safe environment for you and your family in this pandemic.

@saburhb
Copy link
Owner

saburhb commented May 10, 2020

@durgesh2020
You can search the appropriate versions of the libraries available in the default apt sources. You can execute the following command to check the versions of czm,q libczmq and libczmq-dev and then install the latest versions:
sudo apt-cache search czmq

@durgesh2020
Copy link

@durgesh2020
You can search the appropriate versions of the libraries available in the default apt sources. You can execute the following command to check the versions of czm,q libczmq and libczmq-dev and then install the latest versions:
sudo apt-cache search czmq

Thank you so much for reply. Is it necessary to load both version 3 and 4 of czmq?

@saburhb
Copy link
Owner

saburhb commented May 11, 2020

@durgesh2020
Try installing latest version only. In case the functions used in the code is deprecated in the latest version, you may try older version.

@Eric-AI20
Copy link

I think I found the file in the czmq folder. I commented out the #include <syslog.h> line, but I'm still getting the same issue. Is there a specific czmq version I need to use? I have this folder in the home folder (ns-3.27/).

I followed this for the installation:
http://czmq.zeromq.org/manual:czmq

Any comments or suggestions are more than welcome!! :))))

Thanks!!!
A

Hi @alicesquivel @saburhb ,
Thanks for sharing your experience, now I am facing the same issue, I commented the line with "#include <syslog.h>" in that file however the problem still unsolved. Can you give me some advice to fix it?
Much appreciate!
Eric.
czmq_issue01
czmq_issues02

@a4ashwin
Copy link

a4ashwin commented Apr 6, 2021

Hey @saburhb,
Yes, that was an issue!!! Thankss for helped me to figure it out! However, I tried your previous comment and I got this error when running ns-3 alone.

image

And I think, its this error:
image

I looked for that to comment it out, but I didn't find it.

Thanks for all your help!!
Alicia

Hi @alicesquivel @saburhb ,
I am still facing this issue after commenting the "#include <syslog.h>" in "/usr/include/czmq_prelude.h".
How did you resolve it?

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

No branches or pull requests

6 participants