PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.53k stars 13.52k forks source link

Vehicle_attitude stops updating after certain time while running SITL simulation #15437

Open ghost opened 4 years ago

ghost commented 4 years ago

Describe the bug When you subscribe to the uORB topic vehicle_attitude in PX4 SITL simulation, after a certain random time, it appears that the topic values does not get updated anymore. The timestamp values are old and remain so forever. The time after which values stop updating is random and varies.

To Reproduce Steps to reproduce the behavior:

  1. Clone latest stable release git clone https://www.github.com/PX4/Firmware; git checkout v1.10.2
  2. Modify the source file in examples/px4_simple_app to subscribe to vehicle_attitude. Attaching the code for how I am subscribing
#include <uORB/topics/vehicle_attitude.h>

__EXPORT int px4_simple_app_main(int argc, char *argv[]);

int px4_simple_app_main(int argc, char *argv[])
{
    int att_pub = orb_subscribe(ORB_ID(vehicle_attitude));
    static int counter = 0;

    while(1)
    {

        if(counter == 500)
        {
            counter = 0;
            struct vehicle_attitude_s att;
            /* copy sensors raw data into local buffer */
            orb_copy(ORB_ID(vehicle_attitude), att_pub, &att);
            PX4_INFO("Timestamp:\t%8.4f Attitude:\t%8.4f\t%8.4f\t%8.4f\t%8.4f",
                 (double)att.timestamp,
                 (double)att.q[0],
                 (double)att.q[1],
                 (double)att.q[2],
                 (double)att.q[3]);          
        }
        else
        {
            counter++;
        }

    }

    PX4_INFO("exiting");

    return 0;
}
  1. Run the SITL simulation: make px4_sitl_default jmavsim
  2. Once SITL launches, start the module px4_simple_app
  3. After some time in SITL window you can observe that the time stamp values and quaternion values are not updated anymore as shown below

INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035 INFO [px4_simple_app] Timestamp: 240364000.0000 Attitude: 1.0000 -0.0003 0.0011 0.0035

Expected behavior Timestamp and quaternion values should be updated consistently

Screenshots image

Additional context PX4 Firmware: 1.10.2 Platform: Windows 10 Toolchain: Cygwin v0.8

ghost commented 4 years ago

I tried putting a sleep of 100 ms in the while loop. It did not help. It still got stuck after some random time.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.