WEBVTT

00:00.200 --> 00:07.480
All the code we will develop in this course is available on GitHub using the link provided in the resources

00:07.480 --> 00:08.400
of this lesson.

00:09.080 --> 00:13.280
As you can see, this repository is organized by section.

00:13.280 --> 00:20.640
So here and here you will always have access to the most up to date, functional and tested version

00:20.680 --> 00:25.480
of all the nodes and features that we are going to develop in this course.

00:26.040 --> 00:32.360
You can use this material as a starting point to follow the laboratory lessons, and also as a template

00:32.400 --> 00:33.720
to develop new features.

00:34.200 --> 00:39.280
For instance, let's say that you are in the section three and that you are following the laboratory

00:39.280 --> 00:44.720
lesson in which we create for the Python the simple publisher.

00:44.720 --> 00:46.080
So this one here.

00:46.080 --> 00:48.720
So let's say that you are developing this node here.

00:48.960 --> 00:53.840
So if you want you can simply copy paste all this code here in your workspace.

00:54.120 --> 00:59.960
Also that in the laboratory lesson you can just focus on the explanation of all these lines of code

01:00.080 --> 01:04.520
here, instead of rushing for copying all the code that I'm going to type.

01:04.880 --> 01:11.840
Otherwise, if you prefer to rewrite the code from the laboratory lesson yourself, you can use this

01:11.840 --> 01:12.480
material.

01:12.480 --> 01:15.840
So you can use all the code that you find here on GitHub.

01:16.000 --> 01:21.920
In order to check for any bugs or typos that can occur in your code.

01:22.400 --> 01:24.600
Let me show you how you can do this.

01:25.080 --> 01:31.640
For example, let's go to Visual Studio Code and let's say that you are writing for the Arduino Bot

01:31.680 --> 01:33.200
Pi examples packages.

01:33.760 --> 01:38.520
So let's say that you are developing this one here the simple subscriber node.

01:38.840 --> 01:43.600
So let's say that you have followed the laboratory lesson and that you have typed all this code here

01:43.600 --> 01:45.720
in order to implement this node here.

01:46.120 --> 01:48.680
And so then you try to execute it.

01:49.040 --> 01:51.400
So let's say that you open a terminal.

01:51.440 --> 01:52.760
You go to the workspace.

01:53.400 --> 01:57.880
So to the Arduino bot workspace you build it with Qualcomm build.

01:58.440 --> 02:04.910
And then once the build is completed in a new window of the terminal, you source it and then you run

02:04.950 --> 02:05.870
this node here.

02:05.870 --> 02:12.950
So the simple subscriber with Ros to run and from the Arduino boot Pi examples.

02:12.950 --> 02:17.190
So you start the simple subscriber node.

02:17.190 --> 02:18.710
So you press enter.

02:19.070 --> 02:20.430
And this one here.

02:20.430 --> 02:22.910
So the node is crashing.

02:22.910 --> 02:28.350
So it throws an error even though everything works perfectly in the course lesson.

02:28.710 --> 02:29.750
Classic right.

02:29.910 --> 02:33.790
It always runs smoothly in the video but never on your PC.

02:34.110 --> 02:36.950
I know the feeling in this case.

02:37.150 --> 02:43.470
As a first step, I recommend you carefully reading the error that is printed in the terminal, and

02:43.470 --> 02:47.030
this is normally going to highlight you the error.

02:47.030 --> 02:52.470
And also it's going to provide you some useful insights on which will be the line that is affected by

02:52.470 --> 02:54.150
the error in your code.

02:54.750 --> 03:01.910
While debugging can be challenging and even frustrating, it is an invaluable part of the learning process.

03:02.230 --> 03:08.150
It encourages you to understand each line of code more deeply, and this is a skill that you will rely

03:08.150 --> 03:10.950
on in all your robotics projects.

03:11.550 --> 03:15.390
You can also start by searching this error here.

03:15.390 --> 03:16.870
So this is the error message.

03:17.110 --> 03:20.230
We can start by searching this one on Google for example.

03:20.670 --> 03:24.630
So we can go here and we can paste the error that we are getting.

03:24.750 --> 03:25.470
And here.

03:25.750 --> 03:31.790
So as we can see this not only can help you to find a solution to the problem that you are having,

03:31.790 --> 03:38.350
but also it can introduce you to a lot of forums and communities where robotic software developers can

03:38.350 --> 03:41.750
collaborate and can share solutions to their problems.

03:42.070 --> 03:44.030
For example, we have StackOverflow.

03:44.070 --> 03:45.630
We have answers.

03:45.630 --> 03:46.630
So the heroes wiki.

03:47.070 --> 03:50.230
Then we have this one here Robotic Stack Exchange.

03:50.430 --> 03:57.950
So all of these are invaluable examples of communities where developers of all levels and backgrounds

03:57.950 --> 04:03.590
Grounds can collaborate to solve problems if this step doesn't solve your issue.

04:03.630 --> 04:05.950
You can also try using ChatGPT.

04:06.470 --> 04:12.910
So here, try to be as descriptive as possible with your problem, and also try to include all the relevant

04:12.910 --> 04:18.630
details, including, for example, code snippets and also the errors that you are having in your terminal.

04:19.230 --> 04:22.790
For example, let's copy all the code that is throwing the error.

04:23.550 --> 04:24.390
Let's say.

04:25.470 --> 04:27.990
So let's ask this code.

04:28.230 --> 04:35.030
Then let's paste all the code and let's say is causing this issue.

04:35.470 --> 04:37.630
And then let's simply paste.

04:37.670 --> 04:40.390
So let's copy paste the error message.

