.. _example: Example ======= This examples builds on the Oncilla API Level 0, which is the lowest Oncilla interface level. The example was written for the Oncilla Simulation, but should work exactly the same later on the real hardware platform. Simple Sine Movement -------------------- To show basic movement using the Oncilla interface, we provide a simple example performing a sine-movement on the Oncilla joint in position control, to generate a simple walking movement. The source code below shows the example implementation. To perform the simple movement the following basic steps are done: #. The actual robot object is instantiated (line 25). This connect either to the simulation backend or the real hardware. #. We then grab the Synchronizer so that in the case of Simulation we can control the actual stepping of the Simulator by our own (line 29). #. We take the joints we want to use for the movement, in this case the Oncilla joints :ref:`L1 and L2 ` and give them meaningful names. #. To perform the actual movement we generate the desired JointAngles and set them as new position in the joints (e.g. lines 62-63). #. After we set new commands, we perform one simulation step (line 75) to let the commands have effect and to get current sensor values. #. To not work with the real-world time, but with the simulated time, we integrate a time variable with the processed time reported by the simulation (line 57). .. literalinclude:: ../../examples/SimpleSineMovement.cpp :language: c :emphasize-lines: 25,29,31-39,62-63,75,57 :linenos: ...