Skip to content

584 task gripper controller merge into main we want juicy gripper inside of main#10

Open
ApatShe wants to merge 15 commits intomainfrom
584-task-gripper-controller
Open

584 task gripper controller merge into main we want juicy gripper inside of main#10
ApatShe wants to merge 15 commits intomainfrom
584-task-gripper-controller

Conversation

@ApatShe
Copy link
Copy Markdown

@ApatShe ApatShe commented Apr 23, 2026

THE CODE SHOULD SPEAK FOR ITSELF inshallah

forrisdahl and others added 15 commits September 8, 2025 17:20
…lder as well as removed the previously added dependencies as consequence of making the controller module within the interface
…n vortex_auv repo: vortex-auv/guidance/reference_filter_dp

-Rather than following the recipe to construct the model after p. 337 EQ 12.11 and 12.12 in Thor I. Fossens book, dimensions and names have been changed to match the p.336  EQ 12.5 and 12.6. -Notice several TODO's for future work and consultation with Cyp & Jøg
…with entire system, needs actual servo states to simulate proper topic relationships
…im interface with functioning goal sends to ref filter playing out in sim environment
Copy link
Copy Markdown

@jorgenfj jorgenfj left a comment

Choose a reason for hiding this comment

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

The dp reference filter has been rewritten to have a separate cpp class to handle the action state execution. Up to you whether you want to implement that here as well, both options are fine.
Also should look over the files changed and just slap const qualifiers on variables where it is suited.

Comment on lines +118 to +127
types::GripperState measured_state;
types::GripperState reference_state;

{
std::lock_guard<std::mutex> lock(state_mutex_);
measured_state.roll = roll_measured_;
measured_state.pinch = pinch_measured_;
reference_state.roll = roll_ref_;
reference_state.pinch = pinch_ref_;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These local state variables should preferably be a const.
Should look into this for complex const initialization using lambdas

Comment on lines +46 to +49
reference_sub_ = this->create_subscription<vortex_msgs::msg::GripperState>(
gripper_state_topic, qos_sensor_data,
std::bind(&GripperReferenceFilterNode::reference_callback, this,
std::placeholders::_1));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using lambdas instead of std::bind to avoid using std::placeholders

Comment on lines +59 to +75
action_server_ = rclcpp_action::create_server<
vortex_msgs::action::GripperReferenceFilterWaypoint>(

this,

action_server_name,

std::bind(&GripperReferenceFilterNode::handle_goal, this,
std::placeholders::_1, std::placeholders::_2),

std::bind(&GripperReferenceFilterNode::handle_cancel, this,
std::placeholders::_1),

std::bind(&GripperReferenceFilterNode::handle_accepted, this,
std::placeholders::_1),

rcl_action_server_get_default_options(), cb_group_);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is this line spacing? I need a vertical monitor to read this...

Comment on lines +98 to +103
rclcpp_action::GoalResponse GripperReferenceFilterNode::handle_goal(
const rclcpp_action::GoalUUID& uuid,
std::shared_ptr<const vortex_msgs::action::GripperReferenceFilterWaypoint::Goal>
goal) {
(void)uuid;
(void)goal;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For unused function args a more explicit approach is to comment out the args themselvs instead of using (void).

const rclcpp_action::GoalUUID& /*uuid*/,
    std::shared_ptr<const vortex_msgs::action::GripperReferenceFilterWaypoint::Goal>
    /*goal*/

Comment on lines +125 to +130
void GripperReferenceFilterNode::handle_accepted(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<
vortex_msgs::action::GripperReferenceFilterWaypoint>> goal_handle) {
std::thread{std::bind(&GripperReferenceFilterNode::execute, this,
std::placeholders::_1), goal_handle}.detach();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This node currently uses both a Reentrant callback group for the action server and detaches a thread for the execute function, which IMO is overkill. We also had some race condition issues with this setup in the previous implementation of the reference filter, which is now fixed so you can take inspiration from that.

Comment on lines +135 to +140
x(0) = reference_(0); // roll
x(1) = reference_(1); // pinch
x(2) = 0.0; // roll_dot
x(3) = 0.0; // pinch_dot
x(4) = 0.0; // roll_dotdot
x(5) = 0.0; // pinch_dotdot
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does the gripper reference message need to be 6d if we ever only use the first two dims?

Comment on lines +132 to +168
Eigen::Vector6d GripperReferenceFilterNode::fill_reference_state() {
Eigen::Vector6d x = Eigen::Vector6d::Zero();

x(0) = reference_(0); // roll
x(1) = reference_(1); // pinch
x(2) = 0.0; // roll_dot
x(3) = 0.0; // pinch_dot
x(4) = 0.0; // roll_dotdot
x(5) = 0.0; // pinch_dotdot

return x;
}

Eigen::Vector2d GripperReferenceFilterNode::fill_reference_goal(
const vortex_msgs::msg::GripperWaypoint& goal) {

double roll{goal.roll.roll};
double pinch{goal.pinch.pinch};

Eigen::Vector2d reference;
reference << roll, pinch;

return reference;
}

vortex_msgs::msg::GripperReferenceFilter GripperReferenceFilterNode::fill_reference_msg() {
vortex_msgs::msg::GripperReferenceFilter feedback_msg;

feedback_msg.roll = x_(0);
feedback_msg.pinch = x_(1);
feedback_msg.roll_dot = x_(2);
feedback_msg.pinch_dot = x_(3);
feedback_msg.roll_dotdot = x_(4);
feedback_msg.pinch_dotdot = x_(5);

return feedback_msg;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe move these conversion functions to a separate util file to avoid clutter in the ros node

Comment on lines +237 to +238
auto feedback = std::make_shared<
vortex_msgs::action::GripperReferenceFilterWaypoint::Feedback>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should remove feedback from the action definition and just publish to topic if anyone is interested

Comment on lines +268 to +270
vortex_msgs::msg::GripperReferenceFilter feedback_msg = fill_reference_msg();
feedback->reference = feedback_msg;
reference_pub_->publish(feedback_msg);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should use unique pointer for this kind of pipeline style publishing. Ref: https://vortex.a2hosted.com/index.php/Composable_nodes


GripperReferenceFilterNode::GripperReferenceFilterNode(const rclcpp::NodeOptions& options)
: Node("gripper_reference_filter_node", options) {
time_step_ = std::chrono::milliseconds(10);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should rename the variable to time_step_ms_ to make it more explicit that it is milliseconds and not seconds. Also would be nice to expose this as a ros param

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