-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
Signed-off-by: Masaya Kataoka <[email protected]>
change source change yaml
Signed-off-by: Masaya Kataoka <[email protected]>
Signed-off-by: Masaya Kataoka <[email protected]>
…eature/go_object_waypoint
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_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
指定したオブジェクトの前に移動してほしいというActionなのでこの変数は不要かと思います。
There was a problem hiding this comment.
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;
みたいな型で情報を保存しておくのが望ましいと思います。
if (task_objects_array) { | ||
red_buoys_array_ = filter(task_objects_array.value(), static_cast<short>(Buoy::BUOY_RED)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
何色のブイの前に行きたいかは状況次第なので、behavior treeの構造を決めるxmlから指示できるようにしておいてください。
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
robotx_behavior_tree/robotx_behavior_tree/plugins/action/move_goal_action.cpp
Lines 45 to 51 in 739c925
static BT::PortsList providedPorts() | |
{ | |
return appendPorts( | |
ActionROS2Node::providedPorts(), | |
{BT::InputPort<double>("goal_x"), BT::InputPort<double>("goal_y"), | |
BT::InputPort<double>("goal_theta")}); | |
} |
robotx_behavior_tree/robotx_behavior_tree/plugins/action/move_goal_action.cpp
Lines 56 to 58 in 739c925
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}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
portの追加をお願いします!
move_to_front_pose_of_object.mp4 |
No description provided.