摇杆控制动感平台

本示例主要用到2个设备,JoystickMOTION-PLAT两个设备,通过Joystick的输入控制动感平台的相关动作。

示例代码

auto& _jsDevice = IODeviceController::Instance()
		.GetIODevice("Joystick");

auto& _motionPlatDevice = IODeviceController::Instance()
	.GetIODevice("MotionPlatform");

// 响应俯仰动作
_jsDevice.BindAxis("Pitch", [&_motionPlatDevice](float PitchVal) {
	_motionPlatDevice.SetDO(EKeys::OAxis_01, PitchVal);
});

// 响应翻滚动作
_jsDevice.BindAxis("Roll", [&_motionPlatDevice](float RollVal) {
	_motionPlatDevice.SetDO(EKeys::OAxis_03, RollVal);
});

// 控制平台速度
_jsDevice.BindAxis("Speed", [&_motionPlatDevice](float SpeedVal) {
	_motionPlatDevice.SetDO(EKeys::OAxis_00, SpeedVal);
});

最后更新于

这有帮助吗?