Skip to content

Conversation

@maxipalay
Copy link
Contributor

Added option to register a callback for an incoming message of type Get_Torques_msg_t . This enables registering a callback to process incoming torque messages. I do not have the hardware to test this right now, but I have tested it previously and got good results.

Copy link
Member

@samuelsadok samuelsadok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small oversight error, otherwise looks good

src/ODriveCAN.h Outdated
*/
void onTorques(void (*callback)(Get_Torques_msg_t& feedback, void* user_data), void* user_data = nullptr) {
torques_callback_ = callback;
feedback_user_data_ = user_data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a new variable torques_user_data_.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added torques_user_data_ as a private variable and addressed the change accordingly in the onTorques function.

Get_Torques_msg_t estimates;
estimates.decode_buf(data);
if (torques_callback_)
torques_callback_(estimates, feedback_user_data_);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed this on latest update.

@samuelsadok samuelsadok merged commit da0f624 into odriverobotics:master Jan 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants