36 usingProxy(getProperty<std::string>(
"PlatformUnitName").getValue());
37 usingTopic(getProperty<std::string>(
"GamepadTopicName").getValue());
40 scaleX = getProperty<float>(
"ScaleX").getValue();
41 scaleY = getProperty<float>(
"ScaleY").getValue();
42 scaleRotation = getProperty<float>(
"ScaleAngle").getValue();
50 platformUnitPrx = getProxy<PlatformUnitInterfacePrx>(
51 getProperty<std::string>(
"PlatformUnitName").getValue());
52 emergencyStop = getProxy<EmergencyStopMasterInterfacePrx>(
"EmergencyStopMaster");
60 "The GamepadControlUnit");
80 defs->optional(enableHeartBeat,
82 "Flag to enable send a heart beat to the robot healh topic");
88 const std::string& name,
89 const GamepadData&
data,
90 const TimestampBasePtr& timestamp,
91 const Ice::Current&
c)
120 if (
data.leftTrigger > 0)
122 emergencyStop->setEmergencyStopState(EmergencyStopState::eEmergencyStopActive);
125 else if (
data.startButton)
127 emergencyStop->setEmergencyStopState(EmergencyStopState::eEmergencyStopInactive);
130 if (
data.rightTrigger > 0)
132 platformUnitPrx->move(
data.leftStickY * scaleX,
133 data.leftStickX * scaleY,
134 data.rightStickX * scaleRotation);
138 platformUnitPrx->move(0, 0, 0);
145 if (leftHandTime <= 0.0)
147 leftHandTime = IceUtil::Time::now().toMicroSeconds();
149 else if ((IceUtil::Time::now().toMicroSeconds() - leftHandTime) > 1000 * 1000)
152 HandUnitInterfacePrx handUnit = getProxy<HandUnitInterfacePrx>(
"LeftHandUnit");
155 std::string shapeName = (leftHandOpen) ?
"Close" :
"Open";
156 handUnit->setShape(shapeName);
157 leftHandOpen = !leftHandOpen;
167 if (
data.rightButton)
170 if (rightHandTime <= 0.0)
172 rightHandTime = IceUtil::Time::now().toMicroSeconds();
174 else if ((IceUtil::Time::now().toMicroSeconds() - rightHandTime) > 1000 * 1000)
176 HandUnitInterfacePrx handUnit = getProxy<HandUnitInterfacePrx>(
"RightHandUnit");
179 std::string shapeName = (rightHandOpen) ?
"Close" :
"Open";
180 handUnit->setShape(shapeName);
181 rightHandOpen = !rightHandOpen;
194 auto now = armarx::core::time::dto::DateTime();