filmov
tv
Lesson 30 JetBot Teleop Python Code Explanation
![preview_player](https://i.ytimg.com/vi/RzlPZkix9zk/maxresdefault.jpg)
Показать описание
Lesson 30: JetBot Teleop Python Code Explanation
Lesson 30A:
controller = widgets.Controller(index=1) # replace with index of your controller
display(controller)
In this section of code we are creating an instance of your PS3 Controller widget in order to drive the JetBot motors in different directions and speed by using ipywidgets
ipywidgets, also known as jupyter-widgets or simply widgets, are interactive HTML widgets for Jupyter notebooks and the IPython kernel. Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data. Learning becomes an immersive, fun experience
Once you run the code and press any buttons on your PS3, you can see the controller like soft widgets appearing on the notebook browser.
Lesson 30B:
from jetbot import Robot
import traitlets
robot = Robot()
Here we are importing a Python library called Trailets which is nothing but a framework that lets Python classes have attributes with type checking, dynamically calculated default values, and 'on change' callbacks. The package also includes a mechanism to use traitlets for configuration, loading values from files or from command line arguments.
In case of JetBot, traitlets allows us to attach the control mechanism to JetBot motors and then we are using a Python Dlink function for both left and right motors to be controlled
Lesson 30C:
image = widgets.Image(format='jpeg', width=300, height=300)
display(image)
In this code we are using the widgets from ipywidgets library to build a camera video pipe, There are many widgets distributed with ipywidgets that are designed to display numeric values. Widgets exist for displaying integers and floats, both bounded and unbounded within a image.
Lesson 30D:
from jetbot import Camera
Here we are importing a Python library called Camera. This library package provides a pure Python interface to the Raspberry Pi camera module for Python 3.2 and above version. In JetBot kit we are using Raspberry Pi CSI camera which needs to be detected using this library. In this particular code we are creating the camera instance and then we set the call function to call the instance method which will create a new camera
Lesson 30E:
from jetbot import bgr8_to_jpeg
In this Python code we are converting the blue green red frame captures into jpeg image format using the Python inbuilt library and attaching that to traitlet widget link
More Detailed Explanation and Steps are documented in CodingScientist Manual :
Reach out to me for 1 o 1 coaching, manuals and source code at the following contact details :
WhatsApp: +91-99725-77735
Lesson 30A:
controller = widgets.Controller(index=1) # replace with index of your controller
display(controller)
In this section of code we are creating an instance of your PS3 Controller widget in order to drive the JetBot motors in different directions and speed by using ipywidgets
ipywidgets, also known as jupyter-widgets or simply widgets, are interactive HTML widgets for Jupyter notebooks and the IPython kernel. Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data. Learning becomes an immersive, fun experience
Once you run the code and press any buttons on your PS3, you can see the controller like soft widgets appearing on the notebook browser.
Lesson 30B:
from jetbot import Robot
import traitlets
robot = Robot()
Here we are importing a Python library called Trailets which is nothing but a framework that lets Python classes have attributes with type checking, dynamically calculated default values, and 'on change' callbacks. The package also includes a mechanism to use traitlets for configuration, loading values from files or from command line arguments.
In case of JetBot, traitlets allows us to attach the control mechanism to JetBot motors and then we are using a Python Dlink function for both left and right motors to be controlled
Lesson 30C:
image = widgets.Image(format='jpeg', width=300, height=300)
display(image)
In this code we are using the widgets from ipywidgets library to build a camera video pipe, There are many widgets distributed with ipywidgets that are designed to display numeric values. Widgets exist for displaying integers and floats, both bounded and unbounded within a image.
Lesson 30D:
from jetbot import Camera
Here we are importing a Python library called Camera. This library package provides a pure Python interface to the Raspberry Pi camera module for Python 3.2 and above version. In JetBot kit we are using Raspberry Pi CSI camera which needs to be detected using this library. In this particular code we are creating the camera instance and then we set the call function to call the instance method which will create a new camera
Lesson 30E:
from jetbot import bgr8_to_jpeg
In this Python code we are converting the blue green red frame captures into jpeg image format using the Python inbuilt library and attaching that to traitlet widget link
More Detailed Explanation and Steps are documented in CodingScientist Manual :
Reach out to me for 1 o 1 coaching, manuals and source code at the following contact details :
WhatsApp: +91-99725-77735
Комментарии