Skip to content

Grip control#86

Merged
jujuz455 merged 1 commit intomainfrom
grip-control
Apr 16, 2026
Merged

Grip control#86
jujuz455 merged 1 commit intomainfrom
grip-control

Conversation

@jujuz455
Copy link
Copy Markdown
Contributor

@jujuz455 jujuz455 commented Apr 7, 2026

Added ControlMode::Current to the passthrough conditional block in phoenix_node.hpp.

Copy link
Copy Markdown
Member

@ConnorNeed ConnorNeed left a comment

Choose a reason for hiding this comment

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

I'll let Darren comment on the human control side more

Comment thread src/HW-Devices/ros_phoenix_humble/include/ros_phoenix/phoenix_node.hpp Outdated
Comment thread src/Arm/arm_control/launch/end_effector.launch.py Outdated
Comment thread src/Teleop-Control/joystick_control/src/arm.cpp Outdated
Comment thread src/Teleop-Control/joystick_control/src/arm.cpp Outdated
@ConnorNeed
Copy link
Copy Markdown
Member

ConnorNeed commented Apr 14, 2026

CI/CD pipeline found an issue with building it. Looks like a templating bug since not every motor controller supports current control. A few ways to fix it but I will let you research since templates in C++ are a really cool mechanism. Try to fix it using a template overload but if you can't I am okay with just removing SPX support (We don't use it anyways).

https://api.ctr-electronics.com/phoenix/stable/cpp/_control_mode_8h.html

You might find: if constexpr (std::is_same_v<X,Y>) {} helpful

@jujuz455
Copy link
Copy Markdown
Contributor Author

CI/CD pipeline found an issue with building it. Looks like a templating bug since not every motor controller supports current control. A few ways to fix it but I will let you research since templates in C++ are a really cool mechanism. Try to fix it using a template overload but if you can't I am okay with just removing SPX support (We don't use it anyways).

https://api.ctr-electronics.com/phoenix/stable/cpp/_control_mode_8h.html

You might find: if constexpr (std::is_same_v<X,Y>) {} helpful

Thanks, I will try and let you know :D

} else if (mode == ControlMode::PercentOutput ||
mode == ControlMode::Disabled) {
this->controller_->Set(mode, control_msg->value);
} else if (mode == ControlMode::Current){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have a feeling this is still going to fail to compile. Any reference to ControlMode::Current when ControlMode is templated as ctre::phoenix::motorcontrol::VictorSPXControlMode will not compile.

the if constexpr allows the compiler to evaluate at compile time and ignore inside the brackets if false. All references to ControlMode::Current must be guarded by the is_same_v.

@jujuz455 jujuz455 force-pushed the grip-control branch 2 times, most recently from 2c7731c to acaf9fe Compare April 15, 2026 19:14
Copy link
Copy Markdown
Member

@ConnorNeed ConnorNeed left a comment

Choose a reason for hiding this comment

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

Fix the comment, wait for pass then you are good to squash merge

ControlMode mode = static_cast<ControlMode>(control_msg->mode);
// CTRE library expects velocity in units/100ms
if (mode == ControlMode::Velocity) {
// CTRE library expects velocity in units/100ms
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would leave this comment where it was

@jujuz455 jujuz455 merged commit c87c264 into main Apr 16, 2026
2 checks passed
@ConnorNeed ConnorNeed deleted the grip-control branch April 16, 2026 13:11
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