Skip to content
Snippets Groups Projects
Commit 400cee73 authored by Markus Grotz's avatar Markus Grotz
Browse files

add emergency stop to gamepad

parent 55ae0b7a
No related branches found
No related tags found
No related merge requests found
......@@ -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)
{
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment