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

Axis idle on shutdown #31

Merged
merged 4 commits into from
Nov 7, 2024

Conversation

yushi-minemura
Copy link
Contributor

Related issue: #30.

I tested the ODrive S1. After switching to CLOSED_LOOP, I terminated the node. I confirmed that it changed to IDLE.

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.

This seems like a useful feature, thanks for the contribution! Just some small comments.

struct can_frame frame;
frame.can_id = node_id_ << 5 | CmdId::kSetAxisState;
{
std::unique_lock<std::mutex> guard(axis_state_mutex_);
Copy link
Member

Choose a reason for hiding this comment

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

the mutex was there to guard access to the axis_state_ variable. However since you're using a const here instead, you can remove the lock.

@@ -49,6 +51,17 @@ ODriveCanNode::ODriveCanNode(const std::string& node_name) : rclcpp::Node(node_n
}

void ODriveCanNode::deinit() {
if(axis_idle_on_shutdown_) {
Copy link
Member

Choose a reason for hiding this comment

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

formatting: if (

@CLAassistant
Copy link

CLAassistant commented Nov 6, 2024

CLA assistant check
All committers have signed the CLA.

@yushi-minemura
Copy link
Contributor Author

@samuelsadok
Thank you for your feedback. I have made changes according to the comments.

  • fix if() format
  • remove unnecessary mutex lock

@samuelsadok
Copy link
Member

thanks!

@samuelsadok samuelsadok merged commit d986c24 into odriverobotics:main Nov 7, 2024
3 checks passed
@yushi-minemura yushi-minemura deleted the axis_idle_on_shutdown branch November 8, 2024 01:20
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.

3 participants