Skip to content

Commit

Permalink
[rpm_actuators] actuators on a bus require indices
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 20, 2023
1 parent a98fd3a commit 4ee7cda
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conf/abi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</message>

<message name="RPM" id="15">
<field name="rpm" type="uint16_t *" unit="rpm"/>
<field name="rpm" type="struct rpm_act_t *" unit="rpm"/>
<field name="num_act" type="uint8_t"/>
</message>

Expand Down
6 changes: 6 additions & 0 deletions sw/airborne/modules/actuators/actuators.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
extern void actuators_init(void);
extern void actuators_periodic(void);

// Actuator RPM structure for ABI Message
struct rpm_act_t {
uint8_t actuator_idx;
int32_t rpm;
};

#if ACTUATORS_NB

extern uint32_t actuators_delay_time;
Expand Down
10 changes: 10 additions & 0 deletions sw/airborne/modules/actuators/actuators_uavcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ static void actuators_uavcan_esc_status_cb(struct uavcan_iface_t *iface, CanardR
}
#endif
#endif

// Create struct for ABI
#ifdef SERVOS_UAVCAN1_NB
struct rpm_act_t rpm_message;
rpm_message.actuator_idx = esc_idx;
rpm_message.rpm = telem[esc_idx].rpm;

// Send ABI message
AbiSendMsgRPM(RPM_SENSOR_ID, &rpm_message, SERVOS_UAVCAN1_NB);
#endif
}

/**
Expand Down
1 change: 1 addition & 0 deletions sw/airborne/modules/core/abi_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "math/pprz_algebra_float.h"
#include "modules/gps/gps.h"
#include "modules/radio_control/radio_control.h"
#include "modules/actuators/actuators.h"
/* Include here headers with structure definition you may want to use with ABI
* Ex: '#include "modules/gps/gps.h"' in order to use the GpsState structure
*/
Expand Down

0 comments on commit 4ee7cda

Please sign in to comment.