Quantcast

MAVlink for Aerocore2 and DuoVero

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MAVlink for Aerocore2 and DuoVero

jmcwil
Hi,

I am new to gumstix and still trying to fully understand how all of this works.  I am having trouble figuring out how to send commands from the DuoVero to control the Aerocore 2 and accomplish a task such as moving a servo.   I have been making progress using the c_uart_interface_example, and I am able to send IMU data to the DuoVero. I understand that I need to write a mavlink message for the DuoVero to send, and then I need to write a way for the Aerocore 2 to handle the message, but I am unsure of the proper way to accomplish this. I would really appreciate clarification on a few questions so that I can narrow down what I am doing wrong.  Also, if there is another example that will help, please let me know.

1) Is it necessary to use QGroundControl to send and receive mavlink messages between the Aerocore 2 and DuoVero, or can this all be accomplished through serial connections in the command line?

2) What commands are needed for the Aerocore 2 to receive mavlink messages from the DuoVero?  Can I use stream for that?

3) How do I send a mavlink message from the DuoVero?

Thanks in advance,
Jess
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

glen@jetsoftdev.com
I am also interested in this. It's hard to find answers to basic questions to the Duovero/AeroCore Connection but we know people are using it.

There may even be documentation somewhere.

To get IMU data to the Duovero did you have to do anything else than use the example?

Glen

> On Jun 10, 2016, at 11:04 AM, jmcwil <[hidden email]> wrote:
>
> Hi,
>
> I am new to gumstix and still trying to fully understand how all of this
> works.  I am having trouble figuring out how to send commands from the
> DuoVero to control the Aerocore 2 and accomplish a task such as moving a
> servo.   I have been making progress using the c_uart_interface_example, and
> I am able to send IMU data to the DuoVero. I understand that I need to write
> a mavlink message for the DuoVero to send, and then I need to write a way
> for the Aerocore 2 to handle the message, but I am unsure of the proper way
> to accomplish this. I would really appreciate clarification on a few
> questions so that I can narrow down what I am doing wrong.  Also, if there
> is another example that will help, please let me know.
>
> 1) Is it necessary to use QGroundControl to send and receive mavlink
> messages between the Aerocore 2 and DuoVero, or can this all be accomplished
> through serial connections in the command line?
>
> 2) What commands are needed for the Aerocore 2 to receive mavlink messages
> from the DuoVero?  Can I use stream for that?
>
> 3) How do I send a mavlink message from the DuoVero?
>
> Thanks in advance,
> Jess
>
>
>
>
> --
> View this message in context: http://gumstix.8.x6.nabble.com/MAVlink-for-Aerocore2-and-DuoVero-tp4970935.html
> Sent from the Gumstix mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> gumstix-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gumstix-users

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
gumstix-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gumstix-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

Andrew C. Smith
In reply to this post by jmcwil
Hi Jess,

The easiest way to communicate between the two processors (M4 and DuoVero) is using MAVLink via the UART bridge on the AeroCore.  By default MAVLink packets are being sent from the M4 to the DuoVero.  These are the standard MAVLink packets (current state of the system).  As you've discovered, all you have to do is listen and parse them ... we created a basic way of doing so

https://github.com/gumstix/meta-gumstix-extras/tree/dizzy/recipes-extended/mavlink-socket/files

If you want do something more custom like what it sounds like you're trying to do, you'll likely need to create your own MAVLink message (good for doing any custom stuff) or use an existing message and fit it into what you're trying to do (quick way of getting stuff done).  However, getting a new/existing message type is only half the battle.  By default, the MAVLink message parser on the M4 doesn't look for many messages

https://github.com/aerocore/Firmware/blob/aerocore2-stable/src/modules/mavlink/mavlink_receiver.cpp#L146

As you can see from the link above, the M4 only looks for a small subset of MAVLink messages.  If the message you want to use (or your custom one) isn't expected, it doesn't do anything with it.  So you may need to add a message handler (could you use MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED?).  Likewise on the DuoVero, you need to parse all expected message types and do something with them.

1) QGroundControl is only needed to watch/monitor MAVLink data.  The system is perfectly fine just running on its own.  I've found it handy to use the DuoVero as a WiFi bridge sometimes.  Basically, all MAVLink data from the M4 goes to the DuoVero and then it broadcasts it over WiFi to a laptop that's running QGroundControl so I can monitor data ... even while flying.