04:40.390 --> 04:44.190
So this one here let's copy it and let's paste it here.

04:44.710 --> 04:46.630
So let's try asking it.

04:46.630 --> 04:53.670
And normally this tool is incredible because not only it will solve your problem in seconds, but also

04:53.750 --> 04:59.780
will provide you with an accurate explanation of the issue that you are facing, why it occurred, and

04:59.780 --> 05:03.020
this will further enhance your understanding of the topic.

05:03.940 --> 05:05.340
If you are still stuck.

05:05.780 --> 05:11.580
Let me show you another debugging strategy that is one of comparing your code.

05:11.740 --> 05:14.580
So the one that you are developing here in Visual Studio Code.

05:14.580 --> 05:16.940
So in your Arduino board workspace.

05:17.300 --> 05:20.140
So to compare this one with this one here.

05:20.140 --> 05:24.500
So with the one that I developed and that I uploaded here on GitHub.

05:24.980 --> 05:29.180
Now in order to do so the first thing that we need to do is to download this code here.

05:29.180 --> 05:34.700
So to download all these folders so we can use this button here in order to clone.

05:35.100 --> 05:37.220
So we can copy this link here.

05:37.620 --> 05:39.500
And then we can open a terminal.

05:40.660 --> 05:41.380
Here we go.

05:41.620 --> 05:44.300
And so here we can use the command git clone.

05:44.540 --> 05:47.020
And let's paste the link that we have just copied.

05:47.300 --> 05:52.940
So basically this command here now is downloading all the code that I uploaded here.

05:52.940 --> 05:56.820
So all of this code it is downloading it in your PC.

05:57.620 --> 06:03.020
So now we can see here that this one is the folder that I uploaded here.

06:03.020 --> 06:06.580
And that contains all the code for all these actions of the course.

06:06.940 --> 06:09.580
Now what we want to do is to compare your code.

06:09.580 --> 06:13.860
So the one that you are developing here in the Arduino workspace with my code.

06:13.860 --> 06:15.620
So the one that I uploaded here.

06:16.220 --> 06:19.780
To do so we can use the amazing tool that is git.

06:20.300 --> 06:23.020
So we can go to your workspace.

06:23.180 --> 06:27.220
Go to the Arduino bot workspace in which you have the error or the typo.

06:27.580 --> 06:30.980
And here we can use the command git init.

06:30.980 --> 06:34.140
So this will initialize this repository here.

06:34.140 --> 06:36.620
So this folder as a git repository.

06:36.900 --> 06:43.540
Then we can use git add dot in order to add all the files that are here.

06:43.540 --> 06:47.060
So all the code that you develop in the Arduino workspace.

06:47.060 --> 06:49.300
So this will be added to git.

06:49.340 --> 06:50.060
Perfect.

06:50.060 --> 06:51.380
And now we can save.

06:51.380 --> 06:52.820
So we can create a checkpoint.

06:52.820 --> 06:56.060
We can create a commit for this code here.

06:56.060 --> 07:01.420
So for the code that we have developed so far in this code here, because then we want to compare this

07:01.420 --> 07:02.020
checkpoint.

07:02.020 --> 07:04.860
So we want to compare your code with my code.

07:04.860 --> 07:07.500
So with this one here that we have just downloaded.

07:08.020 --> 07:10.620
So we can create a commit with git commit.

07:11.060 --> 07:15.860
And for example let's call it checkpoint perfect.

07:15.860 --> 07:19.180
So we are adding all the code that is in your workspace.

07:19.180 --> 07:25.100
So we are adding all of these to the checkpoint so that now we can compare this checkpoint with this

07:25.100 --> 07:25.860
code here.

07:26.260 --> 07:31.820
And in order to do so is as simple as opening this folder here.

07:31.820 --> 07:36.980
So this folder that we have just downloaded and that contains all the code that I uploaded on GitHub.

07:37.220 --> 07:38.660
So let's open it here.

07:38.660 --> 07:40.940
Let's go to the section that you are following.

07:41.020 --> 07:43.460
Let's say that you are following the section number three.

07:44.140 --> 07:45.580
So here you can see this one.

07:45.580 --> 07:50.060
Here is the workspace that you will have at the end of this section number three.

07:50.060 --> 07:55.530
So let's open it then let's go to the source folder and let's copy all the packages that are here in

07:55.530 --> 07:56.450
the source folder.

07:56.650 --> 08:00.210
So let's copy it and then we can paste them in your workspace.

08:00.570 --> 08:01.730
So we can go here.

08:02.010 --> 08:03.570
Then we can go to the source folder.

08:03.570 --> 08:05.730
Here we can remove your packages.

08:05.890 --> 08:09.610
And simply we can paste the packages that I'm using here.

08:09.770 --> 08:11.610
This is not only copy pasting.

08:11.610 --> 08:16.010
So this is not just copy pasting my code into your workspace.

08:16.250 --> 08:18.130
But as we have used git.

08:18.570 --> 08:24.690
So if we go back to Visual Studio Code, the fact that we used git is very useful because now if we

08:24.690 --> 08:26.610
go here, go to the source control.

08:26.770 --> 08:28.730
And if we open this one here.

08:28.730 --> 08:35.650
So here we can see all the changes between my code and your code which we added to the checkpoint.

08:35.650 --> 08:38.330
So which we added here to this checkpoint here.

08:38.330 --> 08:42.730
And so this is going to highlight all the changes between my code.

08:42.730 --> 08:48.690
So the one that I uploaded on GitHub and your code and most likely this is also going to highlight as

08:48.690 --> 08:49.570
you can see here.

08:49.570 --> 08:54.490
So this is going to highlight any typo or bug in your code.
