===================================== Dancing With Music! ===================================== .. raw:: html

Follow along: Robot Arm Dancing with Music

The program launching process along with parameter settings are all simplified and set up on the Jupyter Notebook Environment.
(The Jetson Board used for these examples are => Jetson Nano)
.. raw:: html
- 05_09_music_dance.ipynb - | Running the cell code | `Ctrl + Enter` - To control the robot arm from code, don't forget to shut down the docker container. See `here `_. .. thumbnail:: /_images/arm_dance/arm_dance1.png - Robot arm dance example with an exciting music. - Load Arm_Lib module and register the robot arm as an object. .. code-block:: python import os import time from Arm_Lib import Arm_Device # Register robot arm object Arm = Arm_Device() time.sleep(.1) - Move servo to initial position. .. code-block:: python # Move servo to initial position. Arm.Arm_serial_servo_write6(0, 90, 0, 180, 90, 90, 2000) - Play the music and the dance at the same time. .. code-block:: python os.system('rostopic pub -1 /play_specific std_msgs/String "data: \'/root/scripts/sensor/arm_sounds/music_cari.mp3\'"') # Servo range : 0~180 Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1600) time.sleep(1.61) Arm.Arm_serial_servo_write6(180, 90, 0, 180, 90, 90, 1600) time.sleep(1.61) Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1600) time.sleep(1.61) Arm.Arm_serial_servo_write6(0, 90, 0, 180, 90, 90, 1600) time.sleep(1.61) Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1600) time.sleep(1.61) Arm.Arm_serial_servo_write6(180, 90, 0, 180, 90, 90, 1600) time.sleep(1.61) Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1600) time.sleep(1.61) Arm.Arm_serial_servo_write6(90, 90, 0, 90, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(0, 90, 0, 180, 0, 180, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(180, 90, 0, 180, 180, 180, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(0, 90, 0, 180, 0, 180, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(180, 90, 0, 180, 180, 180, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(180, 90, 0, 180, 180, 180, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(0, 90, 0, 180, 0, 180, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 180, 90, 90, 600) time.sleep(0.82) Arm.Arm_serial_servo_write6(90, 90, 0, 90, 90, 90, 1500) time.sleep(1.5) Arm.Arm_serial_servo_write6(90, 90, 0, 90, 90, 180, 500) time.sleep(1) os.system('rostopic pub -1 /play_specific std_msgs/String "data: \'stop\'"')