-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from nasa/94-add-a-new-apem-device
Add new APEM HC as IndustrialProducts4
- Loading branch information
Showing
15 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
PURPOSE: | ||
LIBRARY DEPENDENCIES: ( | ||
(idf/IndustrialProducts4.cpp) | ||
) | ||
*/ | ||
|
||
/** | ||
* @trick_parse{everything} | ||
* @trick_link_dependency{idf/IndustrialProducts4.cpp} | ||
*/ | ||
|
||
#ifndef INDUSTRIAL_PRODUCTS4_HH | ||
#define INDUSTRIAL_PRODUCTS4_HH | ||
|
||
#include "idf/InputLayout.hh" | ||
#include "idf/SingleInput.hh" | ||
|
||
namespace idf { | ||
|
||
/** | ||
* %IndustrialProducts4 hand controller's input layout | ||
* | ||
* @author Philip Kunz | ||
*/ | ||
class IndustrialProducts4 : public virtual InputLayout { | ||
|
||
public: | ||
|
||
/** constructor */ | ||
IndustrialProducts4(); | ||
|
||
/** destructor */ | ||
virtual ~IndustrialProducts4() {}; | ||
|
||
/** forward-backward pivoting */ | ||
SingleInput forwardBackwardPivot; | ||
|
||
/** left-right pivoting */ | ||
SingleInput leftRightPivot; | ||
|
||
/** twisting */ | ||
SingleInput twist; | ||
|
||
/** the trigger button */ | ||
SingleInput trigger; | ||
|
||
/** the grip button */ | ||
SingleInput grip; | ||
|
||
/** the upper trigger of the switch */ | ||
SingleInput switchUp; | ||
|
||
/** the lower trigger of the switch */ | ||
SingleInput switchDown; | ||
|
||
/** up-down pivoting of the analog hat */ | ||
SingleInput hatUpDownPivot; | ||
|
||
/** left-right pivoting of the analog hat */ | ||
SingleInput hatLeftRightPivot; | ||
|
||
/** the upper button */ | ||
SingleInput button1; | ||
|
||
/* the lower button*/ | ||
SingleInput button2; | ||
|
||
protected: | ||
|
||
virtual const std::vector<Configurable>& getConfigurables(); | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
PURPOSE: | ||
LIBRARY DEPENDENCIES: ( | ||
(idf/UsbIndustrialProducts4.cpp) | ||
) | ||
*/ | ||
|
||
/** | ||
* @trick_parse{everything} | ||
* @trick_link_dependency{idf/UsbIndustrialProducts4.cpp} | ||
*/ | ||
|
||
#ifndef USB_INDUSTRIAL_PRODUCTS4_HH | ||
#define USB_INDUSTRIAL_PRODUCTS4_HH | ||
|
||
#include "idf/UsbDevice.hh" | ||
#include "idf/IndustrialProducts4.hh" | ||
|
||
namespace idf { | ||
|
||
/** USB IndustrialProducts joystick. Implementation of APEM HJRMCSAUYGLEA Hand Controller */ | ||
class UsbIndustrialProducts4 : public UsbDevice, public IndustrialProducts4 { | ||
|
||
public: | ||
|
||
/** constructor */ | ||
UsbIndustrialProducts4(); | ||
|
||
void decode(const std::vector<unsigned char>& data); | ||
|
||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "idf/IndustrialProducts4.hh" | ||
|
||
namespace idf { | ||
|
||
IndustrialProducts4::IndustrialProducts4() : | ||
forwardBackwardPivot(0, 1023, 512), | ||
leftRightPivot(0, 1023, 512), | ||
twist(0, 1023, 512), | ||
trigger(0, 1), | ||
grip(0,1), | ||
switchUp(0, 1), | ||
switchDown(0, 1), | ||
hatUpDownPivot(0, 1023, 512), | ||
hatLeftRightPivot(0, 1023, 512), | ||
button1(0, 1), | ||
button2(0, 1) {} | ||
|
||
const std::vector<InputLayout::Configurable>& IndustrialProducts4::getConfigurables() { | ||
static std::vector<Configurable> inputs; | ||
if (inputs.empty()) { | ||
append(InputLayout::getConfigurables(), inputs); | ||
inputs.push_back(Configurable(forwardBackwardPivot, "Forward/Backward Pivot", "forwardBackwardPivot")); | ||
inputs.push_back(Configurable(leftRightPivot, "Left/Right Pivot", "leftRightPivot")); | ||
inputs.push_back(Configurable(twist, "Twist", "twist")); | ||
inputs.push_back(Configurable(hatUpDownPivot, "Hat Up/Down Pivot", "hatUpDownPivot")); | ||
inputs.push_back(Configurable(hatLeftRightPivot, "Hat Left/Right Pivot", "hatLeftRightPivot")); | ||
} | ||
return inputs; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "idf/UsbIndustrialProducts4.hh" | ||
|
||
namespace idf { | ||
|
||
UsbIndustrialProducts4::UsbIndustrialProducts4() : | ||
UsbDevice("Industrial Products 4", 11) {} | ||
|
||
void UsbIndustrialProducts4::decode(const std::vector<unsigned char>& data) { | ||
leftRightPivot.setValue(((unsigned)data[1]) << 8 | data[0]); | ||
forwardBackwardPivot.setValue(((unsigned)data[3]) << 8 | data[2]); | ||
twist.setValue(((unsigned)data[5]) << 8 | data[4]); | ||
|
||
hatLeftRightPivot.setValue(((unsigned)data[7]) << 8 | data[6]); | ||
hatUpDownPivot.setValue(((unsigned)data[9]) << 8 | data[8]); | ||
|
||
trigger.setValue(data[10] & 1); | ||
grip.setValue(data[10] >> 1 & 1); | ||
switchUp.setValue(data[10] >> 2 & 1); | ||
switchDown.setValue(data[10] >> 3 & 1); | ||
button1.setValue(data[10] >> 4 & 1); | ||
button2.setValue(data[10] >> 5 & 1); | ||
|
||
} | ||
|
||
} |