

add readme
@008090ceaf8dff909255da9382844270e8b827e4
--- README.md
+++ README.md
... | ... | @@ -1,2 +1,61 @@ |
1 | 1 |
# PlayStation-JoyInterface-ROS2 |
2 |
-PlayStation Joy Controller Interface Package for ROS2 |
|
2 |
+PlayStation Joy Controller Interface Package for ROS2. |
|
3 |
+ |
|
4 |
+ |
|
5 |
+## Supported controllers |
|
6 |
+ |
|
7 |
+| Status | Hardware Name | |
|
8 |
+| ------ | ------------- | |
|
9 |
+| ⬜️ | `DualShock3` | |
|
10 |
+| ⬜️ | `DualShock4` | |
|
11 |
+| ✅ | `Dualsense` | |
|
12 |
+ |
|
13 |
+ |
|
14 |
+## How to use the interface library |
|
15 |
+1. Initialize controller interface with the specific hardware type. |
|
16 |
+```cpp |
|
17 |
+// Initialize Interface |
|
18 |
+const std::string hw_type = "Dualsense"; |
|
19 |
+ps_interface = |
|
20 |
+ std::make_unique<p9n_interface::PlayStationInterface>(hw_type); |
|
21 |
+``` |
|
22 |
+ |
|
23 |
+2. Set `sensor_msg::msg::joy` to interface. Then you can access any button state via the interface. |
|
24 |
+```cpp |
|
25 |
+void Example::onJoyCallback(sensor_msgs::msg::Joy::ConstSharedPtr joy_msg) { |
|
26 |
+ ps_interface->setJoyMsg(joy_msg); // set joy message to interface |
|
27 |
+ |
|
28 |
+ // When Circle Button Pressed.. |
|
29 |
+ if(ps_interface->pressedCircle()) { |
|
30 |
+ // You can hook action here |
|
31 |
+... |
|
32 |
+``` |
|
33 |
+ |
|
34 |
+## Buttons and Interface functions. |
|
35 |
+ |
|
36 |
+| Target | Type | Function Name | Description | |
|
37 |
+| --------------- | ------- | --------------------- | ----------------------------------------------------------------- | |
|
38 |
+| Any | `bool` | `pressedAny();` | Return `true` when pressed | |
|
39 |
+| □ | `bool` | `pressedSquare();` | | |
|
40 |
+| ○ | `bool` | `pressedCircle();` | | |
|
41 |
+| □ | `bool` | `pressedTriangle();` | | |
|
42 |
+| ☓ | `bool` | `pressedCross();` | | |
|
43 |
+| L1 | `bool` | `pressedL1();` | | |
|
44 |
+| R1 | `bool` | `pressedR1();` | | |
|
45 |
+| R2 | `bool` | `pressedR2();` | `pressedR2Analog()` also returns the button status with `float` | |
|
46 |
+| L2 | `bool` | `pressedL2();` | `pressedL2Analog()` also returns the button status with `float` | |
|
47 |
+| Select | `bool` | `pressedSelect();` | | |
|
48 |
+| Start | `bool` | `pressedStart();` | | |
|
49 |
+| PS | `bool` | `pressedPS();` | | |
|
50 |
+| DPad ↑ | `bool` | `pressedDPadUp();` | `pressedDPadY()` also returns the button status with `float` | |
|
51 |
+| DPad ↓ | `bool` | `pressedDPadDown();` | `pressedDPadY()` also returns the button status with `float` | |
|
52 |
+| DPad ← | `bool` | `pressedDPadLeft();` | `pressedDPadX()` also returns the button status with `float` | |
|
53 |
+| DPad → | `bool` | `pressedDPadRight();` | `pressedDPadX()` also returns the button status with `float` | |
|
54 |
+| DPad ← → | `float` | `pressedDPadX();` | `-1.0` : Right, `1.0` : Left | |
|
55 |
+| DPad ↑ ↓ | `float` | `pressedDPadY();` | `-1.0` : Down, `1.0` : Up | |
|
56 |
+| Left Stick ← → | `float` | `tiltedStickLX();` | `-1.0` : Right, `1.0` : Left | |
|
57 |
+| Left Stick ↑ ↓ | `float` | tiltedStickLY();` | `-1.0` : Down, `1.0` : Up | |
|
58 |
+| Right Stick ← → | `float` | `tiltedStickRX();` | `-1.0` : Right, `1.0` : Left | |
|
59 |
+| Right Stick ↑ ↓ | `float` | `tiltedStickRY();` | `-1.0` : Down, `1.0` : Up | |
|
60 |
+| R2 | `float` | `pressedR2Analog();` | `-1.0` : Pressed, `1.0` : Not pressed | |
|
61 |
+| L2 | `float` | `pressedL2Analog();` | `-1.0` : Pressed, `1.0` : Not pressed |(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?