source: flair-src/trunk/lib/FlairMeta/src/MetaDualShock3.cpp@ 362

Last change on this file since 362 was 214, checked in by Sanahuja Guillaume, 7 years ago

matrix

File size: 2.7 KB
RevLine 
[10]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[10]4// %flair:license}
[7]5// created: 2014/01/14
6// filename: MetaDualShock3.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: objet integrant la manette DualShock3 et les consignes joystick
14//
15//
16/*********************************************************************/
17
18#include "MetaDualShock3.h"
19#include "MetaDualShock3_impl.h"
[38]20#include "TargetController.h"
[7]21#include "JoyReference.h"
22#include <Tab.h>
23#include <FrameworkManager.h>
[214]24#include <Matrix.h>
[7]25#include <Ahrs.h>
26#include <AhrsData.h>
27#include <DataPlot1D.h>
28
29using std::string;
30using namespace flair::core;
31using namespace flair::filter;
32using namespace flair::gui;
[38]33using namespace flair::sensor;
[7]34
[15]35namespace flair {
36namespace meta {
[7]37
[137]38MetaDualShock3::MetaDualShock3(string name,
[38]39 TargetController *controller)
40 : controller(controller),IODevice((IODevice*)controller, name) {
[15]41 pimpl_ = new MetaDualShock3_impl(this, name);
[137]42 getFrameworkManager()->AddDeviceToLog(pimpl_->joy_ref);
[38]43 controller->Start();
[157]44
45 SetIsReady(true);
[7]46}
47
[15]48MetaDualShock3::~MetaDualShock3() { delete pimpl_; }
[7]49
[15]50AhrsData *MetaDualShock3::GetReferenceOrientation(void) const {
51 return pimpl_->joy_ref->GetReferenceOrientation();
[7]52}
53
54void MetaDualShock3::ErrorNotify(void) {
[38]55 controller->FlashLed(4,10,0);
56 controller->Rumble(0xff,20,0,0);
[7]57}
58
[38]59void MetaDualShock3::Rumble(uint8_t left_force,uint8_t left_timeout,uint8_t right_force,uint8_t right_timeout) {
60 controller->Rumble(left_force,left_timeout,right_force,right_timeout);
[7]61}
62
63void MetaDualShock3::SetLedON(unsigned int ledId) {
[38]64 controller->SetLedOn(ledId);
[7]65}
66
67void MetaDualShock3::SetLedOFF(unsigned int ledId) {
[38]68 controller->SetLedOff(ledId);
[7]69}
70
[38]71void MetaDualShock3::FlashLed(unsigned int ledId,uint8_t on_timeout,uint8_t off_timeout) {
72 controller->FlashLed(ledId,on_timeout,off_timeout);
[7]73}
74
[15]75float MetaDualShock3::ZRef(void) const { return pimpl_->joy_ref->ZRef(); }
[7]76
[15]77float MetaDualShock3::DzRef(void) const { return pimpl_->joy_ref->DzRef(); }
[7]78
79void MetaDualShock3::SetYawRef(float value) {
[15]80 pimpl_->joy_ref->SetYawRef(value);
[7]81}
82
83void MetaDualShock3::SetYawRef(Quaternion const &value) {
[15]84 pimpl_->joy_ref->SetYawRef(value);
[7]85}
86
[15]87void MetaDualShock3::SetZRef(float value) { pimpl_->joy_ref->SetZRef(value); }
[7]88
89float MetaDualShock3::RollTrim(void) const {
[15]90 return pimpl_->joy_ref->RollTrim();
[7]91}
92
93float MetaDualShock3::PitchTrim(void) const {
[38]94 return pimpl_->joy_ref->PitchTrim();
[7]95}
96
[38]97void MetaDualShock3::UpdateFrom(const flair::core::io_data *data) {
98 pimpl_->UpdateFrom(data);
99}
100
[7]101} // end namespace meta
102} // end namespace flair
Note: See TracBrowser for help on using the repository browser.