## 5 Simulations and Experimental Results  
In this section, preliminary experimental simulations are considered with the aim of exploiting and validating the design features of _Serpens_. In particular, the possibility of implementing different characteristics of _Serpens_ through the built-in capabilities of the _Universal Robotic Description Format_ (URDF) [35] language and the _Gazebo_ simulator is considered. In addition, the possibility of replicating the design of the physical model by separating the motor-side and spring-side dynamics in a simulated environment is studied. To simulate the motor-side and spring-side dynamics, each joint of _Serpens_ is modelled as a two-joint structure, as in the physical model. The generic configuration of links and joints for the simulated version of _Serpens_ is shown in Figure 13. The motor-side dynamics are simulated with a regular revolute joint that is connected from the link to a shaft. The shaft is connected to the next link through a joint by simulating the spring dynamics. Exploiting the fact that the URDF is converted to _Simulation Description Format_ (SDF) when imported to Gazebo, it is possible to use the SDF joint parameter _springStiffness_ to simulate the spring dynamics. The capabilities of _macros_ in the Extensible Markup Language (XML) Macros (Xacro) language is consistently used to provide an easily configurable setup of links and joints in the simulated environment, thus allowing the implementation of _pitch-yaw, pitch-pitch_ and _yaw-yaw_ configurations. An initial experiment includes the simulated environment and one physical joint module containing the _OpenCM 9.04_ and the _XM430W-210T_ servo motor. The _OpenCM 9.04_ micro-controller is connected to and powered by an external computer running the proposed ROS-based architecture. The communication is achieved by using the _rosserial_ package [36]. The _XM430W-210T_ actuator is connected through the TTL port of the micro-controller, while the power to the actuator is provided by an external 12V power-supply. The _OpenCM 9.04_ micro-controller runs a node with a subscriber for set-points and a publisher for the actuator feedback. The feedback is collected from the control table of the _XM430W-210T_[28] for each execution loop. The controller-node in the external computer intercepts the feedback through a subscriber and continuously publishes the desired position (\(\theta_{d}\)) governed by the following equation:  
Figure 13: The generic configuration of links and joints in Xacro/URDF. Joints are shown as ellipses, while links are depicted as boxes. \[\theta_{d}=Asin(2\pi(t+n\xi)), \tag{1}\]  
where \(t\) is the time of the ROS-clock, \(n\) is the index of the joint to be controlled, and \(\xi\) is the spatial frequency. The results of this experiment are depicted in Figure 14, where \(\theta_{d}\) denotes the desired position of the actuator, \(\theta_{real}\) is the actual position of the XM430W-210, and \(\theta_{sim}\) is the actual position of the simulated joint in Gazebo. The findings of the experiments show a slight delay in terms of the feedback from the _XM430W-210T_ actuator. This is to be expected, as the _OpenCM 9.04_ subscribes and publishes the set-point, waits for a return feedback signal from the _XM430W-210T_ and publishes the feedback intercepted by the controller-node. To characterise the entity of this delay, time measurements were collected during the proposed experiment. In particular, the delay between the instant when data are sent from the controller-node and the time when the corresponding feedback is received was monitored over time. The results are shown in Figure 15. The maximum value is 0.0280 s, the minimum value is 0.0080 s, and the estimated average delay is 0.0152 s.  
Figure 14: Matlab-plot showing the setpoint \(\theta_{d}\), the joint position feedback from simulation \(\theta_{sim}\), and the feedback from a _XM430W-210T_ actuator \(\theta_{real}\).