hippo5329 / linorobot2_hardware

A fork of the linorobot/linorobot2_hardware project which builds motor controller firmware for teensy, esp32 and pico to control mobile robots based on micro-ROS with various sensors support.
Apache License 2.0
14 stars 12 forks source link

New Settings #24

Open tbalatka opened 6 days ago

tbalatka commented 6 days ago

I noticed newly added settings in linorobot2_hardware/config/custom/gendrv_wifi_config.h, see below. Just wondering how these settings relate to the magnetometer settings (//#define MAG_BIAS { 0, 0, 0 })? Or is this information in your Wiki?

Many thanks!

define ACCEL_COV { 0.01, 0.01, 0.01 }

define GYRO_COV { 0.001, 0.001, 0.001 }

define ORI_COV { 0.01, 0.01, 0.01 }

define MAG_COV { 1e-12, 1e-12, 1e-12 }

define POSE_COV { 0.001, 0.001, 0.001, 0.001, 0.001, 0.001 }

define TWIST_COV { 0.001, 0.001, 0.001, 0.003, 0.003, 0.003 }

hippo5329 commented 4 days ago

To enable magnetometer, you will need to enable madgwick to fuse magnetometer into /imu/data and update the ekf configuration to fuse yaw from magnetometer into /odom. https://github.com/hippo5329/linorobot2_hardware/wiki#enable-magnetometer

The default the magnetometer settings (//#define MAG_BIAS { 0, 0, 0 }) is before magnetometer calibration. You will need to calibrate magnetometer to remove hard iron bias, mostly from battery, motor, lidar and chassis etc. https://github.com/hippo5329/linorobot2_hardware/wiki#magnetometer-calibration

The covariance matrix depends on the precision of the sensors. They are usually based on the datasheets. Covariance equals standard deviation squared. The lower covariance, the higher precision. If the sensor is very noisy, we can decrease the ratio of this sensor to fusion by increase the covariance. That is fine tuning. https://github.com/hippo5329/linorobot2_hardware/wiki#fine-tune-covariance

The covariance matrix for magnetometer may seem odd at first. It is because the unit for magnetometer is Telsa in ROS.

The magnetometer is quite noisy in my robots probably due to the location I mounted it. So I gave a higher covariance and madgwick orientation_stddev:=0.01 in the bring up launch. It would be better to mount the magnetometer on a pole higher away from the interference.

I am new to robotic. All the covariance matrix and magnetometer usage are based on the search and experiments result. I might be wrong..