From 0b649a980bb534f4fb6dc54149f14224007d9914 Mon Sep 17 00:00:00 2001 From: acki Date: Thu, 18 Dec 2025 20:12:29 +0100 Subject: [PATCH] joy --- src/modelec_strat/src/action_executor.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/modelec_strat/src/action_executor.cpp b/src/modelec_strat/src/action_executor.cpp index f1292f0..574f934 100644 --- a/src/modelec_strat/src/action_executor.cpp +++ b/src/modelec_strat/src/action_executor.cpp @@ -81,9 +81,28 @@ namespace Modelec }); joy_sub_ = node_->create_subscription( - "/joy", 10, [this](const sensor_msgs::msg::Joy::SharedPtr) + "/joy", 10, [this](const sensor_msgs::msg::Joy::SharedPtr msg) { // use game controller to manually control all the action. make it carefully + if (msg->buttons.size() >= 5) + { + if (msg->buttons[0] == 1) // A button + { + Down(true); + } + else if (msg->buttons[1] == 1) // B button + { + Up(true); + } + else if (msg->buttons[3] == 1) // X button + { + Down(false); + } + else if (msg->buttons[4] == 1) // Y button + { + Up(false); + } + } }); }