uavcan: limit actuator controls poll interval

* rather than only in UavcanEscController updates
This commit is contained in:
Daniel Agar 2019-09-02 14:21:54 -04:00 committed by GitHub
parent 6938955b8d
commit 9f5f9c577e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -73,6 +73,8 @@ public:
*/
void set_rotor_count(uint8_t count) { _rotor_count = count; }
static constexpr unsigned MAX_RATE_HZ = 200; ///< XXX make this configurable
private:
/**
* ESC status message reception will be reported via this callback.
@ -89,7 +91,6 @@ private:
*/
uint8_t check_escs_status();
static constexpr unsigned MAX_RATE_HZ = 200; ///< XXX make this configurable
static constexpr unsigned ESC_STATUS_UPDATE_RATE_HZ = 10;
static constexpr unsigned UAVCAN_COMMAND_TRANSFER_PRIORITY = 5; ///< 0..31, inclusive, 0 - highest, 31 - lowest

View File

@ -1058,6 +1058,7 @@ UavcanNode::subscribe()
if (_control_subs[i] >= 0) {
_poll_ids[i] = add_poll_fd(_control_subs[i]);
orb_set_interval(_control_subs[i], 1000000 / UavcanEscController::MAX_RATE_HZ);
}
}
}