<jupyter_start><jupyter_text>Welcome to Your First Ride with the GoPiGo3 Your first step is to load the libraries that will let you control the robot.Select the following cell, and press Shift-Enter to run it.<jupyter_code>from ipywidgets import widgets, Layout
import easygopigo3 as easy

my_gpg3 = easy.EasyGoPiGo3()<jupyter_output><empty_output><jupyter_text>The next cell will display buttons that will let you drive the GoPiGo3 around. Select the cell and press Shift-Enter. Then press the buttons to command the robot.<jupyter_code>darkgrey = '#888888'
items_layout = Layout(flex='1 1 auto',
                      width='auto')     # override the default width of the button to 'auto' to let the button grow

box_layout = Layout(display='flex',
                    flex_flow='column',
                    align_items='stretch',
                    border='solid',
                    width='30%')

def on_forward_clicked(b):
    my_gpg3.forward()
    
def on_backward_clicked(b):
    my_gpg3.backward()
    
def on_stop_clicked(b):
    my_gpg3.stop()
    
def on_left_clicked(b):
    my_gpg3.left()
    
def on_right_clicked(b):
    my_gpg3.right()
    
buttons = []
descriptions = ["Go Forward", "Left", "STOP", "Right" , "Go Backward"]
callbacks = [on_forward_clicked, on_left_clicked, on_stop_clicked, on_right_clicked, on_backward_clicked ]
for i in range(5):
    buttons.append(widgets.Button(description=descriptions[i], layout=items_layout))
    buttons[i].style.button_color = darkgrey
    buttons[i].on_click(callbacks[i])

buttons[2].style.button_color = 'red'  # stop button

mid_row = widgets.HBox([buttons[1], buttons[2], buttons[3] ])
display(widgets.VBox([buttons[0], mid_row, buttons[4]], layout=box_layout))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10852272727272727, 'fraction_numerical': 0.01534090909090909, 'mean_word_length': 3.988668555240793, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '214506', 'license': 'MIT', 'n_tokens_mistral': 597, 'n_tokens_neox': 575, 'n_words': 146, 'path': 'Chapter2_Unit_Tests/lessons_GettingStarted/First Ride Around.ipynb', 'repo_name': 'manelpuig/Hands-On-ROS-for-Robotics-Programming', 'size': '1760'}