# 4. Control Methods
## 4.1 PC Control & Action Programming
### 4.1.1 PC Software Introduction
* **Preface**
JetMax PC software can control the rotation of individual servo, involve real-time image transmitted by camera, display the current coordinate, customize the action and so on.
Through PC software, we can control individual servo, control the rotation of the robotic arm and edit action group.
* **Preparation**
**1. Boot up/ Connect remotely**
Boot up JetMax and connect the computer to system desktop through No Machine. For detained instruction, you can refer to "**[1. Getting Ready->1.3 Start the JetMax](https://wiki.hiwonder.com/projects/JetMax/en/latest/docs/1_Getting_Ready.html#start-the-jetmax)**" and "**[3. AI Vision Games Lesson->3.1 Set Development Environment](https://wiki.hiwonder.com/projects/JetMax/en/latest/docs/3_AI_Vision_Games_Lesson.html#set-development-environment)**"
**2. Connect to PC software**
1) Double click
. It is recommended to use Google Chrome.
> [!NOTE]
>
> **Note: use JetMax's own browser to open the PC software. The default language is English. If you want to open a interface in Chinese, you can enter the address in other browser to open.**
2) Enter this address,192.168.149.1, in the address bar and press Enter.
3) Then click the below "**connect**" button.
* **Mode introduction**
There are two control modes in PC software, namely Remote Control and Action Set Editor. The biggest difference between them is that the Remote Control mode interface includes transmitted image area while Action Set Editor mode interface involves action editing area.
**1. Remote control mode**
**(1) Introduction**
In remote control mode, you can control the rotation of robotic arm via mouse or setting coordinate value.
**(2) Interface layout**
Click the left icon to enter the Remote Control interface.
The interface is divided into these 5 parts.
1. **Transmitted image area**
The real-time image transmitted by the camera will be displayed here.
2. **Mouse control area**
You can directly control the robotic arm to rotate with the mouse. And the function corresponding to the icon is listed below.
| Icon | Function |
| :----------------------------------------------------------: | :----------------------------------------------------------: |
|
| Click the sector and the robotic arm will rotate to the point where your mouse stops. |
|
| Drag the slider to lift and lower the robotic arm |
3. **Robotic arm control area**
The robotic arm control area is the coordinate control area. You can control its rotation by setting the value of x, y and z axis. The function for each button is as follow.
| Icon | Function |
![]() |
Decrease value of x axis JetMax will rotate horizontally to the left |
![]() |
Increase value of x axis JetMax will rotate horizontally to the right |
![]() |
Decrease value of y axis JetMax will rotate to the front |
![]() |
Increase value of y axis JetMax will rotate to the back |
![]() |
The JetMax will return to original posture |
![]() |
Increase value of z axis JetMax will be lifted |
![]() |
Decrease value of z axis JetMax will be lowered |
![]() |
Select each increasing or decreasing value |
![]() |
Display the real-time coordinate of JetMax |
| Icon | Function |
![]() |
Drag the slider to control individual servo to rotate |
![]() |
Input the rotation angle value of the servo You can click the arrow for minor adjustment (Click blank area to run the servo after adjustment) |
|
Icon |
Function |
|
|
Select the end-of-tool |
|
Buttons under suction cup mode |
|
|
|
Drag the slider to adjust the servo rotation angle |
|
|
Suction cup sucks object |
|
|
Suction cup releases object |
|
|
The current angle of the digital servo |
|
|
The state of the suction nozzle |
| Buttons under small gripper/ big gripper mode | |
|
|
The slider can be dragged to control the rotation of the gripper |
|
|
The slider can be dragged to control the gripper to open or close |
|
|
The current angle of digital servo 1 |
|
|
The current angle of digital servo 2 |
| Icon | Function |
![]() |
Serial number of the action group |
![]() |
Action running time |
![]() |
The current x, y and z axis value of the robotic arm |
![]() |
Current state of NO.1 digital servo |
![]() |
Current state of NO.2 digital servo |
![]() |
Current state of suction cup |
![]() |
Running time of one action Running time can be input directly |
![]() |
Run the current action group in loop |
![]() |
Add action group |
![]() |
Insert action group |
![]() |
Replace action group |
![]() |
Delete action group |
![]() |
Run action group |
![]() |
Run single action group |
![]() |
Stop running action group |
![]() |
Erase all the action group |
![]() |
Action group name |
![]() |
Open action group |
![]() |
Save action group |
![]() |
Create new action group |
![]() |
More setting |
. It is recommended to use Google Chrome.
2) Enter this address,**192.168.149.1**, in the address bar and press Enter.
3) Then click the below "**connect**" button.
* **Call action group**
1) After successfully connecting to the PC software, click "**Action Set Editor**".
2) Click the "▼" button shown in the below picture.
3) Select action group. Here we select "**wave**".
4) Then click "**Open**" and you can check the individual action in the action list.
5) Click "**Run**" button to run the current action group.
### 4.1.3 Edit Action
* **Final goal**
Edit an action group to suck the front block to the left side.
* **Preparation**
**1. Boot up/ Connect remotely**
Boot up JetMax and connect it to system desktop through No Machine. For detained instruction, you can refer to "**[1. Getting Ready->1.3 Start the JetMax](https://wiki.hiwonder.com/projects/JetMax/en/latest/docs/1_Getting_Ready.html#start-the-jetmax)**" and "**[3.AI Vision Games Lesson->3.1 Set Development Environment](https://wiki.hiwonder.com/projects/JetMax/en/latest/docs/3_AI_Vision_Games_Lesson.html#set-development-environment)**".
**2. Connect to PC software**
1. Double click
. It is recommended to use Google Chrome.
2. Enter this address,**192.168.149.1**, in the address bar and press Enter.
3. Then click the below "connect" button.
* **Edit action group**
There are two edit modes, respectively individual servo edit mode and coordinate edit mode. The essence of these modes is to convert the angle to coordinate.
You can choose one of them or adopt them alternately. In this lesson, the operation is mainly based on individual servo edit mode, but also involves coordinate edit mode.
**1. Edit action**
1. Click "**Action Set Editor**" icon to enter the editing interface.
2. Click "**New**" to create a new action group.
3. Name the action group and click "**OK**". Here, we name it as **carry**.
4. Firstly, click "**Reset**" in the robotic arm control area to make JetMax return to initial posture.
5. Then click "**Add**" to set the initial posture as the first action.
6. Drag ID3 slider to set the value to 421. The robotic arm will be stretched forward to the block. And the real-time coordinate will be displayed in robotic arm control area.
7. Set the duration as 1s, then click "**Add**" to add this action to the action list.
8. In order to make the action group more coherent, we need to add a transitional action after the new added action. Select No.2 action and set the duration as 0.3s. Pay attention here the duration of the transitional action should not be too long. Then click "**Add**".
9. Next, lower the robotic arm. Drag ID3 slider to set the value to 654.
10. Set duration as 1s and click "**Add**" to this action to the action list.
11. Add another transitional action and set the duration time as 0.3s, then click "**Add**". Now, there are 5 actions in the action list.
12. Adjust "**Y-**"to make the suction cup above the center of the block.
13. Set the duration as 1s and click "**Add**".
14. Add a transitional action again. Set the duration as 0.3s, then click "**Add**" to create No.7 action.
15. Continue, lower the robotic arm to make suction cup fit the center of the block. Adjust "Z-"till the suction cup completely fits the block, then set the duration as 1S and click "**Add**".
16. Then set the duration as 1s and click "**Add**" to create No.8 action.
17. Add a transitional action. Set the duration as 0.3s and click "**Add**".
18. Turn on the air pump to make the suction cup suck the block. Click the "**Suck**" button in the end control area. Then set the duration as 0.3s and click "**Add**" to get No.10 action.
19. Having sucked the block, the robotic arm should be lifted. Drag ID3 slider to set the value to 575.
20. Then set the duration time as 1s and click "**Add**".
21. Add a transitional action. Set the duration as 0.3s to add No.12 action.
22. Control the robotic arm to rotate to the left side. Drag ID1 slider to set the value to 751.
23. Set the duration as 1s and click "**Add**".
24. Then add a transitional action. Set the duration as 0.3s, then click "**Add**". Now, No.13 and No.14 action are created.
25. Make the robotic arm rotate to the left side and release the block. Click "**Z-**" to make the block close to the ground.
26. Then set the duration as 1s and click "**Add**".
27. Add a transitional action and set the duration as 0.3s
28. At last, click "**Release**" to stop the air pump. Then the block will be placed to the left side.
29. Set the duration as 1s and click "**Add**" to form No.17 action.
30. After that, make the robotic arm back to the initial posture. Select the first action, then click "**Step**".
31. Next, set the duration as 1.5s, and click "**Add**" to get No.18 action.
At this point, the whole action group is completed. The integral action list is as follow.
| No. | Duration | X | Y | Z | PWM1 | PWM1 | Suction cup |
| :--: | :------: | :---: | :----: | :---: | :--: | :--: | :---------: |
| 1 | 1.000 | 0.0 | -162.9 | 212.8 | 90 | 90 | 0 |
| 2 | 1.000 | -0.0 | -204.7 | 205.8 | 90 | 90 | 0 |
| 3 | 0.300 | -0.0 | -204.7 | 205.8 | 90 | 90 | 0 |
| 4 | 1.000 | -0.0 | -176.9 | 122.5 | 90 | 90 | 0 |
| 5 | 0.300 | -0.0 | -176.9 | 122.5 | 90 | 90 | 0 |
| 6 | 1.000 | -0.0 | -192.9 | 122.5 | 90 | 90 | 0 |
| 7 | 0.300 | -0.0 | -192.9 | 122.5 | 90 | 90 | 0 |
| 8 | 1.000 | -0.0 | -192.9 | 86.5 | 90 | 90 | 0 |
| 9 | 0.300 | -0.0 | -192.9 | 86.5 | 90 | 90 | 1 |
| 10 | 0.300 | -0.0 | -192.9 | 145.7 | 90 | 90 | 1 |
| 11 | 1.000 | -0.0 | -231.1 | 145.7 | 90 | 90 | 1 |
| 12 | 0.300 | -0.0 | -231.1 | 145.7 | 90 | 90 | 1 |
| 13 | 1.000 | 200.6 | -114.7 | 145.7 | 90 | 90 | 1 |
| 14 | 0.300 | 200.6 | -114.7 | 145.7 | 90 | 90 | 1 |
| 15 | 1.000 | 200.6 | -114.7 | 109.7 | 90 | 90 | 1 |
| 16 | 0.300 | 200.6 | -114.7 | 109.7 | 90 | 90 | 1 |
| 17 | 1.000 | 200.6 | -114.7 | 109.7 | 90 | 90 | 1 |
| 18 | 1.500 | 0.0 | -162.9 | 212.8 | 90 | 90 | 0 |
**2. Save action group**
In order to facilitate later debugging and management, you can save this action group. Click "**Save**" to save it.
### 4.1.4 Import and Export Action
* **Preparation**
Boot up JetMax and connect the computer to system desktop through No Machine. For detained instruction, you can refer to "**[1. Getting Ready->1.3 Start the JetMax](https://wiki.hiwonder.com/projects/JetMax/en/latest/docs/1_Getting_Ready.html#start-the-jetmax)**" and "**[3.AI Vision Games Lesson->3.1 Set Development Environment](https://wiki.hiwonder.com/projects/JetMax/en/latest/docs/3_AI_Vision_Games_Lesson.html#set-development-environment)**".
* **Export action**
**In this lesson, we will take importing and exporting "wave" action group file for example.**
1) Click system desktop folder icon
.
2) Find the "**wave**" file as follow.
3) You can directly drag the action file to the computer desktop. Then the action file is exported.
* **Import action**
1) Drag the "**wave**" action file to the system desktop.
2) Then paste it into the following path.
3) Double click
. It is recommended to use Google Chrome.
4) Enter this address, **192.168.149.1**, in the address bar and press Enter.
5) Then click the following "**Connect**" icon to connect your computer to the PC software.
6) Click "**Action Set Editor**" icon to enter editing interface.
7) Click the arrow button. When "**wave**" occur, it means the action file is successfully imported.
## 4.2 Wireless Handle Control
### 4.2.1 Preparation
Step 1: insert the handle receiver to any USB port on Jetson Nano.
> [!NOTE]
>
> **Note: please insert the handle receiver before booting up the device.**
Step 2: you need to prepare two AAA batteries. Remove the back shell of the handle and insert the batteries into the battery slot. Please don't invert the positive and negative pole.
### 4.2.2 Device connection
Step 1: switch on the JetMax
Step 2: turn on the handle. At this time, the two LED lights on it will flash at the same time.
Step 3: wait for a few seconds. The robotic arm will automatically match with the handle. After successful match, the green LED light will light up.
If the handle does not connect to the robotic arm within 30 seconds after turning on, or there is no operation on the handle within 5 minutes after connecting, the handle will enter the sleep mode. If you want to wake it up, you can press the "**START**" key.
### 4.2.3 Mode introduction
There are two control modes, namely coordinate mode and individual servo mode. The handle will be in individual servo mode by default after connection.
Individual servo mode: by pressing the keys on the handle, you can control the robotic arm to rotate forward and inversely.
Coordinate mode: by pressing the keys on the handle, you can control the robotic arm to follow the trajectory of the x,y and z axis to move.
Way to switch the mode: you can press "**SELECT**" key. When the handle emit sound, it means you have successfully switched the mode. When the handle sound once, the handle is switched to coordinate mode. When sound twice, it is switched to individual servo mode.
### 4.2.4 Key Introduction
**The following table is about the key description in coordinate mode. Face to the front of the robot.**
| Key | Function |
| :---: | :--------------------------------------: |
| START | The robotic arm returns to initial state |
| L1 | JetMax moves forward |
| L2 | JetMax moves downward |
| **↑** | JetMax moves forward |
| **↓** | JetMax moves backward |
| **←** | JetMax moves to the left |
| **→** | JetMax moves to the right |
| **◻** | Suction cup rotate clockwise |
| **△** | Suction cup rotate counterclockwise |
| **○** | Air pump starts pumping |
| **×** | Air pump stop pumping |
**The following table is about the key description in coordinate mode. Face to the front of the robot.**
|
Key |
Function |
Servo |
|
START |
The robotic arm returns to initial state |
— |
|
L2 |
JetMax moves downward |
No.3 servo |
|
L1 |
JetMax moves upward |
|
|
↑ |
JetMax moves forward |
No.2 servo |
|
↓ |
JetMax moves backward |
|
|
← |
JetMax moves to the left |
No.1 servo |
|
→ |
JetMax moves to the right |
|
|
🗹 |
Suction cup rotate clockwise |
PWM 9g servo |
|
△ |
Suction cup rotate counterclockwise |
|
|
○ |
Air pump starts pumping |
— |
|
× |
Air pump stops pumping |
— |
to open the terminal.
2. Enter command "**rosrun jetmax_demos mouse_control.py"** and press Enter to start the mouse control mode.
```bash
rosrun jetmax_demos mouse_control.py
```
3) If you want to exit this game, directly click the "**x**" button at upper left corner.
### 4.3.3 Operation description
The mouse control interface is as follow.
> [!NOTE]
>
> * **You must move your mouse within this white area, otherwise it will fail to control the robotic arm.**
>
> * **This mouse control game is in coordinate mode by default.**
The instruction description is as follow:
| **Instruction** | **Reaction of the robotic arm** |
| :---------------------------------------: | :--------------------------------------------------: |
| Left click+ move the mouse left and right | JetMax follows x axis to rotate right and left |
| Left click+ move the mouse up and down | JetMax follows y axis to rotate forward and backward |
| Scroll the mouse up and down | JetMax follows z axis to rotate up and down |
| Right click | The air pump starts pumping |