n0rmanUK
Posts: 12
Joined: Wed Apr 20, 2016 10:31 pm

Pixhawk, Raspberry PI and SIMULINK model

Mon May 02, 2016 12:06 pm

Hi,

Well, I wanna establish a connection between raspberry pi and pixhawk and then automate it, so that I can deploy a Simulink model that will constantly use pixhawk's variables.

Shall I install mavlink and mavconn to use C++ code to access the variables? I then hope for a SIMULINK model to use the data extracted by C++ .

I did research the topic and I am having a trouble with all this.

Any tips, please?

Many thanks!

n0rmanUK
Posts: 12
Joined: Wed Apr 20, 2016 10:31 pm

Re: Pixhawk, Raspberry PI and SIMULINK model

Tue May 03, 2016 7:12 am

Aren't there any people who have done or heard of something similar and could advise?

This is part of my university project. I really need help.


n0rmanUK
Posts: 12
Joined: Wed Apr 20, 2016 10:31 pm

Re: Pixhawk, Raspberry PI and SIMULINK model

Tue May 03, 2016 6:09 pm

mthomason wrote:Is http://ardupilot.org/dev/docs/raspberry ... vlink.html of any use to you?
Thanks, but that doesn't work, because of some DroneApp changes or something.

Anyway I cannot get Python to work at all for whatever reason. I tried about 12 times strictly following the steps.

That is why I am on this forum, because I need help, not because I am lazy.

Any other suggestions? I will really appreciate any thoughts.

User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Pixhawk, Raspberry PI and SIMULINK model

Tue May 03, 2016 8:57 pm

n0rmanUK wrote: This is part of my university project. I really need help.
Isn't that the job of your tutor/professor? Isn't that what he/she is paid for?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

n0rmanUK
Posts: 12
Joined: Wed Apr 20, 2016 10:31 pm

Re: Pixhawk, Raspberry PI and SIMULINK model

Wed May 04, 2016 11:48 pm

DougieLawson wrote:
n0rmanUK wrote: This is part of my university project. I really need help.
Isn't that the job of your tutor/professor? Isn't that what he/she is paid for?
Well, Is it my Professor's job to do my work for me? The answer is no.
I get your point, but it is my degree. Not his. It is a UK challenge for an autonomous quadcopter design. Our university doesn't specialise in Raspberry PIs etc. I have chosen it as a communicating device, because of its simplicity, which gives me pain for the last month.

Getting to the meritum. I got a python script to communicate with the Pixhawk. However, it takes 20 seconds to run. I thought it could be instantaneous. Especially, that I set to start the connection with the Pixhawk at the start-up of the Raspberry PI. My script uses connect command. And it takes a while.

Is there a way around it? Maybe you, DougieLawson know. You seem very experienced.

Thank you!

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Pixhawk, Raspberry PI and SIMULINK model

Thu May 05, 2016 8:25 am

You would've gotten more help if you've said no Mathworks
tools are involved. Most people here neither have access
nor seem to be interested in supporting non-libre
"programming languages".

Alas , i guess it's too late now to rewrite those
parts of your project in C/C++/FORTRAN/Pascal ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

n0rmanUK
Posts: 12
Joined: Wed Apr 20, 2016 10:31 pm

Re: Pixhawk, Raspberry PI and SIMULINK model

Thu May 05, 2016 11:25 am

ghans wrote:You would've gotten more help if you've said no Mathworks
tools are involved. Most people here neither have access
nor seem to be interested in supporting non-libre
"programming languages".

Alas , i guess it's too late now to rewrite those
parts of your project in C/C++/FORTRAN/Pascal ?

ghans
Well we can ignore Mathworks tools for now. I just want to extract the values in a quick way. Let's assume I am saving the values to a text file that SIMULINK will access. Whatever. I just need to make this connection to work at a relatively fast pace.

It takes ages with the Ethernet port connected to the laptop for some reason.
It sends a lot of 'Waiting for the heartbeat' commands when running python in the SSH Linux window.
As I said I am using the connect command to connect to the pixhak. Any help?

n0rmanUK
Posts: 12
Joined: Wed Apr 20, 2016 10:31 pm

Re: Pixhawk, Raspberry PI and SIMULINK model

Thu May 05, 2016 7:36 pm

ghans wrote:You would've gotten more help if you've said no Mathworks
tools are involved. Most people here neither have access
nor seem to be interested in supporting non-libre
"programming languages".

Alas , i guess it's too late now to rewrite those
parts of your project in C/C++/FORTRAN/Pascal ?

ghans
Today morning I said Mathworks tool can be ignored and no one has replied yet. Literally any help will be good. I cannot make a python code to be quicker or stable to connect via MAvlink.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Pixhawk, Raspberry PI and SIMULINK model

Fri May 06, 2016 5:58 am

Did you try building and running this ?

https://github.com/mavlink/c_uart_interface_example


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

n0rmanUK
Posts: 12
Joined: Wed Apr 20, 2016 10:31 pm

Re: Pixhawk, Raspberry PI and SIMULINK model

Fri May 06, 2016 1:16 pm

ghans wrote:Did you try building and running this ?

https://github.com/mavlink/c_uart_interface_example


ghans
That is interesting. I will try that. Many thanks for your help.
I also have seen some MAVCONN method for low latency C++ connection. I will also try that and report back.

I have tried the instructions that mthomason posted. I need to open 'sudo -s' and run:

Code: Select all

mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter

Then, I have to return to Linux command to run

Code: Select all

 python Param.py
to run my code. Then, it connects. My python code takes 20 seconds to connect obtain and override a parameter designated by me. I think this is too long for a simple operation.

fernandofilhols
Posts: 1
Joined: Wed May 31, 2017 3:09 pm

Re: Pixhawk, Raspberry PI and SIMULINK model

Wed May 31, 2017 3:14 pm

Hi Norman,

I am in a project in which I also need to have communication between Pixhawk and Raspberry Pi using Simulink Models. Did you have success in this task? Thanks in advance.
Fernando.

Return to “Automation, sensing and robotics”