47 #include <uavcan/uavcan.hpp> 48 #include <uavcan/equipment/esc/RawCommand.hpp> 49 #include <uavcan/equipment/esc/Status.hpp> 69 void update_outputs(
bool stop_motors, uint16_t outputs[MAX_ACTUATORS],
unsigned num_outputs);
82 void esc_status_sub_cb(
const uavcan::ReceivedDataStructure<uavcan::equipment::esc::Status> &
msg);
98 void (UavcanEscController::*)(
const uavcan::ReceivedDataStructure<uavcan::equipment::esc::Status>&)>
StatusCbBinder;
100 typedef uavcan::MethodBinder<UavcanEscController *,
uavcan::MonotonicTime _prev_cmd_pub
rate limiting
uavcan::MethodBinder< UavcanEscController *, void(UavcanEscController::*)(const uavcan::ReceivedDataStructure< uavcan::equipment::esc::Status > &)> StatusCbBinder
UavcanEscController(uavcan::INode &node)
static constexpr int MAX_ACTUATORS
uORB::PublicationMulti< esc_status_s > _esc_status_pub
uavcan::Publisher< uavcan::equipment::esc::RawCommand > _uavcan_pub_raw_cmd
High-resolution timer with callouts and timekeeping.
static constexpr int MAX_ACTUATORS
uint8_t check_escs_status()
Checks all the ESCs freshness based on timestamp, if an ESC exceeds the timeout then is flagged offli...
static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE]
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
void esc_status_sub_cb(const uavcan::ReceivedDataStructure< uavcan::equipment::esc::Status > &msg)
ESC status message reception will be reported via this callback.
static constexpr unsigned MAX_RATE_HZ
XXX make this configurable.
static int max_output_value()
uavcan::TimerEventForwarder< TimerCbBinder > _orb_timer
uavcan::Subscriber< uavcan::equipment::esc::Status, StatusCbBinder > _uavcan_sub_status
constexpr _Tp max(_Tp a, _Tp b)
static constexpr uint16_t DISARMED_OUTPUT_VALUE
void set_rotor_count(uint8_t count)
Sets the number of rotors.
void update_outputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs)
static constexpr unsigned UAVCAN_COMMAND_TRANSFER_PRIORITY
0..31, inclusive, 0 - highest, 31 - lowest
void orb_pub_timer_cb(const uavcan::TimerEvent &event)
ESC status will be published to ORB from this callback (fixed rate).
static constexpr unsigned ESC_STATUS_UPDATE_RATE_HZ
uint8_t _max_number_of_nonzero_outputs
Performance measuring tools.
uavcan::MethodBinder< UavcanEscController *, void(UavcanEscController::*)(const uavcan::TimerEvent &)> TimerCbBinder