Cfbridge - Transform, To communicate with Mavros

I think that the original purpose of cfbridge is connecting ‘CrazyRadio PA’ and ‘GCS (like Qgroundcontrol)’. But, I want to that cfbridge connects CrazyRadio PA and mavros. (like that serial connect CF 2.0 with mavros by using USB connection ("/dev/ttyACM0") ). So I think, Source code of cfbridge should be revised.

Analyzing Source code of cfbridge is so hard… (I am second year collage student ) In my opinion, cfbridge should be added source code that have a similar function px4 connect to mavros.

Ultimately, what I want is to connect CF2 to mavros using cfbridge and receive CF2 data from mavros by using ubuntu terminal command "rostopic echo".

how do you think? @dennisss
I think you are the expert in this field…

I will try to verify mavros support later today once I am in my lab.

As far as I can tell, there should not be any needed design changes to use mavros rather than QGC with cfbridge. Can you please confirm that cfbridge is able to connect to QGC?

Connecting mavros to cfbridge should be the same procedure as for connecting mavros to an SITL simulation as both communicate over local udp ports.

Something like this should work:
roslaunch mavros px4.launch fcu_url:="udp://:14550@127.0.0.1:14555". 14550 and 14555 may need to be flipped. I will confirm later today.

Edit:
I’ve confirmed that the above command does work and I am above to echo telemetry data through mavros

1 Like

@dennisss , I am always thankful for your kindness. Thank you very much. Thanks to you, I am motivated and motivated to study. I understood everything you said. Is
it possible to receive data via rostopic echo / mavros / imu / data_raw frommavros px4.launch just by modifying fcu_url of
px.launch file without modifying cfbridge?

As far as I can confirm, I can check the data_raw data by connecting
“Crazyflie2.0” to the serial port using USB and modifying fcu_url =" seral: /// dev / ttyACM0: 57600 ". I can not get data_raw with UDP communication using CrazyRadio PA and cfbridge.

**Edit:
I’ve confirmed that cfbridge can connect to QGC.

This is my setup for making this work:

  1. I have three terminals.
    First I start one on the right to connect cfbridge
    Next I use bottom-left one to connect mavros
    Finally I use top-left one to print data from mavros. I got /mavros/imu/data by doing rostopic list and then picking an interesting one from the list

  2. This is the result of running those commands:

1 Like

thanks to reply, @dennisss!! I understood and analyzed the screen image that you attached.
Um… I have the same screen as you. But I would like to ask you to “echo” the "/mavros/imu/data_raw" from the “rostopic list” instead of "/mavros/imu/data". Do you receive data? I do not get any data. But when I connected Crazyflie to the serial port via USB, "/imu/data_raw" data came in. If you use “cfbridge”, the "/imu/data_raw" data will not come in. Please check this part.

data_raw is not configured to be transmitted over the radio as we would like to by default limit the amount of non-essential data going over the connection.

Mavlink in PX4 has different modes which define how much data is sent. This line specified that the crazyflie should be in osd mode: https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/rcS#L630.

If you examine the mavlink program (https://github.com/PX4/Firmware/blob/master/src/modules/mavlink/mavlink_main.cpp#L2047), osd mode does not send HIGHRES_IMU which is what data_raw listens to. Meanwhile, usb is usually configured in normal mode (https://github.com/PX4/Firmware/blob/master/src/modules/mavlink/mavlink_main.cpp#L1988) which sends just about everything including HIGHRES_IMU.

Please consider either changing the mode in the rcS file, or adding custom streams to mavlink if you really need this data.

2 Likes

Thanks, @dennisss !!
You solve my main problem that give pain to me for 2 weeks…!
Have a nice day! dennisss!

hi @dennisss when you echo /mavros/imu/data ,is it normal?
because when I echo /mavros/imu/data , it echos very slowly
but when I connect Crazyflie to computer by USB ,it echos normal.
Is there problems with my Crazyradio PA?
Do I need to upload any other software to it?