Can I read message by pixhawk from other Pixhawk?

I’m trying to do formation flight with two quadcopter,but it can’t receive gps location from other pixhawk,can anyone help?thx

Yes, as long as you have a connection between them there’s nothing stopping you from sending mavlink messages from one pixhawk to another. You’ll need to give each vehicle a unique mavlink system id.

Thanks for your reply,but I didn’t figure out how to do.

You’ll have to provide more detail. Sending mavlink messages from one pixhawk directly to another is just the start. Formation flight like this isn’t going to work without modification.

I’ve find somewhere to midify code to do formation flight,now I have to do is transport GPS location from one pixhawk to another pixhawk.

There are a few existing mechanisms (reposition, follow me, offboard control) you could use to do this, repurpose existing mavlink messages, or add new ones.

For example you could have one vehicle send the command MAV_CMD_DO_REPOSITION to the other, or look at the way follow me is implemented.

Can I do this without GCS?

Yes, although having one connected is often helpful.

Now I have to know how to send mavlink message from one to another pixhawk,becauce I don’t know how to do yet.

All mavlink messages are sent and received by the mavlink module here -

If you’d like to see a smaller self contained example of how to use mavlink, take a look at this -

How do I know have it send mav message from one to another or not?

Hey, I am sending mav messages like in the
In my setup, the pixhawk receives only every 0.3 seconds a new offboard position or velocity.
Is there a possibility for a faster update rate?
Thanks for your help