[BUG] Calibration. Gazebo SITL

#1

Hello,

I am trying to execute the calibration example in the DronecodeSDK on my IRIS quad-copter simulated in Gazebo.
I am getting calibration failed at the end with no motion :

!develop /meta/DronecodeSDK/example/calibrate/build> ./calibrate udp://:14540

[05:35:24|Info ] DronecodeSDK version: 0.11.0 (dronecode_sdk_impl.cpp:24)
Waiting to discover system...
[05:35:24|Info ] New device on: 127.0.0.1:14580 (udp_connection.cpp:200)
[05:35:24|Debug] New: System ID: 1 Comp ID: 1 (dronecode_sdk_impl.cpp:284)
[05:35:24|Debug] Component Autopilot (1) added. (system_impl.cpp:369)
[05:35:24|Debug] MAVLink: info: data link #0 lost (system_impl.cpp:280)
[05:35:25|Debug] MAVLink: info: data link #0 regained (system_impl.cpp:280)
[05:35:25|Debug] Discovered 1 component(s) (UUID: 5283920058631409231) (system_impl.cpp:515)
Discovered system with UUID: 5283920058631409231
Calibrating accelerometer...
[05:35:25|Debug] MAVLink: info: [cal] calibration started: 2 accel (system_impl.cpp:280)
    Progress: 0
[05:35:25|Debug] MAVLink: info: [cal] pending: back front left right up down (system_impl.cpp:280)
    Instruction: pending: back front left right up down
[05:35:25|Debug] MAVLink: info: [cal] hold vehicle still on a pending side (system_impl.cpp:280)
    Instruction: hold vehicle still on a pending side
[05:35:27|Debug] MAVLink: info: [cal] detected rest position, hold still... (system_impl.cpp:280)
    Instruction: detected rest position, hold still...
[05:35:29|Debug] MAVLink: info: [cal] down orientation detected (system_impl.cpp:280)
    Instruction: down orientation detected
[05:35:29|Debug] MAVLink: info: [cal] down orientation detected (system_impl.cpp:280)
    Instruction: down orientation detected
[05:35:29|Debug] MAVLink: info: [cal] Hold still, measuring down side (system_impl.cpp:280)
    Instruction: Hold still, measuring down side
