Code Samples, API & Exercises

Copy-ready Python snippets for beginners (kid_api in English & Czech) through advanced Cartesian IK, tactile skin sensors, and custom YAML scenes.
kid_api (EN & CZ) Cartesian IK Tactile Skin Custom YAML Exercises 1–5

kid_api Bilingual Command Reference

Every high-level function works identically inside the standalone pyCub Studio binary (Mode 3 & Mode 2) as well as standalone Python scripts. Czech aliases map directly to the exact same functions:
English Function Czech Alias (Čeština) Action / Behavior
wave("right") / left_wave() zamávej("pravá") / zamávej_levou() Perform a friendly wave gesture with left or right arm
both_arms_up() / both_arms_down() zvedni_obě_ruce() / spusť_obě_ruce() Raise or lower both arms to preset poses
shoulder_up("left", 15) zvedni_rameno("levá", 15) Lift shoulder relative to current angle (degrees)
shoulder_down("right", 15) spusť_rameno("pravá", 15) Lower shoulder relative to current angle (degrees)
bend_elbow("right", 20) ohni_loket("pravá", 20) Flex the elbow by the given number of degrees
look_up(15) / look_down(15) / turn_head(20) podívej_se_nahoru(15) / podívej_se_dolů(15) Pitch or pan the iCub head in degrees
bend_forward(10) / turn_body(15) předkloň_se(10) / otoč_trup(15) Move the torso pitch or yaw joint
wait(0.5) / reset_pose() / stop() počkej(0.5) / obnov_polohu() / zastav() Pause cleanly while stepping physics, reset, or halt joints
ball_touched() / ball_distance() / ball_hits() dotkl_se_míčku() / vzdálenost_míčku() / počet_zásahů() Read live ball telemetry (cm, hit boolean, counter)
skin_touched() dotyk_kůže() Check whether any enabled tactile skin taxel is active
icub_pybullet/examples/skin_test.py Tactile Skin
from icub_pybullet.pycub import pyCub

def main():
    # skin_test.yaml spawns balls above iCub and visualizes active taxels in green
    client = pyCub(config="skin_test.yaml")

    while client.is_alive():
        client.update_simulation(None)

if __name__ == "__main__":
    main()

Course Exercises (1–5)

Progressive assignments ready to unpack inside Studio Mode 4, complete with README instructions and an automated Exercise Tester:
Exercise 1 Joint & Cartesian Motion

Push the Ball

Get acquainted with pyCub simulation loops, joint/Cartesian motion, and goal tolerances.

exercises/exercise_1/
Exercise 2 IK & Collision Checks

Workspace & Reachability

Plan collision-free reaching movements with torso + arm coordination.

exercises/exercise_2/
Exercise 3 Computer Vision & Depth

Vision with Eye Cameras

Read stereo l_eye / r_eye RGB and depth buffers to locate scene objects.

exercises/exercise_3/
Exercise 4 Tactile Feedback Loops

Tactile Skin & Reactive Control

Use artificial skin ray-casting activations to detect contact and react safely.

exercises/exercise_4/
Exercise 5 Integrated Humanoid Task

Autonomous Manipulation Pipeline

Combine visual perception, Cartesian control, and contact sensing in a full task.

exercises/exercise_5/
exercises.zip
Read Online Handbook