2) To receive messages you need to tell the AeroCore to expect them (basically put in a parser).  The stream command tells the mavlink module in the AeroCore to output data ... nothing to do with receiving data.

3) To send a message from the DuoVero you just need to create the message and send it.  See the mavlink-socket example that I posted.  It doesn't create the packet from scratch, rather it takes data and repackages it and sends.  However, you could easily make your own MAVLink packet and send.  A good way to test to see if it's working is to write some code on the DuoVero, some simple packet like HEARTBEAT.  Have that code running and then plug in a USB into the M4 port on the AeroCore and connect to it using QGroundControl.  From there, you can monitor the MAVLink packets being sent and received so you should be able to see your packet from the DuoVero being received.

Hope this helps.

Andrew


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

jmcwil
Hi Andrew,

Thank you, that is very helpful!  I am still having a couple other problems with my setup though.  

I have been unable to connect to the Aerocore 2 using GGroundControl v2.9.7b.  The Aerocore is recognized by the serial port as an Aerocore, but when I open QGroundControl it says, "Please check to make sure you have an SD Card inserted in your Vehicle and try again."

I would like to modify some of the files in c_uart_interface_example, but I do not have write permissions to the directory, and I cannot compile anything that is in the example.  I am still able to run mavlink_control, but I seem unable to do anything else in that folder.

Thanks for your time and attention to these issues.

Jess

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

Andrew C. Smith
Hi Jess,

I'm not completely sure what you're trying to do with your setup so if I get this wrong, please correct me.

It sounds like you're trying to access the uSD card on the DuoVero through QGroundControl ... it doesn't work that way.  The uSD card is devoted completely to the DuoVero, it's a Linux file system (or whatever you load for the DuoVero).  There are two interfaces that allow communication between the AeroCore (M4) and DuoVero: UART bridge (default MAVLink data) and SPI bridge (nothing running by default but allows high speed data transmission).  If you're trying to save/log flight data from the AeroCore to the uSD card, you'll need to write a program on the DuoVero to do so.  I did one a while ago, not sure if it's posted.

I'm not sure why you don't have permission to write to the directory.  Where are those files located on your system?  Could you please describe where things are located, what is communicating with what and basically, what you're hoping to do.

Thanks,

Andrew
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

jmcwil
Hi Andrew,

Thanks, I was able to connect to QGroundControl with the Aerocore.  I had not be intentionally trying to connect to the uSD, but I guess that since I had USBs attached at both microUSB ports, the system was getting confused.

The setup on my duovero.  On duovero, after I login, I execute:
$ cd ..
$ cd ..
Which takes me out of the home directory, and then I go into the directory with files I wish to modify.
$ cd c_uart_interface_example-master/

Whenever I edit or attempt to compile the files in this folder, I am informed that I do not have write permissions.  I feel like there is probably something simple that I am not doing, but I yet to find a solution to this problem online.  By the way, I am running Ubuntu on my duovero.

Eventually, I will end up doing something custom with PX4 autopilot, but for now, my goal is to control servos by sending MAVLink from the duovero.  I know that there are commands for moving servo motors (MAV_CMD_DO_SET_SERVO), but I am unsure how to implement/invoke them.  My idea was to modify one of the existing files in c_uart_interface_example to include a message that moves a servo, but I have not been able to modify the files.  Are they in the wrong location?

So on the M4 side, would modifying mavlink_receiver.cpp to listen for the new message be sufficient to accomplish my goal?  I suppose the handle_message function is where I can put the actual commands for moving the servo.  

Please correct my understanding of the system architecture if necessary, I am still figuring out what files and commands are needed for communication to be accomplished.

Thanks again for answering all of my questions,
Jess
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

Andrew C. Smith
Hi Jess,

I'm very confused ... are you running those commands on the DuoVero?  Are you compiling stuff on the DuoVero?  Could you please describe your complete setup?  Where are files located?  What is running on the DuoVero?  What's running on your host computer?


Thanks,

Andrew
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

jmcwil
Hi Andrew,

I apologize for not providing a clear explanation of my set up.

My DuoVero has Ubuntu loaded onto its uSD card.  I have a serial connection between my laptop and the DuoVero's console port (via sudo screen /dev/ttyUSB0 115200).

