# Controlling Industrial Robotic Arms Using Gyroscopic and Gesture Inputs from a Smartwatch
## 5 Experimental Configuration
The processed data are then handled by a Python script, which performs further smoothing, mapping gestures to robotic commands, and managing system-level control logic. This Python layer serves as the central interface for robot execution and communication. Next, two transmission paths are established:  
* One towards the xArm robot, where real-time motion commands are executed using Python APIs. * One towards the ThingWorx platform, which receives sensor streams and robot states via REST API, enabling cloud-based monitoring and digital twin visualization. This visual flow summarizes the signal path from wearable sensor acquisition to final actuation and cloud monitoring. Each layer in the system--sensing, processing, command generation, execution, and visualization--plays a critical role in enabling an intuitive, real-time, and traceable control loop between the human operator and the robotic system. The integration of ThingWorx ensures transparency and robustness in both development and industrial deployment contexts. The connection to the robot is established using the UFactory xArm libraries. Data transmission to ThingWorx begins upon program initialization, during which the system performs calibration and starts a separate thread to continuously stream the robot's current positional data and the smartwatch's sensor readings. This real-time data flow enables the live monitoring and verification of system behavior. The connection to ThingWorx is implemented via a REST API. Figure 8: Sensor processing and communication flow for the smartwatch-based robotic control system. The IMU data collected by the smartwatch is preprocessed and interpreted by a gesture recognition engine, which generates commands sent to the robotic arm. Feedback and monitoring are managed via the ThingWorx IoT platform. APIs (Application Programming Interfaces) are essential for the interaction between software and hardware, allowing the exchange of data and commands between different components of the system. In our project, we use two main APIs:  
* xArm API--for controlling the robotic arm. * ThingWorx API--for real-time communication and monitoring between the local system and the cloud platform, allowing sensor and robot data to be sent, visualized, and monitored remotely. For controlling the robotic arm, we use the xArmAPI to interact with the xArm robotic arm. This API allows the initialization, control, and monitoring of the robotic arm's status. This function presented in Algorithm 2, processes incoming sensor data from the smartwatch. It performs filtering, checks the activation status, ensures calibration is applied, and updates the robot's position accordingly. The function enables real-time data-driven control based on the selected mode (position or orientation). ```
1. def on_sensors(self, sensor_frame):
2. \"\"\"Process sensor data updates from the watch.\"\"\"
3. # Apply low-pass filter to smooth sensor data
4. self_apply_smoothing_filter(sensor_frame)
5. # Skip processing if not active
6. if not self.active:
7. return
8. # Initialize reference on first activation
9. if self.reference_orientation is None:
10. self_calibrate()
11. return
12. # Calculate time delta for integration
13. current_time = time.time()
14. dt = current_time-self.last_update_time
15. self.last_update_time = current_time
16. # Process position based on current mode
17. if self.mode == ControlMode.POSITION:
18. self_update_position_from_motion(dt)
19. elif self.mode == ControlMode.ORIENTATION:
20. self_update_position_from_orientation()
21. # GESTURE mode only responds to gestures, not sensor updates
22. # Only send position update if enough time has passed and position changed significantly
23. self_update_arm_position()
```  
**Algorithm 2**Sensor Frame Processing.