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

Last change on this file since 13 was 10, checked in by Sanahuja Guillaume, 9 years ago

lic

File size: 2.6 KB
RevLine 
[10]1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
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"
20#include "JoyReference.h"
21#include <Tab.h>
22#include <FrameworkManager.h>
23#include <cvmatrix.h>
24#include <Ahrs.h>
25#include <AhrsData.h>
26#include <DataPlot1D.h>
27
28using std::string;
29using namespace flair::core;
30using namespace flair::filter;
31using namespace flair::gui;
32
33namespace flair { namespace meta {
34
35MetaDualShock3::MetaDualShock3(FrameworkManager* parent,string name,uint16_t port,uint8_t priority) : TargetEthController(parent,name,port,priority) {
36 pimpl_=new MetaDualShock3_impl(this,name);
37 parent->AddDeviceToLog(pimpl_->joy_ref);
38 Start();
39}
40
41MetaDualShock3::~MetaDualShock3() {
42 delete pimpl_;
43}
44
45AhrsData* MetaDualShock3::GetReferenceOrientation(void) const {
46 return pimpl_->joy_ref->GetReferenceOrientation();
47}
48
49void MetaDualShock3::ErrorNotify(void) {
50 TargetEthController::FlashLed(4,10,0);
51 TargetEthController::Rumble(0xff,20,0,0);
52}
53
54void MetaDualShock3::Rumble(uint8_t left_force,uint8_t left_timeout,uint8_t right_force,uint8_t right_timeout) {
55 TargetEthController::Rumble(left_force,left_timeout,right_force,right_timeout);
56}
57
58void MetaDualShock3::SetLedON(unsigned int ledId) {
59 TargetEthController::SetLedOn(ledId);
60}
61
62void MetaDualShock3::SetLedOFF(unsigned int ledId) {
63 TargetEthController::SetLedOff(ledId);
64}
65
66void MetaDualShock3::FlashLed(unsigned int ledId,uint8_t on_timeout,uint8_t off_timeout) {
67 TargetEthController::FlashLed(ledId,on_timeout,off_timeout);
68}
69
70float MetaDualShock3::ZRef(void) const {
71 return pimpl_->joy_ref->ZRef();
72}
73
74float MetaDualShock3::DzRef(void) const {
75 return pimpl_->joy_ref->DzRef();
76}
77
78void MetaDualShock3::SetYawRef(float value) {
79 pimpl_->joy_ref->SetYawRef(value);
80}
81
82void MetaDualShock3::SetYawRef(Quaternion const &value) {
83 pimpl_->joy_ref->SetYawRef(value);
84}
85
86void MetaDualShock3::SetZRef(float value) {
87 pimpl_->joy_ref->SetZRef(value);
88}
89
90float MetaDualShock3::RollTrim(void) const {
91 return pimpl_->joy_ref->RollTrim();
92}
93
94float MetaDualShock3::PitchTrim(void) const {
95 return pimpl_->joy_ref->PitchTrim();
96}
97
98} // end namespace meta
99} // end namespace flair
Note: See TracBrowser for help on using the repository browser.