The files in the example are stored in the DuoVero's root directory.  They are in a separate directory with the name c_uart_interface_example-master.  I would like to modify and compile the files "autopilot_interface.cpp" and "mavlink_control.cpp" within this directory using the commands nano and g++.  When I use nano, I can see the code, but I get a warning that I do not have write permissions.  How can I gain write permissions?  When I attempt to recompile the code using "g++ -o mavlink_control mavlink_control.cpp"  I get an error:
"/usr/bin/ld: cannot open output file mavlink_conrol: Permission denied
collect2: error: ld returned 1 exit status"
Is chown or chmod the way to fix this?

Please let me know if anything is still unclear, and I will do my best to explain in further detail.

Thanks,
Jess
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

Andrew C. Smith
Hi Jess,

Ok, thanks for the info, that helps.

What is the output if you run "ls -l" in the directory containing the files you want to edit?  Why are the files in the DuoVero root directory?  Why not in your home directory (the "~" directory)?


Andrew



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

jmcwil
Hi Andrew,

Thanks for the feedback.  I moved the files from root to the home/gumstix directory and changed their ownership.  I can edit and compile them now.

I am still a little confused about where I need to go from here to be able to receive messages on the M4.  How can I edit the code for the M4 to receive new messages and handle them appropriately?  Do I need to be able to edit and reflash the PX4 firmware to do this so that I can modify mavlink_receiver.cpp?  Or am I misunderstanding something?

Thank you for helping to clear this up.

Jess
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

Andrew C. Smith
Hi Jess,

If you're trying to receive messages not listed in this switch statement

https://github.com/aerocore/Firmware/blob/aerocore2-stable/src/modules/mavlink/mavlink_receiver.cpp#L146

Then you'll need to modify that code and add either your custom MAVLink message type (which requires edits in quite a few locations because you need to recompile the MAVLink headers) or existing MAVLink message.  Basically you'll be adding another switch case and adding code for what you want to do when it gets that message (handler).  Once you've done all that, you'll need to recompile the code and flash the AeroCore ("make aerocore_default upload").

Hope this helps,

Andrew
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

glen@jetsoftdev.com
Jess (or Andrew)

Just curious if you were able to achieve two way communication between the Duovero and Aerocore 2?

I am going down the same path of trying to exchange IMU data and control and monitor servos. Any advance tips would be helpful.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

Andrew C. Smith
Hi Glen,

Yes, two way communication between the AeroCore and COM (Overo, DuoVero, 96Boards, Intel Joule) as always worked out of the box.  The PX4 firmware streams MAVLink data via the serial bridge connected to the COM on boot.  The COM needs only an app

https://github.com/gumstix/meta-gumstix-extras/tree/fido/recipes-extended/mavlink-socket

to listen and parse.  The above app takes the data and sends it via UDP (WiFi) to a specific IP address.


Andrew


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

glen@jetsoftdev.com
I am not sure how to change my yocto build config to get that app to be compiled and installed as part of my build. 

It appears that the mavlink.h is not included in that app at all on the Duovero Yocto build so there is no way it would build out of the box. 

I can only assume that this file is set of include files that are in PX4 code for the AeroCore
/home/rscon/px4/firmware/mavlink/include/mavlink/v1.0/common


-- 
Glen Wernersbach 
Innovator and CEO
MotionLABs LLC.
"Making the Next Thing Happen Now!"™
513-240-9929


From: "Andrew C. Smith [via Gumstix]" <[hidden email]>
Date: Monday, September 26, 2016 at 9:00 AM
To: Glen Wernersbach <[hidden email]>
Subject: Re: MAVlink for Aerocore2 and DuoVero

Hi Glen,

Yes, two way communication between the AeroCore and COM (Overo, DuoVero, 96Boards, Intel Joule) as always worked out of the box.  The PX4 firmware streams MAVLink data via the serial bridge connected to the COM on boot.  The COM needs only an app

https://github.com/gumstix/meta-gumstix-extras/tree/fido/recipes-extended/mavlink-socket

to listen and parse.  The above app takes the data and sends it via UDP (WiFi) to a specific IP address.


Andrew





If you reply to this email, your message will be added to the discussion below:
http://gumstix.8.x6.nabble.com/MAVlink-for-Aerocore2-and-DuoVero-tp4970935p4971089.html
To unsubscribe from MAVlink for Aerocore2 and DuoVero, click here.
NAML
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAVlink for Aerocore2 and DuoVero

Andrew C. Smith
Have you tried just installing the package?

"smart install mavlink-socket"
Loading...