You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
9
9
Find the most up-to-date instructions on [how to run LXs on the Duckietown manual](https://docs.duckietown.com/ente/duckietown-manual/60-learning-experiences/lx-general-procedure.html).
10
10
11
-
In this learning experience, you will learn [Braitenberg vehicles](https://en.wikipedia.org/wiki/Braitenberg_vehicle), one of the simplest possible
11
+
In this learning experience, you will learn [Braitenberg vehicles](https://en.wikipedia.org/wiki/Braitenberg_vehicle), one of the simplest possible
12
12
ways we could conceive of doing sensorimotor control.
13
13
14
14
**NOTE:** All commands below are intended to be executed from the root directory of this exercise (i.e., the directory containing this README).
@@ -135,7 +135,7 @@ dts code build -R ROBOTNAME
135
135
136
136
where ROBOTNAME can be either a real or virtual robot.
Copy file name to clipboardExpand all lines: notebooks/02-Image-Filtering/braitenberg02.ipynb
+3-38Lines changed: 3 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -98,10 +98,7 @@
98
98
"id": "2531e7ea",
99
99
"metadata": {},
100
100
"source": [
101
-
"In OpenCV, the convention is the following:\n",
102
-
"\n",
103
-
"* Hue is usually measured in degrees, 0 to 360, as shown in [this scale](../../assets/HUE.png). However OpenCV uses a scale 0 to 179 - multiply by 2 to get the actual Hue in degree. (so to get a hue of 180 you have to tell 90 to OpenCV.\n",
104
-
"* S and V are from 0 to 255."
101
+
"In OpenCV, the convention is the following:\n\n* Hue is usually measured in degrees, from 0 to 360, as shown in [this scale](../../assets/HUE.png). However OpenCV uses a scale 0 to 179 - multiply by 2 to get the actual Hue in degree. (so to get a hue of 180 you have to tell 90 to OpenCV).\n* S and V are from 0 to 255."
105
102
]
106
103
},
107
104
{
@@ -182,39 +179,7 @@
182
179
"id": "88f03111",
183
180
"metadata": {},
184
181
"source": [
185
-
"## Activity\n",
186
-
"\n",
187
-
"Your task now is to change those numbers above so that we highlight the duckies.\n",
188
-
"\n",
189
-
"\n",
190
-
"We've created a tool for you to make this easier and suggest you use the following steps:\n",
191
-
"\n",
192
-
"1. Use [this online color picker](https://pinetools.com/image-color-picker) to click around on the sample images in the `/assets/samples` directory and get familiar with what color corresponds to which HSV values. (You can use any other tool, the link is just for reference). This will set you up to narrow in on the duckie yellow more quickly. **Regardless of the color picker you use, always double-check whether it uses a different convention for HSV ranges. If it does, make sure to convert the result to the OpenCV's convention**.\n",
193
-
"\n",
194
-
"2. Use the tool [shown in this video](https://vimeo.com/534995276) to find the values interactively. It runs the code in [HSV-bound.py](../../packages/examples/HSV_bound.py) to filter a test image based on the values you choose.\n",
195
-
"\n",
196
-
" To get this interactive method running, open a terminal on your computer, **navigate to the exercise folder** (where you cloned the `duckietown/lx-braitenberg/` repo) and type:\n",
197
-
"\n",
198
-
" `dts code build -R ![ROBOTNAME]`\n",
199
-
"\n",
200
-
" to build your updated exercise on your robot called `![ROBOTNAME]` (note that it can be virtual or physical as described in the [README](../../README.md)). Then use\n",
" where the `-m` option is used if you have already started the duckiematrix and are using a virtual robot. Then finally start up the VNC desktop with \n",
205
-
"\n",
206
-
" `dts code vnc -R ![ROBOTNAME]`\n",
207
-
"\n",
208
-
" to run the HSV tool. In the terminal output you will see lines like the following (you may have to scroll up in the terminal)\n",
" Following the link will bring up the VNC desktop, where you can click on the HSV activity icon and run the tool.\n",
216
-
"\n",
217
-
"3. After you have a satisfactory result in the VNC tool, open the file [preprocessing.py](../../packages/solution/preprocessing.py), and change the values of `lower_hsv` and `upper_hsv` to the ones that you found to highlight the duckie. This will be used by your Braitenberg agent in the next notebook."
182
+
"## Activity\n\nYour task now is to change those numbers above so that we highlight the duckies.\n\n\nWe've created a tool for you to make this easier and suggest you use the following steps:\n\n1. Use [this online color picker](https://pinetools.com/image-color-picker) to click around on the sample images in the `/assets/samples` directory and get familiar with what color corresponds to which HSV values. (You can use any other tool, the link is just for reference). This will set you up to narrow in on the duckie yellow more quickly. **Regardless of the color picker you use, always double-check whether it uses a different convention for HSV ranges. If it does, make sure to convert the result to the OpenCV's convention**.\n\n2. Use the tool [shown in this video](https://vimeo.com/534995276) to find the values interactively. It runs the code in [HSV-bound.py](../../packages/examples/HSV_bound.py) to filter a test image based on the values you choose.\n\n To get this interactive method running, open a terminal on your computer, **navigate to the exercise folder** (where you cloned the `duckietown/lx-braitenberg/` repo) and type:\n\n `dts code build -R ROBOTNAME`\n\n to build your updated exercise on your robot called `ROBOTNAME` (note that it can be virtual or physical as described in the [README](../../README.md)). Then use\n\n `dts code workbench -R ROBOTNAME [-m] -L HSV`\n\n where the `-m` option is used if you have already started the duckiematrix and are using a virtual robot. Then finally start up the VNC desktop with \n\n `dts code vnc -R ROBOTNAME`\n \n to run the HSV tool. In the terminal output you will see lines like the following (you may have to scroll up in the terminal)\n\n ```\n VNC running at http://127.0.0.1:32770\n --------------------------------------------------------\n ```\n\n Following the link will bring up the VNC desktop, where you can click on the HSV activity icon and run the tool.\n\n3. After you have a satisfactory result in the VNC tool, open the file [preprocessing.py](../../packages/solution/preprocessing.py), and change the values of `lower_hsv` and `upper_hsv` to the ones that you found to highlight the duckie. This will be used by your Braitenberg agent in the next notebook."
Copy file name to clipboardExpand all lines: notebooks/03-Braitenberg/braitenberg03.ipynb
+5-18Lines changed: 5 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -31,20 +31,7 @@
31
31
"cell_type": "markdown",
32
32
"metadata": {},
33
33
"source": [
34
-
"# Implementation of Braitenberg agent\n",
35
-
"\n",
36
-
"Now we know enough about image filtering to implement our Braitenberg agent such that it will avoid duckies. You already updated the image preprocessing in the last activity to highlight duckies - now it's time to handle the sensorimotor connections in order to control our agent.\n",
37
-
"\n",
38
-
"### Setup\n",
39
-
"\n",
40
-
"We will implement an agent of the form\n",
41
-
"\n",
42
-
"```python\n",
43
-
"left_motor = const + gain * np.sum( LEFT * preprocess(image) )\n",
44
-
"right_motor = const + gain * np.sum( RIGHT * preprocess(image) )\n",
45
-
"```\n",
46
-
"\n",
47
-
"where `LEFT` and `RIGHT` are the weight matrices, while `const` and `gain` are two extra parameters for fine tuning."
34
+
"# Implementation of Braitenberg agent\n\nNow we know enough about image filtering to implement our Braitenberg agent such that it will avoid duckies. You already updated the image preprocessing in the last activity to highlight duckies - now it's time to handle the sensorimotor connections in order to control our agent.\n\n### Setup\n\nWe will implement an agent of the form\n\n```python\nleft_motor = const + gain * np.sum( LEFT * preprocess(image) )\nright_motor = const + gain * np.sum( RIGHT * preprocess(image) )\n```\n\nwhere `LEFT` and `RIGHT` are the weight matrices, while `const` and `gain` are two extra parameters for fine tuning."
"Consider the agent that we gave you as a starting point - feel free to explore with using different code in [agent.py](../../packages/braitenberg_agent/agent.py). You may need to tune the `gain` and `const` values in the `BraitenbergAgentConfig` class to fit your agent and Duckiebot. Pay attention to use a combination of `gain` and `const` values in such a way that the motor inputs fall within the range of -1 to 1, otherwise you may encounter a `ValueError`."
204
+
"Consider the agent that we gave you as a starting point - feel free to explore with using different code in [agent.py](../../packages/braitenberg_agent/agent.py). You may need to tune the `gain` and `const` values in the `BraitenbergAgentConfig` class to fit your agent and Duckiebot. Pay attention to use a combination of `gain` and `const` values in such a way that the motor inputs fall within the range of -1 to 1, otherwise you may encounter a `ValueError`."
0 commit comments