Skip to content

PythonとC++のサンプルコードに対するリファクタリングの実施 - #192

Open
KuraZuzu wants to merge 14 commits into
ros2from
feature/refactor-sample
Open

KuraZuzu wants to merge 14 commits into
ros2from
feature/refactor-sample

Conversation

@KuraZuzu

@KuraZuzu KuraZuzu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What does this implement/fix?

PythonとC++のサンプルプログラムのコードをリファクタリングします

  • includeする際のheaderの形式の修正
  • 直接のmain関数への処理の記述のclassへの分離
  • コメントの粒度の調整
  • PythonとC++での粒度の統一

Does this close any currently open issues?

なし

How has this been tested?

Gazeboと実機で動作を確認しました。

Any other comments?

AI を使って作成

Checklists

@KuraZuzu KuraZuzu self-assigned this Aug 14, 2026
@KuraZuzu KuraZuzu added the Type: Refactoring A code change that neither fixes a bug nor adds a feature label Aug 14, 2026
@KuraZuzu
KuraZuzu marked this pull request as ready for review August 14, 2026 08:34
@KuraZuzu
KuraZuzu requested review from Kuwamai and motty-mio2 August 14, 2026 08:34
@KuraZuzu
KuraZuzu marked this pull request as draft August 17, 2026 01:30
@KuraZuzu
KuraZuzu marked this pull request as ready for review September 18, 2026 08:48
@KuraZuzu

Copy link
Copy Markdown
Contributor Author

@Kuwamai
レビューをお願いします。@motty-mio2 による追加のリファクタリングも完了済みです。

@motty-mio2 motty-mio2 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

choi

Comment on lines +118 to +129
auto joint_values = move_group_l_gripper_->getCurrentJointValues();

if (current_arm == ArmSide::LEFT) {
joint_values[0] = -angle;
move_group_l_gripper_->setJointValueTarget(joint_values);
move_group_l_gripper_->move();
}
if (current_arm == ArmSide::RIGHT) {
joint_values[0] = angle;
move_group_r_gripper_->setJointValueTarget(joint_values);
move_group_r_gripper_->move();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
auto joint_values = move_group_l_gripper_->getCurrentJointValues();
if (current_arm == ArmSide::LEFT) {
joint_values[0] = -angle;
move_group_l_gripper_->setJointValueTarget(joint_values);
move_group_l_gripper_->move();
}
if (current_arm == ArmSide::RIGHT) {
joint_values[0] = angle;
move_group_r_gripper_->setJointValueTarget(joint_values);
move_group_r_gripper_->move();
}
if (current_arm == ArmSide::LEFT) {
auto joint_values = move_group_l_gripper_->getCurrentJointValues();
joint_values[0] = -angle;
move_group_l_gripper_->setJointValueTarget(joint_values);
move_group_l_gripper_->move();
}
else if (current_arm == ArmSide::RIGHT) {
auto joint_values = move_group_r_gripper_->getCurrentJointValues();
joint_values[0] = angle;
move_group_r_gripper_->setJointValueTarget(joint_values);
move_group_r_gripper_->move();
}

const int REPEAT = 3;
const float RADIUS = 0.1;

geometry_msgs::msg::Point center_position;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

center positionもconst 値でいいと思います

// 検出した物体の正規化座標(-1.0~1.0)を配信するパブリッシャ
rclcpp::Publisher<geometry_msgs::msg::PointStamped>::SharedPtr object_point_publisher_;

rclcpp::TimerBase::SharedPtr timer_;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

timerを一度も使っていないです

Suggested change
rclcpp::TimerBase::SharedPtr timer_;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Refactoring A code change that neither fixes a bug nor adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants