WEBVTT 00:00.000 --> 00:18.880 Hi, so the next talk, the next talk will be by Julia and she's going to talk about programming 00:18.880 --> 00:32.000 Rustu with Rust. Please give her a warm welcome, thank you everyone. Welcome to the talk 00:32.000 --> 00:37.520 or the presentation about how to program Rustu with Rust, maybe it's a bit different topic 00:37.520 --> 01:04.800 because we have seen in this bedroom, but let's see, so sorry, so first of all, um, who am I? 01:04.800 --> 01:09.680 I'm a robotic consultant and I've been working as a robotic super engineer for five years. 01:09.680 --> 01:18.000 I've been working in different developing custom applications for different startups, but last year I was invited to the robotics 01:18.000 --> 01:26.640 developers day organized by the construct because about how to program Rustu with Rust, it was a kind of new topic and 01:26.640 --> 01:33.600 not much people was talking about this, so that's also why I'm here. So first of all, what do you 01:33.600 --> 01:40.000 want to see? First of all, what is Rustu? Maybe some of you are most practical developers than 01:40.000 --> 01:46.720 robot developers, so, um, yes, we're going to see this, we're still, we're still on four robotics, 01:46.720 --> 01:53.760 why it's, we are using Rustu for robotics and so on right now, um, we're going to see together 01:53.760 --> 01:59.200 how to make a pollution as a subscriber application, third we're going to start with a pollution, 01:59.200 --> 02:04.480 then we're going to get into the subscriber and then we're going to see both pollution as a subscriber 02:04.480 --> 02:10.320 in the same note and then we're going to look through some conclusions to work. So first of all, 02:10.320 --> 02:16.240 what do you first do? If you want to look, here you have a tag, if you want to, um, get familiar with 02:16.240 --> 02:22.720 Rustu, Rustu, it's, it's a robotic operating system, it's a framework that mostly 02:22.800 --> 02:29.840 robotics, um, like people use, it's an open source framework and it's maintained by the 02:29.840 --> 02:36.640 open source robotics condition and also lots of institutes and people does and develops lots of 02:36.640 --> 02:43.040 code for this framework. So it has lots of different tools that you can use, it has visualization, 02:43.040 --> 02:49.360 perception, robot control, you can move servers, you can also get data from the sensors, 02:49.360 --> 02:56.960 and look through, uh, look through your, um, like, um, you can look through your computer and also 02:56.960 --> 03:04.000 it has hardware drivers, um, AI machine learning, the blabbering applications also has been developed 03:04.000 --> 03:11.440 to be also compatible with Rustu. Um, also debugging, um, there is, you can, like, save 03:11.440 --> 03:16.240 bugs and then retrieve them in the future. For example, the robot has done something 03:16.240 --> 03:22.160 unexpectedly, so you can see that, or so there is simulation, you don't need to have a real robot 03:22.160 --> 03:28.640 in order to be able to, um, develop, yeah, you don't need to have a robot, so you can just 03:28.640 --> 03:36.240 simulation, so you can develop code, you don't need it to have, uh, like, a robot, a robot, 03:36.960 --> 03:42.400 or so there is computer vision, open CVs, those enter it, there are two, uh, motion planning, 03:42.560 --> 03:47.360 there can do task planners, and use in your robots, and communication, there are different 03:47.360 --> 03:54.000 like protocols that has been developed to be used with Rustu. So Rustu is based on the 03:54.000 --> 04:00.000 DTS, the data distribution system network, and here in, in this, um, program will not 04:00.000 --> 04:07.840 talk about the client. So until now, what mostly people were using is the Python and the C++ 04:08.560 --> 04:13.920 client, but now there is a possibility to be able to use Rust, in order to develop application 04:13.920 --> 04:23.120 for robotics, um, to trust you. So what's the basic about Rustu? What's it so different and so 04:23.120 --> 04:29.920 important? Rustu is based on topics. Topics are the channel where the service server gets or 04:29.920 --> 04:36.560 makes a response to the client. So in this case, for example, we can have a robotics R that 04:36.560 --> 04:43.280 wants to close this specific river, so what you can do is sending a request, the client can 04:43.280 --> 04:49.920 send a request, please, I want to close the river, and then the robotics R will close the river, 04:49.920 --> 04:54.560 and then it will, as a response, it will say, okay, it has been succeeded, but not. 04:54.720 --> 05:04.320 So, why Rust and Rust for two for robotics? Um, when I, when I started working in robotics, 05:04.320 --> 05:09.600 I finished five years ago, I didn't have, I didn't have, I was in the strategy, so I didn't 05:09.600 --> 05:16.080 have a really good background in software. So as a software developer, you have to have a really 05:16.080 --> 05:21.760 good language that it gives you really good performance, it has to be really fast, because what has 05:21.920 --> 05:29.440 to go fast, and also you can may have a real time application, or so the safety has to be safe 05:29.440 --> 05:36.480 system, um, priorities are important, the flexibility to be able to run different threads on different 05:36.480 --> 05:44.320 applications at the same time, the reliability, to be able to run the robot, and every time you 05:44.320 --> 05:51.520 run your robot, every time should work. So now we have to capability to use Rust, it's like 05:51.600 --> 05:57.040 a language that it has been developed, working as a hyper performance, is a low level code, 05:57.040 --> 06:04.480 so it has more efficiency, um, memory on type 60, because as it thinks about memory, 06:04.480 --> 06:10.640 we are like getting rid of sometimes memory leaks, and also it's a type 60, because design 06:10.640 --> 06:18.400 in order to think about type. So yeah, the concurrency being able to like run different threads 06:18.560 --> 06:24.400 and as a concurring way, and also the ownership thing that has been developed in 06:24.400 --> 06:32.480 vast in order to know who gets the ownership, I think that's a good thing, and as so as we 06:32.480 --> 06:39.440 have talked about, we were fewer runtime crashes, it's a safer system. So this is the package, 06:40.240 --> 06:45.600 this is the repository that we are going to talk about, it's an open-source repository, and 06:46.560 --> 06:53.040 you can see that there are different packages, we are going to focus on the RCLRS, 06:53.040 --> 07:00.720 that it's a Rust client like package, or create in this case. So here is the attack, if you 07:00.720 --> 07:08.800 want to know, then start working with this, lots of people are contributing, right? So this is the, 07:09.760 --> 07:16.400 now, so you don't need to don't load the package itself, or the repository, because the client 07:16.400 --> 07:23.440 has been released as a great, so you can store it, and you don't need to don't load and compile. 07:23.440 --> 07:30.160 So here you can access to the great itself, and it also contains a really good documentation. 07:30.160 --> 07:35.680 So you can go through this, so I think that when you are starting, and when you're having a good 07:35.680 --> 07:42.720 documentation, it's easier for you. So what we are going to see now, now we're going to see 07:42.720 --> 07:49.920 three different applications to use this specific Rust client in a, in different like ways. 07:50.640 --> 07:55.920 This is our friend, this is the go-to from, from a new tree, this is going to be our server, 07:55.920 --> 08:00.880 this robot is going to provide us different topics that we are going to use in order to make 08:00.880 --> 08:05.840 our custom applications. So first, we're going to see the publisher, the publisher, 08:05.840 --> 08:10.160 what we want to see in the previous is how to send common bells to the robot, how to make the 08:10.160 --> 08:17.040 robot move around through this simulation. Then what we're going to see is the subscriber, 08:17.840 --> 08:24.960 we're going to get through this topic, the bell-line point topic, we're going to get the scan 08:25.040 --> 08:33.520 or the points for this specific ladder that the robot contains. And finally, as a third application, 08:33.520 --> 08:39.520 you're going to make using both pollution and subscriber getting the velocity, I'm sorry, 08:39.520 --> 08:44.320 cooling into the velocity and getting the positions from the sensor, you're going to make together 08:44.320 --> 08:54.240 an obstacle avoidance. So first, how to create a pollution? Normally, 08:54.320 --> 08:59.360 intros, but we have this anode, the node contains application itself. So we are creating an in 08:59.360 --> 09:03.760 node that's going to contain the application and it's called CMD bell pollution. 09:05.760 --> 09:10.880 Then we're going to create the pollution, the topic, the channel where we're going to send a specific 09:10.880 --> 09:16.960 velocity to the robot, the pollisher, it calls CMD bell, common bell, we're going to send 09:16.960 --> 09:25.760 comments to the robot. In order to like to pull this to a topic, we need to feel or like we need 09:25.760 --> 09:33.040 a message. The message is like the message is going to go through this topic and it's how we're 09:33.040 --> 09:39.760 going to pull this on to the robot. So as it is a velocity, as we are command-belling and we are sending 09:39.840 --> 09:46.400 velocity, we're going to feel this specific message and we're going to send or change this 09:46.400 --> 09:53.440 velocity. So in this case, what we are doing is like changing the topic, sorry, the message, 09:54.160 --> 10:01.840 and we are changing the velocity doing a pendulum movement because we don't want to like 10:01.840 --> 10:08.400 lose the robot. We want to have the robots control and we are going to make the robot move around 10:08.400 --> 10:15.200 but doing a pendulum movement. So after we are like feeling the message, then we're going to 10:15.200 --> 10:23.200 print by terminal, a message. So that we are moving, for example, in linear, we are moving in 10:23.200 --> 10:31.280 this velocity and angular, we are not going to rotate around, just moving in linear. So here, 10:31.920 --> 10:38.640 we are polishing, we are going to make the robot polish and move around here and this is a 10:38.640 --> 10:45.280 robot moving around. So we are commanding and sending the other topic, C and D well, the specific 10:45.920 --> 10:52.800 and for each point that we have in the here, for each point that we have in the message, 10:53.440 --> 10:59.200 it means that you have this point to cloud. So it's at the to the, so a lot of points is going 10:59.200 --> 11:05.840 around. So we are getting the data and we are processing the data. So at each point, we are processing 11:05.840 --> 11:12.960 the x, y and the angle where I have something around, have some points. So I could have an obstacle. 11:13.680 --> 11:19.840 In this specific application, what we are doing is just detecting if I have an object in one of 11:19.840 --> 11:26.960 the corners. So if I have one of the object front, but left, right. This is a specific application, 11:27.040 --> 11:34.640 just getting the left one. So what I am doing is, if I have an object, less than one 11:34.640 --> 11:41.200 max distance and this object is in this specific range, in this specific angle, it seems that 11:41.200 --> 11:49.040 I have an object in the left. So I am only printing around like in the terminal, I am saying that 11:49.040 --> 11:55.280 I have a left object in my left. You can see here that it is more cold, that it is not being 11:55.520 --> 11:59.360 with right and here, but we can do the same in the left, right, front and back. 12:00.560 --> 12:04.400 And then we are spinning because we are like, wanted to get that cold, but. 12:07.040 --> 12:14.880 So this is the point. Here we are placing a box in different like corners of the robot 12:15.840 --> 12:22.880 and depending on the, the box is placed, here we have a different message in the terminal. 12:23.840 --> 12:28.400 Robot doesn't move because we are not commenting the robot the robot is quiet, which is very 12:28.400 --> 12:33.200 hearing through the scan or well aligned point topic. 12:36.960 --> 12:44.320 So, last application. So now we have seen how to here, how to tell, through topics. So we are 12:44.320 --> 12:51.840 going to use the same both topics in order to be able to tell with the robot. So here we have the 12:51.920 --> 13:00.880 same as before. So here what we have, this is a bit different as before, we are like implementing 13:00.880 --> 13:10.960 a specific like structures, because more or less like anything like class, but here in 13:11.040 --> 13:22.720 press, we are placing, but everything structures. So we are doing the same as before. 13:22.720 --> 13:27.760 You are going to make a polisher, we are going to try the polisher and then we are going to make this 13:27.760 --> 13:34.800 subscriber. Same as before, we have like this is the message that it is like we are like getting 13:34.880 --> 13:42.400 on each callback, and this is the same as before on every. Here we are like fitting the left corner. 13:42.400 --> 13:49.040 So if we have an object in the left corner, in this case, just in this case, what we are doing is 13:49.040 --> 13:54.800 feeling the message from the velocity just to be able to the robot to move around, if it 13:54.800 --> 14:01.920 has for example an object in the left. So this is that this message, we are like feeling that it should 14:02.000 --> 14:08.640 move to the right angle at velocity, if we have an object in the left. So that is the point. 14:10.480 --> 14:17.760 So here is the node, we are getting a different node, here is where we are polishing on each loop, 14:17.760 --> 14:26.800 we are polishing to the robot, and this is only change when in each callback, if there is something 14:27.120 --> 14:33.120 like object around, if not, we may do, you can decide what you want, but you can go straight. 14:33.120 --> 14:45.600 Okay? So that is the point. The robot may go like here, but it just is like an object in the left. 14:47.040 --> 14:49.440 So it is going to start moving around. 14:57.680 --> 15:10.400 So as a conclusion, from this talk, why we should start using Rust in robotics application, 15:10.400 --> 15:16.000 it is because the memory and with safety by default, it is implemented by default. 15:16.800 --> 15:21.440 Also it is a high level code without performance overhead, so it is like a mast. 15:22.080 --> 15:27.840 So it is a type safety, and it contains a robust error handling, and it has an excellent performance, 15:27.840 --> 15:35.600 which is really good on the old time applications. But as I have seen, if you are going to start 15:35.600 --> 15:41.040 to use Rust and you are kind of new in so far development, maybe the learning difficulty and 15:41.040 --> 15:46.880 the learning curve is steep, so maybe you could start using for example Python and then on your application. 15:47.840 --> 15:55.120 The ecosystem in maturity, there are a lot of people who or much companies who are using 15:55.120 --> 16:02.720 trust you with Rust now, so you may not have different packages where you can start like 16:02.720 --> 16:09.360 a solid fault, but maybe, and also the legacy integration, maybe you have some 16:09.440 --> 16:16.640 databases that are legacy, so it may be difficult to integrate with your current software. 16:17.200 --> 16:24.240 And then the compile time, if you see plus plus if you compile by from scratch, you don't 16:24.240 --> 16:30.640 haven't done any compile in the hard. So thank you for the attendance. 16:30.640 --> 16:35.840 If you want to look through the Rust workshop, just to become a familiar about the technology 16:35.840 --> 16:41.280 and about to learn deeper how to make message from scratch and work with services, 16:41.280 --> 16:44.960 you can look through this, and this is my contact if you need netting from our site. 16:44.960 --> 16:46.960 So thank you. 16:57.760 --> 17:01.120 Hello, another language, so you should know them as such type always. 17:01.120 --> 17:03.440 You can talk a little about this. No, no, no, no. 17:06.400 --> 17:13.280 If I understand it correctly, Rust you use this heavily also a lot of Python written stuff. 17:13.280 --> 17:13.680 Yes. 17:13.680 --> 17:19.840 And so there's Python 3 which allows you to do bindings to Rust libraries, so you can accelerate 17:19.840 --> 17:27.120 your Python code. And so would you say having the Rust two bindings for Rust is more 17:27.120 --> 17:34.160 complementary so that you can slowly progress over then, finally then move your code from Python 17:34.240 --> 17:41.600 to Rust, or is it just a completely different approach to integrate Rust into Rust too? 17:43.120 --> 17:47.440 I might say depending on the application, depending on the resources that you have in your application. 17:48.000 --> 17:53.360 For example, you have resources and time on Rust. 17:54.960 --> 17:59.520 This is a very good question because it depends on how you are good on development. 17:59.520 --> 18:05.760 So you can develop a really good code in all of the languages. But by default, if you start working 18:05.760 --> 18:12.400 this specific package, there is only other packages that are working with Rust to 18:12.960 --> 18:18.960 client, but this basically packages how the other Rust like C++ and Rust Python 18:18.960 --> 18:24.160 packages work. So that's the point of using this one. But if you have other applications 18:24.160 --> 18:30.400 just in Python and it's well maintained and it's efficient, it has been like go through. 18:30.400 --> 18:35.680 I would say you can start working with this package from scratch, from new applications, 18:35.680 --> 18:39.600 and you may still working in old and legacy code with other applications. 18:39.600 --> 18:41.760 Depending on what you have, we're only half. 18:44.240 --> 18:45.520 Amazing. Thank you so much. 18:45.600 --> 18:47.600 Thank you. 18:52.320 --> 18:55.600 And if you have further questions, find Julia in the hallway. 18:55.600 --> 18:57.600 Thank you so much, guys.