diff --git a/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.cpp b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.cpp index 57bd492d1e56a1e54513c4af3ac5431b1ff68e25..5c413bf4dde89427307e929523f9aa7d29b9a8bc 100644 --- a/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.cpp +++ b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.cpp @@ -26,6 +26,8 @@ + + namespace armarx { void GamepadControlUnit::onInitComponent() @@ -33,12 +35,14 @@ namespace armarx ARMARX_INFO << "oninit GamepadControlUnit"; usingProxy(getProperty<std::string>("PlatformUnitName").getValue()); usingTopic(getProperty<std::string>("GamepadTopicName").getValue()); - + usingProxy("EmergencyStopMaster"); scaleX = getProperty<float>("ScaleX").getValue(); scaleY = getProperty<float>("ScaleY").getValue(); scaleRotation = getProperty<float>("ScaleAngle").getValue(); ARMARX_INFO << "oninit GamepadControlUnit end"; + + } @@ -46,6 +50,7 @@ namespace armarx { ARMARX_INFO << "onConnect GamepadControlUnit"; platformUnitPrx = getProxy<PlatformUnitInterfacePrx>(getProperty<std::string>("PlatformUnitName").getValue()); + emergencyStop = getProxy<EmergencyStopMasterInterfacePrx>("EmergencyStopMaster"); } @@ -68,6 +73,10 @@ namespace armarx void GamepadControlUnit::reportGamepadState(const std::string& device, const std::string& name, const GamepadData& data, const TimestampBasePtr& timestamp, const Ice::Current& c) { + if (data.leftTrigger) + { + emergencyStop->setEmergencyStopState(EmergencyStopState::eEmergencyStopActive); + } //scales are for the robot axis if (data.rightTrigger > 0) { diff --git a/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h index 2614a96fff87084ee3383bd705c05e6c2c6bbc5f..abdf77a77d42aa73a48bce6c93a15416bb8c64bc 100644 --- a/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h +++ b/source/RobotAPI/components/GamepadControlUnit/GamepadControlUnit.h @@ -24,6 +24,7 @@ #include <ArmarXCore/core/Component.h> +#include <ArmarXCore/interface/components/EmergencyStopInterface.h> #include <RobotAPI/interface/units/GamepadUnit.h> @@ -105,6 +106,7 @@ namespace armarx float scaleX; float scaleY; float scaleRotation; + EmergencyStopMasterInterfacePrx emergencyStop; public: void reportGamepadState(const std::string& device, const std::string& name, const GamepadData& data,