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

オブジェクトの前に移動する関数を追加 #94

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

kentohirogaki
Copy link

No description provided.

@Tossy0423 Tossy0423 marked this pull request as ready for review June 11, 2024 13:11
@hakuturu583 hakuturu583 marked this pull request as draft June 11, 2024 15:32
@hakuturu583 hakuturu583 changed the title navi_simによるオブジェクトの前に移動する関数の検証環境を作成した オブジェクトの前に移動する関数を追加 Jun 11, 2024
Signed-off-by: Masaya Kataoka <[email protected]>
Signed-off-by: Masaya Kataoka <[email protected]>
Signed-off-by: Masaya Kataoka <[email protected]>
Signed-off-by: Masaya Kataoka <[email protected]>
rclcpp::Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr goal_pub_front_pose_of_object_;
geometry_msgs::msg::PoseStamped goal_;

std::vector<robotx_behavior_msgs::msg::TaskObject> red_buoys_array_;
Copy link
Member

Choose a reason for hiding this comment

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

指定したオブジェクトの前に移動してほしいというActionなのでこの変数は不要かと思います。

Copy link
Member

Choose a reason for hiding this comment

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

ゴール地点のtask_objectがあれば良いので、

robotx_behavior_msgs::msg::TaskObject target_object;

みたいな型で情報を保存しておくのが望ましいと思います。

Comment on lines 82 to 84
if (task_objects_array) {
red_buoys_array_ = filter(task_objects_array.value(), static_cast<short>(Buoy::BUOY_RED));
}
Copy link
Member

Choose a reason for hiding this comment

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

何色のブイの前に行きたいかは状況次第なので、behavior treeの構造を決めるxmlから指示できるようにしておいてください。

Copy link
Member

Choose a reason for hiding this comment

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

イメージとしてはこんな感じ

<root main_tree_to_execute = "MainTree" >
    <BehaviorTree ID="MainTree">
        <Sequence>
            <Action ID="MoveToFrontPoseOfObject" task_objects="{task_objects}" object_type="red_bouy"/>
        </Sequence>
    </BehaviorTree>
</root>

Copy link
Member

Choose a reason for hiding this comment

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

static BT::PortsList providedPorts()
{
return appendPorts(
ActionROS2Node::providedPorts(),
{BT::InputPort<double>("goal_x"), BT::InputPort<double>("goal_y"),
BT::InputPort<double>("goal_theta")});
}

auto goal_x = this->getInput<double>("goal_x");
auto goal_y = this->getInput<double>("goal_y");
auto goal_theta = this->getInput<double>("goal_theta");

こんな感じで書くと、xmlから値を読み込めます。
portの名前はxmlの設定と必ず一致させてください。
事前決めた文字列と異なる文字列が入っていた場合(今回だとred_bouyとかgreen_bouyとかtaskobjectの種類ではない文字列)エラーにしてください。

<root main_tree_to_execute = "MainTree" >
<BehaviorTree ID="MainTree">
<Sequence>
<Action ID="MoveToFrontPoseOfObject" task_objects="{task_objects}"/>
Copy link
Member

Choose a reason for hiding this comment

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

portの追加をお願いします!

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