I'm inserting a code to improve barometer altitude accuracy.
To get the current velocity of the vehicle I used orb functions: orb_subscribe(), orb_check() and orb_copy() for ORB_ID(vehicle_local_position) as like other samples.
Problem: But always orb_copy() returns ERROR value (-1) and the 'errno' value is 5 (EIO).
I checked that the publishing of the message is ok.
What is wrong? Something should be considered when orb_copy() is used in driver code?
The added codes are as following:
in class MS5611 declaration
int _local_pos_sub; // the vehicle local position subscription
struct vehicle_local_position_s _local_pos;
in MS5611:MS5611() constructor
_local_pos_sub is initialized as -1.
if(_local_pos_sub == -1)
_local_pos_sub = orb_subscribe(ORB_ID(vehicle_local_position));
result = orb_copy(ORB_ID(vehicle_local_position), _local_pos_sub, &_local_pos);
// Problem: the 'result' is always ERROR (-1) and the 'errno' is EIO (5).