<jupyter_start><jupyter_text>Motion FunctionsIn this notebook you will learn how use Python functions for moving the robot in your programs.First, the initialization step needs to be executed.<jupyter_code># click on this cell and press Shift+Enter
import packages.initialization
import pioneer3dx as p3dx
p3dx.init()<jupyter_output><empty_output><jupyter_text>FunctionsThere are three functions for controlling the motion of the robot:* `p3dx.move(ls,rs)`* `p3dx.stop()`* `p3dx.sleep(t)`The main motion function is:```pythonp3dx.move(ls, rs)```where```   ls : left wheel speed (rad/s)   rs : right wheel speed (rad/s)```The function sets the speeds of the wheels, and the robot moves until blocked by an obstacle, or a new speed is set, or it is stopped with the function: ```pythonp3dx.stop()```For controlling the amount of time that the robot moves, there is the function:```pythonp3dx.sleep(t)```where `t` is the number of seconds. During that pause, the program sleeps but the robot keeps moving with the last speed set.  ExampleUse the code below for moving the robot. Feel free to explore with different speed and time values.<jupyter_code># Move forward
p3dx.move(2.5,2.5)
p3dx.sleep(1)
p3dx.stop()
# Move backward
p3dx.move(-2.5,-2.5)
p3dx.sleep(1)
p3dx.stop()
# Turn left
p3dx.move(-2.5,2.5)
p3dx.sleep(1)
p3dx.stop()
# Turn Right
p3dx.move(2.5,-2.5)
p3dx.sleep(1)
p3dx.stop()<jupyter_output><empty_output><jupyter_text>You can also copy and paste the functions several times with different values for a composition of motions:<jupyter_code># Your own wonderful motion sequence<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10444993819530285, 'fraction_numerical': 0.02533992583436341, 'mean_word_length': 5.690082644628099, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '54619', 'license': 'MIT', 'n_tokens_mistral': 538, 'n_tokens_neox': 523, 'n_words': 192, 'path': 'Motion Functions.ipynb', 'repo_name': 'ecervera/UJI_AMR', 'size': '1618'}