Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rpm_actuators] actuators on a bus require indices #3089

Merged
merged 5 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[rpm_actuators] actuators on a bus require indices
  • Loading branch information
dewagter committed Sep 22, 2023
commit 96d77b007887867e1f611d63aa4e8575a8caff64
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 @@ -215,6 +215,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