[05:35:32|Debug] MAVLink: info: [cal] down side result: [ -0.2078   0.1541 -10.04 (system_impl.cpp:280)
    Instruction: down side result: [ -0.2078   0.1541 -10.04
[05:35:32|Debug] MAVLink: info: [cal] progress <17> (system_impl.cpp:280)
    Progress: 0.17
[05:35:32|Debug] MAVLink: info: [cal] down side done, rotate to a different side (system_impl.cpp:280)
    Instruction: down side done, rotate to a different side
[05:35:32|Debug] MAVLink: info: [cal] down side done, rotate to a different side (system_impl.cpp:280)
    Instruction: down side done, rotate to a different side
[05:35:32|Debug] MAVLink: info: [cal] pending: back front left right up (system_impl.cpp:280)
    Instruction: pending: back front left right up
[05:35:32|Debug] MAVLink: info: [cal] hold vehicle still on a pending side (system_impl.cpp:280)
    Instruction: hold vehicle still on a pending side
[05:35:35|Debug] MAVLink: info: [cal] detected rest position, hold still... (system_impl.cpp:280)
    Instruction: detected rest position, hold still...
[05:35:36|Debug] MAVLink: info: [cal] down side already completed (system_impl.cpp:280)
    Instruction: down side already completed
[05:35:36|Debug] MAVLink: info: [cal] pending: back front left right up (system_impl.cpp:280)
    Instruction: pending: back front left right up
[05:35:36|Debug] MAVLink: info: [cal] hold vehicle still on a pending side (system_impl.cpp:280)
    Instruction: hold vehicle still on a pending side
[05:35:39|Debug] MAVLink: info: [cal] detected rest position, hold still... (system_impl.cpp:280)
    Instruction: detected rest position, hold still...
[05:35:40|Debug] MAVLink: info: [cal] down side already completed (system_impl.cpp:280)
    Instruction: down side already completed
[05:35:40|Debug] MAVLink: info: [cal] pending: back front left right up (system_impl.cpp:280)
    Instruction: pending: back front left right up
[05:35:40|Debug] MAVLink: info: [cal] hold vehicle still on a pending side (system_impl.cpp:280)
    Instruction: hold vehicle still on a pending side
[05:35:43|Debug] MAVLink: info: [cal] detected rest position, hold still... (system_impl.cpp:280)
    Instruction: detected rest position, hold still...
[05:35:44|Debug] MAVLink: info: [cal] down side already completed (system_impl.cpp:280)
    Instruction: down side already completed
[05:35:44|Debug] MAVLink: info: [cal] pending: back front left right up (system_impl.cpp:280)
    Instruction: pending: back front left right up
[05:35:44|Debug] MAVLink: info: [cal] hold vehicle still on a pending side (system_impl.cpp:280)
    Instruction: hold vehicle still on a pending side
[05:35:47|Debug] MAVLink: info: [cal] detected rest position, hold still... (system_impl.cpp:280)
    Instruction: detected rest position, hold still...
[05:35:49|Debug] MAVLink: info: [cal] down side already completed (system_impl.cpp:280)
    Instruction: down side already completed
[05:35:49|Debug] MAVLink: info: [cal] pending: back front left right up (system_impl.cpp:280)
    Instruction: pending: back front left right up
[05:35:49|Debug] MAVLink: info: [cal] hold vehicle still on a pending side (system_impl.cpp:280)
    Instruction: hold vehicle still on a pending side
[05:35:52|Debug] MAVLink: info: [cal] detected rest position, hold still... (system_impl.cpp:280)
    Instruction: detected rest position, hold still...
[05:35:53|Debug] MAVLink: info: [cal] down side already completed (system_impl.cpp:280)
    Instruction: down side already completed
[05:35:53|Debug] MAVLink: critical: [cal] calibration failed: timeout: no motion (system_impl.cpp:280)
[05:35:53|Error] Calibration failed: timeout: no motion (calibration_impl.cpp:353)
--- Calibration failed with message: Failed

I would like to understand the reason for this error. Is it possible to reset the quadcopters in Gazebo???

I am getting accelerometer bias error after resetting the iris quad-copter in the simulator. Thus I thought about using the calibration to resolve the issue. However, I do not know if I should use the reboot function from the Action plugin is going to be better for the simulation

Best regards,

#2

It looks like there was no motion. Did you actually follow the instructions and turn the board on all of it’s sides so it can calibrate all axes?

Edit:
Oh, I guess you’re doing this in SITL and you can’t actually turn the vehicle to calibrate it. We don’t usually calibrate in SITL, it’s pre-calibrated so to say.

#3

Yes I understand.

But I have an accelerometer bias after resetting the quadcopters. Thus, I need a way to reset or calibrate the accelerometer.

Do you have any idea how to reset Accelerometer values.

By the way, I have tested the reboot function from the Action class. I am having the same result.

[09:47:44|Debug] MAVLink: critical: Preflight Fail: High Accelerometer Bias (system_impl.cpp:280)
#4

Is this with latest master? Have you changed anything? This usually works.

#5

This is with the last develop, I only get this message after resetting the IRIS model using a specific reset plugin in Gazebo

If I left the quadcopters on the ground of the simulator for several hours with out doing nothing, I get this message also

#6

develop would be the branch of the SDK. I’m asking about the Firmware version.

#7

Sorry,

No I am using the master for the firmware.

#8

That’s odd. On what platform?

#9

What do you mean by platform??

I use Gazebo. IRIS, and SDK to control the quadcopters.
I use PX4 as Firmware

I simulate several quadcopters at the same time

I created a specific gazebo plugin to reset the quad copters to their original place after an episode of simulation. However, after the first reset for the quadcopters. I start getting this error, and the quadcopters refuse to arm

#10

Aha! So the reset probably messes with the EKF2. I don’t think just resetting a quad like that is supported by the estimator.

#11

Well. I have absolutely to reset the quadcopter after an episode of simulation.

I need to find a way.

I do not understand why after using the function Reboot from the Action class from the SDK does not change the results??

#12

Aha, so you’re trying to reboot PX4 SITL? I don’t think that’s implemented either :smile:

#13

:joy:

Never thought that I might have to call unimplemented function.

So tell me please, What are my option in this case??

#14
Action::Result ActionImpl::reboot() const                                                                                                                                                                         
{                                                                                                                                                                                                                 
    MAVLinkCommands::CommandLong command{};                                                                                                                                                                       
                                                                                                                                                                                                                  
    command.command = MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN;                                                                                                                                                          
    command.params.param1 = 1.0f; // reboot autopilot                                                                                                                                                             
    command.params.param2 = 1.0f; // reboot onboard computer                                                                                                                                                      
    command.params.param3 = 1.0f; // reboot camera                                                                                                                                                                
    command.params.param4 = 1.0f; // reboot gimbal                                                                                                                                                                
    command.target_component_id = _parent->get_autopilot_id();                                                                                                                                                    
                                                                                                                                                                                                                  
    return action_result_from_command_result(_parent->send_command(command));                                                                                                                                     
}                              

Unless if this code is not working? then what to do?

#15

I am just posting to call for help, Any ideas to realize ?? maybe change to EKF2 or a way to reset the EKF2 using the SDK???

#16

Are you not using the EKF2 yet? I think that the EKF2 does actually reset if things are really off.

#17

The only hack I found is to increase the allowed limit of the bias in the PX4 firmware. Otherwise nothing is working.

I have to wait about 10 seconds after resetting the drones to their initial position, in order to wait for accelerometer value to calm down. Otherwise If I try to takeoff the quadcopter directly after resetting their positions, each drone is going to takeoff with an angle towards a random direction.

By the way, I was getting accelerometer bias for the quadcopter (iris) with optical flow even before flying for the first time, I think there is something wrong of the calibration inside the firmware ().

EKF2 fuse the data from different sensors, in our case GPS with IMU. When adding the optical flow, the bias increased naturally without any modification.

We need more documentation about the firmware, it takes a lot of time to understand what is happening. We need also to update the existing documentation in the user and developer section for the firmware.

One point to add, the reboot() command inside the px4 software is not working during the simulation. Why??

Is there any possibility to have commands auto-complete functionality inside the Px4 shell, Or some kind of man pages to help users understanding the reason behind each command. What do they do ?? What are their semantics?

Best regards,

#18

Sounds like a good workaround for your case.

Makes sense. The EKF does take time to initialize.

Ok I suggest you make an issue and mention @Paul_Riseborough in it.

Please feel free to contribute to the Devguide when you find out things that are missing. Help is always appreciated.

Probably because no one needed it yet, and because it’s not trivial to add.
Feel free to implement it here:


You would have to implement the restart somewhere here, basically you would invoke a shutdown and then just before main() exits you would have to go back to the beginning:

About the commands:
https://dev.px4.io/en/middleware/modules_main.html