<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Raúl Serrano on Medium]]></title>
        <description><![CDATA[Stories by Raúl Serrano on Medium]]></description>
        <link>https://medium.com/@serrano_223?source=rss-49781efb5948------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_7hRvBjWAbAM9H6N.jpg</url>
            <title>Stories by Raúl Serrano on Medium</title>
            <link>https://medium.com/@serrano_223?source=rss-49781efb5948------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 00:20:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@serrano_223/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Chapter Zero: LLMs Engineer Handbook]]></title>
            <link>https://medium.com/@serrano_223/chapter-zero-llms-engineer-handbook-5c7fda6186a7?source=rss-49781efb5948------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c7fda6186a7</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Raúl Serrano]]></dc:creator>
            <pubDate>Tue, 23 Sep 2025 07:41:02 GMT</pubDate>
            <atom:updated>2025-09-23T07:42:09.870Z</atom:updated>
            <content:encoded><![CDATA[<p>If you, like me, are a Software Engineer who wants to slowly transition to the role of AI Engineer, you are invited to join me on this adventure that I will publish as a series of posts on Medium. <br>During this process we will be wearing many hats, Data Engineering, ML Engineering etc.</p><p>We’ll explore how raw data becomes usable features, how models are fine-tuned and evaluated, and how inference systems are built for real-world use.</p><p>We will be building an LLM twin able to write from scratch using your personal style based on platforms like Linkedin, Medium or Substack.</p><p>You need Data Scientist to train the models but there is still a lot of work left around it: Clean and validate data, inference setups, serve features in the right environment, deploy the model etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/0*jki1DuRmfTQqNPCT.png" /><figcaption>Monolithic batch pipeline architecture</figcaption></figure><p>We could have monolithic model like the one above. This way feature training, model training and inference are in the same component. This model is good when we are working with smalls data sets and the results will be consumed by a client directly, such as a dashboard.<br>However, since features are so coupled to this system, they cannot be reused by others. If the data increases, its hard to scale so you will have to refactor the code to support distributed computing like PySpark or Ray.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/0*k5_dc0O9mkoye4F_.png" /><figcaption><em>Stateless real-time architecture</em></figcaption></figure><p>One alternative is having an stateless system. We need to pass the whole state during the client request for the features to be computed and passed to the model.<br>Same applies if we have RAG support, we need to pass the embeddings and the client needs to know how to retrieve the features from them, which is an antipattern.</p><p>The challenge is to pass the features to make predictions without passing them at the client’s request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/0*rLmRzxEJY1r7IHSe.png" /><figcaption>FTI Pipelines Architecture</figcaption></figure><h4>The feature pipeline</h4><p>It takes raw data as input and processes the features and labels required by the model for training or inference. It stores them in a Feature Store. The data is versioned, so we can ensure that the training and inference time features match.</p><h4>The training pipeline</h4><p>It takes the features and labels from the features stored and outputs a trained model that is stored in a model registry. The model registry will version each model and share them with the Inference Pipeline. <br>Some metadata specifying how the model was trained is also included in the model registry.</p><h4>The inference pipeline</h4><p>It takes as input the features and labels form the feature store and the trained model from the model registry.</p><p>There are some benefits from using this pattern:<br>Each component can be written using its own tech stack.<br>Each component can be potentially developed by a different team.<br>Each component can be deployed scaled and monitored independently.</p><p>Now lets jump onto what we want to build, the LLM twin. We will divide it into two sections, the Data Collection pipeline and the FTI pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/0*30h_pduYS5JMHDpF.png" /><figcaption><em>LLM Twin high-level architecture</em></figcaption></figure><h4>Data Collection pipeline</h4><p>For data collection we will use the ETL pattern (extract, load, transform). The output will be a NoSQL database. Its important to group the data by category, as each categoy myst be processed differently.</p><p>Building robust LLM systems isn’t just about fine-tuning models — it’s about designing pipelines that handle data, training, and inference in a modular way. The Feature–Training–Inference (FTI) pattern provides a clean architecture to make this possible.</p><h4>Feature Pipeline</h4><p>The feature pipeline ingests raw data such as articles, posts, and code, and processes it through cleaning, chunking, and embedding. This produces two snapshots: a cleaned dataset used for fine-tuning, and an embedded dataset used for retrieval in RAG. Instead of adding a specialized feature store, we use a vector database as a logical feature store. With some additional logic, it covers the responsibilities we need: datasets are wrapped as artifacts for offline training, while the vector DB supports semantic search for online inference. This design keeps the system simple without losing flexibility.</p><h4>Training Pipeline</h4><p>The training pipeline starts whenever new instruct datasets land in the feature store. It fine-tunes an LLM and stores the weights in a model registry. At the beginning, data scientists run experiments with hyperparameter tuning and use an experiment tracker to compare results. Later, the process evolves into continuous training, removing manual overhead. Before deploying, a testing pipeline validates new candidates against stricter benchmarks. A manual approval step remains important as a final safeguard before pushing a new model into production.</p><h4>Inference Pipeline</h4><p>The inference pipeline ties everything together. It loads the fine-tuned LLM from the model registry, queries the vector DB for context through RAG, and serves answers through a REST API. Every query, prompt, and answer is logged in a monitoring system that helps debug issues, analyze performance, and trigger alerts when necessary.</p><p>By combining the FTI architecture with the specific needs of fine-tuning and retrieval, we end up with a modular, production-ready system. The logical feature store balances offline and online needs, continuous training ensures the model evolves over time, and the inference pipeline delivers enriched, monitored answers to users. In short, the key is to keep the interfaces clean while layering in the unique logic required for LLMs.</p><p>In the next section I will jump into more practical step:<br>I started by cloning the repo and resolving the dependencies the project requires such as Poetry as well as getting the API Keys for the different model registries and LLM APIs like Chatgp….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c7fda6186a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick review to leap into embedded models with proxies]]></title>
            <link>https://medium.com/data-science/quick-review-to-leap-into-embedded-models-with-proxies-c6f39e24d06d?source=rss-49781efb5948------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6f39e24d06d</guid>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Raúl Serrano]]></dc:creator>
            <pubDate>Wed, 12 Sep 2018 12:03:01 GMT</pubDate>
            <atom:updated>2018-09-12T17:38:56.386Z</atom:updated>
            <content:encoded><![CDATA[<p><em>As a follow up I have created a Jupyter Notebook. Some of the images collected here are taken from there:</em> <a href="https://github.com/rachuism/food-classifier-proxy-nca/blob/master/Visualization.ipynb">https://github.com/rachuism/food-classifier-proxy-nca/blob/master/Visualization.ipynb</a> and here: <a href="https://arxiv.org/pdf/1703.07464.pdf">https://arxiv.org/pdf/1703.07464.pdf</a></p><p>Embeddings as the word itself suggests, is intended to make something smaller. In the case of deep learning it consists of mapping items (e.g. movies, text,…) to low-dimensional real vectors in a way that similar items are close to each other.</p><p>So let’s take as an example a movie’s recommendation system. We need to track the taste from each user to extract the data. But what if we are tracking a set of, for example, a million of movies. Encoding the whole set will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*t-gF4_uCJvLgQL2kBP-Ojg.png" /><figcaption>Taken from Google’s developers course</figcaption></figure><p>Which is quite inefficient for working with deep learning models. Instead, we try to reduce the number of dimensions from that space using various mathematical techniques. The following image shows how the huge encoding is “embedded” into the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*htb_BZXm3hjVfbf_MxKc8w.png" /><figcaption>Taken from Google’s developers course</figcaption></figure><p>During the training of my model an embedding size of 64 has been chosen. That’s why when the tensor is printed, a number of 64 elements shapes it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*Tiu4-yiuUYowuD9hebQdXQ.png" /></figure><p>The other keyword from this project is “proxy” which in this case is learned as part of the model parameters. It strives to represent a dataset into a single point. <em>The learning problem formulated over proxies exhibits empirically faster convergence than other metric learning approaches.</em></p><p>As an example to help to understand it, let’s first understand the “triplets” concept: Having an “anchor” point <strong>x</strong>, we want to decrease the distance to another similar point <strong>y </strong>and increase the distance with a dissimilar point <strong>z. </strong>The following image tries to ease the understanding:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/178/1*w9lD35J9Rjr56jyuPC14Cg.png" /><figcaption>Taken from the aforementioned paper</figcaption></figure><p>Let’s imagine our anchor point is the isolated red circle which is closer to the rest of the circles and far from the stars. This is the perfect instance to summarize what the proxies intend. In the following scheme, the right image represents how a group of points is represented by one single big point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*MMs-MmvWc1uzeGbgA-B8rw.png" /><figcaption>Taken from the aforementioned paper</figcaption></figure><p>As it can be seen, the proxy acts as an upper bound representation from each set of points. The loss is calculated over these distances trying to keep <strong>x</strong> as close as possible to <strong>y</strong> and as far as possible to <strong>z.</strong></p><h3>Dataset</h3><p>The dataset consists of 20 food categories and 100 images per category. The categories selected are apple-pie, bread-pudding, beef-carpaccio, beet-salad, chocolate-cake, chocolate-mousse, donuts, beignets, eggs-benedict, croque-madame, gnocchi, shrimp-and-grits, grilled-salmon, pork-chop, lasagna, ravioli, pancakes, french-toast, spaghetti-bolognese, pad-thai.</p><p>Link to the dataset (UPMC-G20): <a href="http://visiir.lip6.fr/">http://visiir.lip6.fr/</a></p><h3>Training and Evaluation</h3><p>The diagram below explains a workflow of evaluation systems. First a training set is fed to a recommendation algorithm which produces a recommendation model that can be used to generate new predictions. To evaluate the model a held out test set is fed to the learned model where predictions are generated for each user-item pair.<strong> Predictions with known labels (true value) </strong>are then used as an input to the evaluation algorithm to produce evaluation results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*ZGVGrig1akAcyJdcYzwQGw.png" /></figure><p>As I’m working with only 20 classes, I,ve used the 50% of them for the training set and 50% for the evaluation</p><p>The number of classes is small for working with Distance Metric Learning and as the inner-class variation is quite large when compared to the initra-class variation. This is the reason why later, the NMI throws a low value.</p><h3><strong>Predictions. Neighborhood Components Analysis</strong></h3><p>NCA consists of a supervised learning method for classifying multivariate data into distinct classes according to a given distance metric over the data. (k nearest neighbors). During the “predict” step I use: <strong>sklearn.metrics.pairwise.pairwise_distances(X) </strong>to find the images closer to my query.</p><p>The image I selected as a query for this example is a piece of cake, which after some transformations (The inputs are resized to 256 × 256 pixels, and then randomly cropped to 227 × 227. The pixel’s intensity has been scaled) looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*Wf0NW0HsiwbxaZMep-bWtw.png" /><figcaption>UPMC20 dataset</figcaption></figure><p>The retrieval to this photograph are images from the same class (cake):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*RwfS_ox8yUFa0RNY5ShbJg.png" /><figcaption>UPMC20 dataset</figcaption></figure><h3>Understanding the log</h3><p>The number of epochs has been set to 20. There are two concepts to understand how the loss is being calculated during the “evaluation step”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*FmHfQR4CWcPCrXNb-96FqA.png" /><figcaption>.log file</figcaption></figure><p>NMI: Normalized Mutual Information, is defined as the ratio of the mutual information of the clustering and ground truth, and their harmonic mean. It quantifies the amount of information about one variable obtained through other random variable.</p><p>Recall at k: <em>Recall at k is the proportion of relevant items found in the top-k recommendations. </em>So in the case<em> </em>of R@1, it means 40% of probabilities that a relevant item appears in the first position, and in the case of R@8, it means 84% of possibilities of having a relevant item in the top-8. This is the reason why the bigger the parameter “K” is, the larger its recall. Mathematically it can be defined as:<strong> Recall@k = (# of recommended items @k that are relevant) / (total # of relevant items).</strong></p><h3><strong>References</strong></h3><p><a href="https://medium.com/@m_n_malaeb/recall-and-precision-at-k-for-recommender-systems-618483226c54">Recall and Precision at k for Recommender Systems</a></p><p><strong>No Fuss Distance Metric Learning using Proxies </strong><a href="https://arxiv.org/pdf/1703.07464.pdf">https://arxiv.org/pdf/1703.07464.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6f39e24d06d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/quick-review-to-leap-into-embedded-models-with-proxies-c6f39e24d06d">Quick review to leap into embedded models with proxies</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ROS for dummies. Part 3]]></title>
            <link>https://medium.com/@serrano_223/ros-for-dummies-part-3-f374a22b9b2b?source=rss-49781efb5948------2</link>
            <guid isPermaLink="false">https://medium.com/p/f374a22b9b2b</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Raúl Serrano]]></dc:creator>
            <pubDate>Mon, 19 Feb 2018 00:54:30 GMT</pubDate>
            <atom:updated>2018-02-19T00:54:30.364Z</atom:updated>
            <content:encoded><![CDATA[<p>A Subscriber enables your node to read messages from a topic so the data is streamed into the node. Frequently they have the following format.</p><pre>sub1 = rospy.Subscriber(&quot;/topic_name&quot;, message_type, callback_function)</pre><p>“callback_function” is the name of the function that should be called with each incoming message.</p><p>Let’s write a node called “look_away” that will subscribe to /rgb_camera/image_raw topic. Whenever the camera is pointed towards an uninteresting image, the callback function will move the arm to something more interesting.</p><p>You can create the “look_away” node as we have already seen:</p><pre>$ cd ~/catkin_ws<br>$ cd src/simple_arm/scripts<br>$ touch look_away<br>$ chmod u+x look_away</pre><p>You will need to modify “robot_spawn.launch” which can be found in ~/catkin_ws/src/simple_arm/launch</p><p>Add the following lines:</p><pre><em>&lt;!-- The look away node --&gt;</em><br>  &lt;node name=&quot;look_away&quot; type=&quot;look_away&quot; pkg=&quot;simple_arm&quot;/&gt;</pre><p>You can already modify the “max_joint_2_angle” parameter so you don’t need to modify it later.</p><pre><em>&lt;!-- The arm mover node --&gt;</em><br>  &lt;node name=&quot;arm_mover&quot; type=&quot;arm_mover&quot; pkg=&quot;simple_arm&quot;&gt;<br>    &lt;rosparam&gt;<br>      min_joint_1_angle: 0<br>      max_joint_1_angle: 1.57<br>      min_joint_2_angle: 0<br>      max_joint_2_angle: 1.57<br>    &lt;/rosparam&gt;<br>  &lt;/node&gt;</pre><p>And then this is the code for look_away:</p><pre><em>#!/usr/bin/env python</em><br><br><strong>import</strong> math<br><strong>import</strong> rospy<br><strong>from</strong> sensor_msgs.msg <strong>import</strong> Image, JointState<br><strong>from</strong> simple_arm.srv <strong>import</strong> *<br><br><br><strong>class</strong> <strong>LookAway</strong>(object):<br>    <strong>def</strong> <strong>__init__</strong>(self):<br>        rospy.init_node(&#39;look_away&#39;)<br><br>        self.sub1 = rospy.Subscriber(&#39;/simple_arm/joint_states&#39;, <br>                                     JointState, self.joint_states_callback)<br>        self.sub2 = rospy.Subscriber(&quot;rgb_camera/image_raw&quot;, <br>                                     Image, self.look_away_callback)<br>        self.safe_move = rospy.ServiceProxy(&#39;/arm_mover/safe_move&#39;, <br>                                     GoToPosition)<br><br>        self.last_position = <strong>None</strong><br>        self.arm_moving = <strong>False</strong><br><br>        rospy.spin()<br><br>    <strong>def</strong> <strong>uniform_image</strong>(self, image):<br>        <strong>return</strong> all(value == image[0] <strong>for</strong> value <strong>in</strong> image)<br><br>    <strong>def</strong> <strong>coord_equal</strong>(self, coord_1, coord_2):<br>        <strong>if</strong> coord_1 <strong>is</strong> <strong>None</strong> <strong>or</strong> coord_2 <strong>is</strong> <strong>None</strong>:<br>            <strong>return</strong> <strong>False</strong><br>        tolerance = .0005<br>        result = abs(coord_1[0] - coord_2[0]) &lt;= abs(tolerance)<br>        result = result <strong>and</strong> abs(coord_1[1] - coord_2[1]) &lt;= abs(tolerance)<br>        <strong>return</strong> result<br><br>    <strong>def</strong> <strong>joint_states_callback</strong>(self, data):<br>        <strong>if</strong> self.coord_equal(data.position, self.last_position):<br>            self.arm_moving = <strong>False</strong><br>        <strong>else</strong>:<br>            self.last_position = data.position<br>            self.arm_moving = <strong>True</strong><br><br>    <strong>def</strong> <strong>look_away_callback</strong>(self, data):<br>        <strong>if</strong> <strong>not</strong> self.arm_moving <strong>and</strong> self.uniform_image(data.data):<br>            <strong>try</strong>:<br>                rospy.wait_for_service(&#39;/arm_mover/safe_move&#39;)<br>                msg = GoToPositionRequest()<br>                msg.joint_1 = 1.57<br>                msg.joint_2 = 1.57<br>                response = self.safe_move(msg)<br><br>                rospy.logwarn(&quot;Camera detecting uniform image. \<br>                               Elapsed time to look at something nicer:\n%s&quot;, <br>                               response)<br><br>            <strong>except</strong> rospy.ServiceException, e:<br>                rospy.logwarn(&quot;Service call failed: %s&quot;, e)<br><br><br><br><strong>if</strong> __name__ == &#39;__main__&#39;:<br>    <strong>try</strong>: <br>        LookAway()<br>    <strong>except</strong> rospy.ROSInterruptException:<br>        <strong>pass</strong></pre><p>“Image” message is imported so that the camera data can be used.</p><p>self.sub1 by subscribing to the topic &quot;joint_states&quot; changes in the position of the arm can be tracked.</p><p>The type of message in this topic is “JointState” and with each message the message data is passed to “joint_states_callback” function. Same scheme is followed for sub2.</p><p>“ServiceProxy” is how rospy enables calling a service from a node. “safe_move” is the name of the service and “GoToPosition” the service class definition. The actual calls to the service will take place in the “look_away_callback” method below.</p><p>There are two helper methods defined: “uniform_image” and “coord_equal”. The first one checks if all the color values are the same as the value of the first pixel. “coord_equal” returns True if coord_1 and coord_2 have equal component up to the specified tolerance.</p><p>“joint_states_callback” checks if the arm is moving using “coord_equal” as a helper function. If the last coordinate is the same as the current one within a tolerance then the arm has stopped moving and the “arm_moving” flag is set to false.</p><p>“look_away_callback” is receiving data from the “image_raw” topic. If the arm isn’t moving and the image is uniform, a GoToPositionRequest() message is created and sent using “safe_move” service moving both joint angles to 1.57.</p><p>We can now launch and interact with simple_arm as before:</p><pre>$ cd ~/catkin_ws<br>$ catkin_make<br>$ source devel/setup.bash<br>$ roslaunch simple_arm robot_spawn.launch</pre><p>Sometimes “look_away” starts before the rest of the system has fully initialized. Then it hangs. I’ve solved this:</p><pre><strong>def</strong> <strong>__init__</strong>(self):<br>        rospy.init_node(&#39;look_away&#39;)<br>        self.last_position = <strong>None</strong><br>        self.arm_moving = <strong>False</strong><br><br>        rospy.wait_for_message(&#39;/simple_arm/joint_states&#39;, JointState)<br>        rospy.wait_for_message(&#39;/rgb_camera/image_raw&#39;, Image)<br><br>        self.sub1 = rospy.Subscriber(&#39;/simple_arm/joint_states&#39;, <br>                                     JointState, self.joint_states_callback)<br>        self.sub2 = rospy.Subscriber(&#39;/rgb_camera/image_raw&#39;, <br>                                     Image, self.look_away_callback)<br>        self.safe_move = rospy.ServiceProxy(&#39;/arm_mover/safe_move&#39;, <br>                                     GoToPosition)<br>        rospy.spin()</pre><p>Using the command:</p><pre>$ rqt_image_view /rgb_camera/image_raw</pre><p>You can observe from the camera. To check everything is working properly, source devel/setup.bash and send a service call to point the arm directly towards the sky.</p><pre><strong>rosservice</strong> call /arm_mover/safe_move &quot;joint_1: 0 <br>joint_2: 0&quot;</pre><p>The arm moves towards the sky and then back to the blocks.</p><h4>Logging overview</h4><p>In the code for “simple_mover”, “arm_mover” and “look_away” we have used logging statements such as:</p><pre>rospy.logwarn(&#39;j1 <strong>is</strong> <strong>out of</strong> bounds, valid range (%s,%s), clamping <strong>to</strong>: %s&#39;, <br>               min_j1, max_j1, clamped_j1)</pre><p>Logging statements allow ROS nodes to send messages to the console or to the log files. This way the user can notice the errors or save the log data for later debugging.</p><p>All logging messages are written to the node’s log which can be found in ~/.ros/log or ROS_ROOT/log</p><p>If “roscore” is running you can enter into the log file using:</p><pre>roscd log</pre><p>Rospy has several message levels and provides a big variety of how to display or store this messages.</p><pre>rospy.logdebug(...)<br>rospy.loginfo(...)<br>rospy.logwarn(...)<br>rospy.logerr(...)<br>rospy.logfatal(...)</pre><p>The following table summarize the default location of the log messages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*_yDesnlF6MEZD5ZyPzdnGw.png" /><figcaption>Taken from Udacity SDCND</figcaption></figure><p>We can see the messages in real time as the program is running:</p><pre>rostopic echo /rosout</pre><p>Because of the volume of these messages, we can filter then using grep and even saving them to a file:</p><pre>rostopic echo /rosout | grep insert_search_expression_here</pre><pre>rostopic echo /rosout | grep insert_search_expression_here &gt; path_to_output/output.txt</pre><h4>Modify message level sent to /rosout</h4><p>Some type of messages like “logdebug” messages are not written to /rosout by default but is possible to modify the level of logging messages written to /rosout to be more restrictive. We can do this changing the “log_level” attribute in the “ros.init_node”.</p><pre>rospy.init_node(&#39;my_node&#39;, log_level=rospy.DEBUG)</pre><p>The other rospy options for log_level are INFO, WARN, ERROR, and FATAL.</p><h4>Modifying display of messages sent to stdout and stderr</h4><p>Within a package .launch file, the output attribute for a node tag can be set to “screen” or “log”. This changes how messages “stdout” and “stderr” are displayed.</p><p>The following table summarizes how the output options change the display:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*lqn4DCwaNWCU7ci8XrSTBg.png" /><figcaption>Taken from Udacity SDCND</figcaption></figure><p>This an example as “screen” output for the “look_away” node in the .launch file:</p><pre><em>&lt;!-- The look away node --&gt;</em><br>  &lt;node name=&quot;look_away&quot; type=&quot;look_away&quot; pkg=&quot;simple_arm&quot; output=&quot;screen&quot;/&gt;</pre><p>If the output attribute is left empty, the default is &quot;log&quot;.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f374a22b9b2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ROS for dummies. Part 2]]></title>
            <link>https://medium.com/@serrano_223/ros-for-dummies-part-2-e2ce8fe31b37?source=rss-49781efb5948------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2ce8fe31b37</guid>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[roses]]></category>
            <dc:creator><![CDATA[Raúl Serrano]]></dc:creator>
            <pubDate>Fri, 16 Feb 2018 18:57:23 GMT</pubDate>
            <atom:updated>2018-02-16T18:57:23.517Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s dive deeper into packages. First we are going to create our own package. Assuming you have sourced your ROS environment, let’s navigate to the src directory.</p><pre>$ cd ~/catkin_ws/src</pre><p>This is the sintax for creating a package:</p><pre>$ catkin_create_pkg &lt;your_package_name&gt; [dependency1 dependency2 …]</pre><p>Usually the name of our package is arbitrary. Let’s name it “first_package”.</p><pre>$ catkin_create_pkg first_package</pre><p>If you navigate inside, you will check that it only contains:</p><blockquote>CMakeLists.txt</blockquote><blockquote>package.xml</blockquote><p>These packages describe dependencies and how catkin should interact with them. So far our package is pretty basic. Here is a table that shows all the different files you may find inside a package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/0*bxPiA3nrddBvNX4L.png" /><figcaption>Taken from Udacity SDCND</figcaption></figure><p>Going further, we’re going to create new nodes:</p><p><strong>Simple Mover</strong>: Publish joint angles.</p><p><strong>Arm Mover:</strong> It’s a service related to the safe mode. It moves the arm to a safe position.</p><p><strong>Look away: </strong>It subscribes to a topic where data camera is being published.</p><p><strong>ROS Publishers</strong></p><p>They allow a node to send a message to a topic. They have the following shape in Python:</p><pre>pub1 = rospy.Publisher(&quot;/topic_name&quot;, message_type, queue_size=size)</pre><p>ROS publishing can be either synchronous or asynchronous.</p><p><strong>Synchronous:</strong> A publisher may attend to publish on a topic but it can be blocked if there is another one trying the same. This is the behavior of a rospy.Publisher if the “queue_size” parameter is not used or set to “None”.</p><p><strong>Asynchronous:</strong> A publisher can store messages in a queue until the messages can be sent. If the number of messages exceed the size of the queue, the oldest messages are dropped.</p><p>Once the publisher has been defined we can create a message with the specified data type:</p><pre>pub1.publish(message)</pre><p>Let’s now implement a node called “simple_mover”. It commands the joint movements for simple arm. For creating a new node in python you first create the script directory within the “simple_arm” package.</p><pre>$ cd ~/catkin_ws/src/simple_arm/<br>$ mkdir scripts</pre><p>Now that the scripts directory has been created, executable scripts can be added to the package. Let’s add a simple bash script to print “Hello world”. (In order for “rosrun” to find them, their permission must be changed to allow the execution).</p><pre>$ cd scripts<br>$ echo &#39;#!/bin/bash&#39; &gt;&gt; hello<br>$ echo &#39;echo Hello World&#39; &gt;&gt; hello</pre><p>Now we set the appropriate permissions to the file, rebuild the workspace and source the newly created environment. Then we will be able to run the script.</p><pre>$ chmod u+x hello<br>$ cd ~/catkin_ws<br>$ catkin_make<br>$ source devel/setup.bash<br>$ rosrun simple_arm hello</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*p6Vwq9oOEZPzJktDsHzDaw.png" /></figure><p>Above you can see the output.</p><p>Let’s create now a script called “simple_mover”.</p><pre>$ cd ~/catkin_ws/src/simple_arm<br>$ cd scripts<br>$ touch simple_mover<br>$ chmod u+x simple_mover</pre><p>This is the code we need to introduce:</p><pre><em>#!/usr/bin/env python</em><br><br><strong>import</strong> math<br><strong>import</strong> rospy<br><strong>from</strong> std_msgs.msg <strong>import</strong> Float64<br><br><strong>def</strong> <strong>mover</strong>():<br>    pub_j1 = rospy.Publisher(&#39;/simple_arm/joint_1_position_controller/command&#39;,<br>                             Float64, queue_size=10)<br>    pub_j2 = rospy.Publisher(&#39;/simple_arm/joint_2_position_controller/command&#39;,<br>                             Float64, queue_size=10)<br>    rospy.init_node(&#39;arm_mover&#39;)<br>    rate = rospy.Rate(10)<br>    start_time = 0<br><br>    <strong>while</strong> <strong>not</strong> start_time:<br>        start_time = rospy.Time.now().to_sec()<br><br>    <strong>while</strong> <strong>not</strong> rospy.is_shutdown():<br>        elapsed = rospy.Time.now().to_sec() - start_time<br>        pub_j1.publish(math.sin(2*math.pi*0.1*elapsed)*(math.pi/2))<br>        pub_j2.publish(math.sin(2*math.pi*0.1*elapsed)*(math.pi/2))<br>        rate.sleep()<br><br><strong>if</strong> __name__ == &#39;__main__&#39;:<br>    <strong>try</strong>:<br>        mover()<br>    <strong>except</strong> rospy.ROSInterruptException:<br>        <strong>pass</strong></pre><p>The type of the message we are sending is “Float64” from the package “std_msgs”. Then we publish the commands for “joint1” and “joint2”.</p><p>The init function must be called before any other Rospy package functions are called, “arm_mover” is the name of the node. We initialize the client node and registering it with the master.</p><p>Rate is created to limit the frequency of node loops. A high frequency leads to a high CPU usage.</p><pre><strong>if</strong> __name__ == &#39;__main__&#39;: </pre><p>Means the loop is executed directly. The mover function will be called.</p><pre><strong>try</strong>:<br>        mover()</pre><p>ROS interrupt exception is raised when the node is shut down (it may come from the Master or from the console window). ROS interrupt exceptions are used extensively.</p><pre><strong>while</strong> <strong>not</strong> rospy.is_shutdown():</pre><p>Now the Workspace must be built and setup.bash must be sourced. We launch simple_arm as follows:</p><pre>$ cd ~/catkin_ws<br>$ roslaunch simple_arm robot_spawn.launch</pre><p>Now that ROSMaster, Gazebo and all the nodes are up and running, we can finally launch “simple_mover”. We type the following commands in the console.</p><pre>$ cd ~/catkin_ws<br>$ source devel/setup.bash<br>$ rosrun simple_arm simple_mover</pre><p>We should observe a robotic arm spinning from -PI/2 to PI/2.</p><p>Let’s create now a new node called “arm_mover” which implements the “safe_move” service to allow the arm to be controlled with service calls. A service in ROS allows request/response communication between nodes. Request services are handled by functions or methods. This is the definition format of a service in python:</p><pre><strong>service</strong> = rospy.Service(&#39;service_name&#39;, serviceClassName, handler)</pre><p>Other nodes will use ‘service_ name’ to specify which service they are sending request to.</p><p>“serviceClassName” comes from the file name where the service definition exists. Each service has a definition provided in .srv file.</p><p>“handler” is the function that process the incoming service message and returns an appropriate response.</p><h4>Using services from another node</h4><p>You can call a service directly from the command line. To use a ROS service within another node we will use a “ServiceProxy” which provides an interface for sending messages to the service:</p><pre><strong>service_proxy</strong> = rospy.ServiceProxy(&#39;service_name&#39;, serviceClassName)</pre><p>This is an example of a “service_proxy” to send request:</p><pre>msg = serviceClassNameResponse()<br>#<strong>update</strong> msg <strong>attributes</strong> here <strong>to</strong> have correct <strong>data</strong><br>response = service_proxy(msg)</pre><p><strong>“arm_mover”</strong> node<strong> </strong>has two different tasks:</p><ul><li>Provides the service “move_arm” which allow other nodes in the system to send “movement_commands”.</li><li>Allows minimum and maximum joint angles.</li></ul><p>The definitions of the request and the response are defined in the .srv file. Let’s define a new service called “GoToPosition”.</p><pre>$ cd ~/catkin_ws/src/simple_arm/<br>$ mkdir srv<br>$ cd srv<br>$ touch GoToPosition.srv</pre><p>And insert in GoToPosition.srv the following:</p><pre>float64 joint_1<br>float64 joint_2<br>---<br>duration time_elapsed</pre><p>This file is divided into two sections separated by — — — .</p><p>The first one is for receiving the request, in this case one for each joint of simple_arm. The second one contains only one response of time duration that accounts the time for performing each of the movements.</p><h4>Modifying CMakeLists.txt</h4><p>CMakeList is a CMake script used by catkin. The find_package() macro should looks as follows:</p><pre>find_package(catkin REQUIRED COMPONENTS<br>        std_msgs<br>        message_generation<br>)</pre><p>“std_msgs” contains the basic message types and “message_generation” generate message libraries for all the supported languages.</p><p>“controller_manager” is not required in this package. We can remove it from the list of REQUIRED COMPONENTS.</p><p>Let’s uncomment add_service_files() so it looks like:</p><pre>## Generate services in the &#39;srv&#39; folder<br>add_service_files(<br>   FILES<br>   GoToPosition.srv<br>)</pre><p>This section tells catkin which files to generate code for.</p><p>Lastly let’s check that generate_messages() macro is also uncommented:</p><pre>generate_messages(<br>   DEPENDENCIES<br>   std_msgs  # Or other packages containing msgs<br>)</pre><p>This macro is actually responsible for generating the code.</p><p>Now there is one more file that should be modified, “package.xml”. It defines many of the package properties: name, authors…</p><p>When “rosdep” is searching for dependencies, it is the “package.xml” that is being parsed. Let’s add “message_generation” and “message_runtime” dependencies.</p><pre>&lt;buildtool_depend&gt;catkin&lt;/buildtool_depend&gt;<br>  &lt;build_depend&gt;message_generation&lt;/build_depend&gt;<br><br>  &lt;run_depend&gt;controller_manager&lt;/run_depend&gt;<br>  &lt;run_depend&gt;effort_controllers&lt;/run_depend&gt;<br>  &lt;run_depend&gt;gazebo_plugins&lt;/run_depend&gt;<br>  &lt;run_depend&gt;gazebo_ros&lt;/run_depend&gt;<br>  &lt;run_depend&gt;gazebo_ros_control&lt;/run_depend&gt;<br>  &lt;run_depend&gt;joint_state_controller&lt;/run_depend&gt;<br>  &lt;run_depend&gt;joint_state_publisher&lt;/run_depend&gt;<br>  &lt;run_depend&gt;robot_state_publisher&lt;/run_depend&gt;<br>  &lt;run_depend&gt;message_runtime&lt;/run_depend&gt;<br>  &lt;run_depend&gt;xacro&lt;/run_depend&gt;</pre><p>Let’s now build the package. A python package containing the module for the new service “GoToPosition” has been created in the “devel” directory.</p><pre>$ cd ~/catkin_ws<br>$ catkin_make<br>$ cd devel/lib/python2.7/dist-packages<br>$ ls</pre><h4>Create an empty arm_mover node script</h4><pre>$ cd ~/catkin_ws<br>$ cd src/simple_arm/scripts<br>$ touch arm_mover<br>$ chmod u+x arm_mover</pre><p>Let’s edit arm_mover with a text editor.</p><p>This must be the content for the script:</p><pre><em>#!/usr/bin/env python</em><br><br><strong>import</strong> math<br><strong>import</strong> rospy<br><strong>from</strong> std_msgs.msg <strong>import</strong> Float64<br><strong>from</strong> sensor_msgs.msg <strong>import</strong> JointState<br><strong>from</strong> simple_arm.srv <strong>import</strong> *<br><br><strong>def</strong> <strong>at_goal</strong>(pos_j1, goal_j1, pos_j2, goal_j2):<br>    tolerance = .05<br>    result = abs(pos_j1 - goal_j1) &lt;= abs(tolerance)<br>    result = result <strong>and</strong> abs(pos_j2 - goal_j2) &lt;= abs(tolerance)<br>    <strong>return</strong> result<br><strong>def</strong> <strong>clamp_at_boundaries</strong>(requested_j1, requested_j2):<br>    clamped_j1 = requested_j1<br>    clamped_j2 = requested_j2<br><br>    min_j1 = rospy.get_param(&#39;~min_joint_1_angle&#39;, 0)<br>    max_j1 = rospy.get_param(&#39;~max_joint_1_angle&#39;, 2*math.pi)<br>    min_j2 = rospy.get_param(&#39;~min_joint_2_angle&#39;, 0)<br>    max_j2 = rospy.get_param(&#39;~max_joint_2_angle&#39;, 2*math.pi)<br><br>    <strong>if</strong> <strong>not</strong> min_j1 &lt;= requested_j1 &lt;= max_j1:<br>        clamped_j1 = min(max(requested_j1, min_j1), max_j1)<br>        rospy.logwarn(&#39;j1 is out of bounds, valid range (%s,%s), clamping to: %s&#39;,<br>                      min_j1, max_j1, clamped_j1)<br><br>    <strong>if</strong> <strong>not</strong> min_j2 &lt;= requested_j2 &lt;= max_j2:<br>        clamped_j2 = min(max(requested_j2, min_j2), max_j2)<br>        rospy.logwarn(&#39;j2 is out of bounds, valid range (%s,%s), clamping to: %s&#39;,<br>                      min_j2, max_j2, clamped_j2)<br><br>    <strong>return</strong> clamped_j1, clamped_j2<br><br><strong>def</strong> <strong>move_arm</strong>(pos_j1, pos_j2):<br>    time_elapsed = rospy.Time.now()<br>    j1_publisher.publish(pos_j1)<br>    j2_publisher.publish(pos_j2)<br><br>    <strong>while</strong> <strong>True</strong>:<br>        joint_state = rospy.wait_for_message(&#39;/simple_arm/joint_states&#39;, JointState)<br>        <strong>if</strong> at_goal(joint_state.position[0], pos_j1, joint_state.position[1], pos_j2):<br>            time_elapsed = joint_state.header.stamp - time_elapsed<br>            <strong>break</strong><br><br>    <strong>return</strong> time_elapsed<br><br><strong>def</strong> <strong>handle_safe_move_request</strong>(req):<br>    rospy.loginfo(&#39;GoToPositionRequest Received - j1:%s, j2:%s&#39;,<br>                   req.joint_1, req.joint_2)<br>    clamp_j1, clamp_j2 = clamp_at_boundaries(req.joint_1, req.joint_2)<br>    time_elapsed = move_arm(clamp_j1, clamp_j2)<br><br>    <strong>return</strong> GoToPositionResponse(time_elapsed)<br><br><strong>def</strong> <strong>mover_service</strong>():<br>    rospy.init_node(&#39;arm_mover&#39;)<br>    service = rospy.Service(&#39;~safe_move&#39;, GoToPosition, handle_safe_move_request)<br>    rospy.spin()<br><br><strong>if</strong> __name__ == &#39;__main__&#39;:<br>    j1_publisher = rospy.Publisher(&#39;/simple_arm/joint_1_position_controller/command&#39;,<br>                                   Float64, queue_size=10)<br>    j2_publisher = rospy.Publisher(&#39;/simple_arm/joint_2_position_controller/command&#39;,<br>                                   Float64, queue_size=10)<br><br>    <strong>try</strong>:<br>        mover_service()<br>    <strong>except</strong> rospy.ROSInterruptException:<br>        <strong>pass</strong></pre><p>The “JointState” message is published into the “simple_arm/joinstate” topic and they are used for monitoring the position of the arm.</p><p>The “simple_arm” package and the service module are automatically generated by catkin in the “make” process.</p><p>The “at_goal” function returns “true” if the joint positions are closed to the goal. There is a tolerance of .05 because of the noise.</p><p>The “clamp_at_boundaries” function is responsible for forcing the min and the max values for each joint. If the joint angles passed are outside the operable range they would be clamped to the closest allowed value. The min and max joint values are taken from the parameter server each time that “clamp_at_boundaries” is called. The “~” is the private namespace qualifier and indicate that the parameter we are trying to get is within this node’s private namespace /arm_mover/. The second value is the value that will be returned in case “rospy.getparam()” was unable to get the parameter from the param server.</p><p>Then there is a warning function logging when the values are clamped.</p><p>The “move_arm” function commands the arm to move and it returns the amount of time elapsed when the arm was moving.</p><p>We have the function “wait_for_message”. It is a block function and it will not return until the message have been received from ‘/simple_arm/joint_states’.</p><p>“handle_safe_move_request” it is the service handler function and it is called when a new service request is received. The response to the service request is returned from the function.</p><p>“mover_service” function. The node is initialized with the name “arm_mover”. The GoToPosition service is created with the name “safe_move”. The resulting service name will be “/arm_mover/safe_move”.</p><p>The last section of the code is similar to simple_mover().</p><p>Now let’s launch it and interact with the service via the command line.</p><p>First we are going to modify “robot_spawn.launch” and add the following:</p><pre>&lt;!-- The arm mover node --&gt;<br>  &lt;node name=&quot;arm_mover&quot; type=&quot;arm_mover&quot; pkg=&quot;simple_arm&quot;&gt;<br>    &lt;rosparam&gt;<br>      min_joint_1_angle: 0<br>      max_joint_1_angle: 1.57<br>      min_joint_2_angle: 0<br>      max_joint_2_angle: 1.0<br>    &lt;/rosparam&gt;<br>  &lt;/node&gt;</pre><p>Launch the “simple_arm”, verify that “arm_mover” node is running and the service “safe_move” is listed.</p><pre>$ cd ~/catkin_ws<br>$ catkin_make<br>$ source devel/setup.bash<br>$ roslaunch simple_arm robot_spawn.launch</pre><p>In a new terminal verify that the node and the service has been indeed launched.</p><pre>$ rosnode list<br>$ rosservice list</pre><p>To see the camera stream use the command: rqt_image_view</p><pre>$ rqt_image_view /rgb_camera/image_raw</pre><p>To make the camera point towards the counter top, we need to rotate joint1 and joint2 by pi/2 radians.</p><pre>$ rosservice call /arm_mover/safe_move &quot;joint_1: 1.57<br>joint_2: 1.57&quot;</pre><p>Now the arm moves and eventually stops. If we check “roscore” we can see the parameter is out of safe bounds. We requested 1.57 radians, but the maximum joint angle was set to 1.0 radians.</p><p>To increase joint2&#39;s max angle we can use the command “rosparam”.</p><pre>$ rosparam set /arm_mover/max_joint_2_angle 1.57</pre><p>Let’s type it again:</p><pre>rosservice call /arm_mover/safe_move &quot;joint_1: 1.57<br>joint_2: 1.57&quot;</pre><p>And there we have it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*9sk3-rp-koHyrsbsttXlNA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2ce8fe31b37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ROS for dummies. Part 1]]></title>
            <link>https://medium.com/@serrano_223/ros-for-dummies-part-1-5c628bafb87c?source=rss-49781efb5948------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c628bafb87c</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[roses]]></category>
            <dc:creator><![CDATA[Raúl Serrano]]></dc:creator>
            <pubDate>Thu, 01 Feb 2018 16:41:33 GMT</pubDate>
            <atom:updated>2018-02-14T17:19:18.936Z</atom:updated>
            <content:encoded><![CDATA[<p>ROS was made up for not reinventing the wheel every time. For understanding the basis, here you have a brief schematic about how the system’s parts relate. All the information has been mainly taken from Udacity’s Self Driving Car Nanodegree. Acknowledgements to <a href="https://medium.com/u/8190c86ea791">David Silver</a> and his team.</p><p><strong>Nodes:</strong> Small processing units. There could be a node for estimate the position, decides how to behave and then control the actuator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*abfaf1cvhdDWVxcndVCfaA.png" /><figcaption>Taken from Udacity SDCND</figcaption></figure><p><strong>ROS Master</strong> is kind of a manager for the nodes. It registers all the active nodes in the system and allows the communication among nodes. After they connect with each other directly. It also has a parameter server. It stores parameters and configuration values to share among the running nodes. They can look at the values when needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*E8bxzk93P6jXXPs8BoIW8w.png" /><figcaption>Taken from Udacity SDCND</figcaption></figure><p><strong>Topic:</strong> A pipe between nodes where messages flow. A node can publish a message to a topic or subscribe to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*OPqGs6AKUQG6XwUOXkd8PQ.png" /><figcaption>Taken from Udacity SDCND</figcaption></figure><p><strong>Messages:</strong> The content of the message comes in hundred of different types and may contain many different types of data.</p><p><strong>Services:</strong> It allows to pass messages through nodes, however it is not a bus so there are not publishers nor subscribers associated with them. Here it goes an example:</p><p>Let’s say a Behavior Executor Node wants to capture an image from the camera. When can either subscribe to the /camera_images topic and then receive an image each time the camera node publishes one or define a service /capture_image. The request can be for instance the “exposure time” and the request an image message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*CIAmsHTy434x7trl7OqsPA.png" /><figcaption>Taken from Udacity SDCND</figcaption></figure><p>These diagrams of how nodes connect and behave are called “Compute Graphs” .</p><p><strong>Beginning with ROS:</strong></p><p>You can install it using the official documentation. In my case I installed ROS Lunar so here you have the link: <a href="http://wiki.ros.org/lunar/Installation/Ubuntu">http://wiki.ros.org/lunar/Installation/Ubuntu</a></p><p>It is not possible to set the ROS environment variables using ./opt/ros/kinetic/setup.bashcause it exits the current environment and creates a new one which variables are destroyed after the execution ends. In this case you should use the “source” command.</p><p>Some interesting commands:</p><p>rosnode list: Shows a list of all the active nodes<br>rostopic list: Same but for topics.</p><p>The information these topics provide us may seem unclear, that’s why there is another command called “rostopic info”.</p><p>The “rostopic list” command is not telling us which nodes are publishing or subscribing to a topic or what type of messages are passing around. With “rostopic info” we get all that information. Let’s apply it to the topic “/turtle1/cmd_vel”. The result is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*jpphuwGMdJnCj8xu29fScg.png" /></figure><p>It tells us which are the publishers and the subscribers and then the type of messages they are passing.</p><p>With “rosmsg show” we get more information about the messages listed above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*VDWet_TqNNfSUMqUS6XcJw.png" /></figure><p>There is one vector for linear velocity and another one for angular velocity. Each one consists on 3 different floating points 64 bits components.</p><p>Let’s see what is inside the “Twist.msg” message definition.</p><p>rosed geometry_msgs Twist.msgs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*jihX3ir4yK13ajXFWuLCKA.png" /></figure><p>This still does not provide much information about the message. We can directly echo the topic so we can see what is happening inside:</p><p>rostopic echo /turtle1/cmd_vel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*kcZzNwf3xCd8R-qhAGuYBA.png" /></figure><p>Some information we can get from this caption is, for example that the rotation is given in radians.</p><p><strong>Packages and Catkin Workspaces</strong></p><p>Catkin packages are directories containing a variety of resources. They may contain source code for nodes, useful scripts, configuration files, etc.</p><p>First you need to create the top level Catkin workspace directory and sub-directory. Use the command mkdir -p ~/catkin_ws/src</p><p>Then navigate to the src directory:</p><pre>$ cd ~/catkin_ws/src</pre><p>and now initialize the workspace:</p><pre>$ catkin_init_workspace</pre><p>Let’s list the contents of the current directory to see what changed.</p><pre>$ ls -l</pre><p>Notice that a symbolic link (CMakeLists.txt) has been created to /opt/ros/kinetic/share/catkin/cmake/toplevel.cmake</p><p>and then: catkin_make at the “catkin_ws” level.</p><p>Furthermore there are two new files, “build” and “devel” folder.</p><p>“build” is just a space for C++ packages.</p><p>“devel” directory does contain something of interest, a file named setup.bash. This setup.bash script must be sourced before using the catkin workspace.</p><p>One of the biggest benefits from ROS is that it already has a large community of users and developers, so there is a lot of code already implemented. Let’s clone an existing package and add it to our new workspace.</p><p>Let’s navigate to the src menu:</p><pre>$ cd ~/catkin_ws/src<br>$ git clone https://github.com/udacity/simple_arm_01.git simple_arm</pre><p>And then build the workspace:</p><pre>$ cd ~/catkin_ws<br>$ catkin_make</pre><p>You will see an error adverting us something like: Could not find a package configuration file provided by “controller_manager” with any of the following names…</p><p>So easily searching on Google we can figure out the name of the missing package and installing it for our distribution:</p><pre>$ sudo apt-get install ros-lunar-controller-manager</pre><p>Let’s go back to the top of our directory and build it again.</p><pre>$ cd ~/catkin_ws<br>$ catkin_make</pre><p><strong>roslauch</strong></p><p>Running multiple nodes by hand can be tortuous. “roslaunch” allows you to launch several nodes with one simple command, set default parameters on the Param Server, automatically respond processes that have died and more.</p><p>source devel/setup.bash is responsible for setup all the environment variables responsible for letting the system find all the packages, libraries…</p><p>Let’s try it:</p><p>roslaunch simple_arm (and here we press tab) -&gt;</p><p>roslaunch simple_arm robot_spawn.launch</p><p>You should visualize a robotic arm swinging around loosely:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WDig3NAfr-YrYXTMafdm7g.png" /></figure><p>Controller Spawner couldn’t find the expected controller manager ROS interface. It seems that we are missing a runtime dependency. ROS packages have two kinds of dependencies, run dependencies and build dependencies.</p><p>The “rosdep” tool will check for packages missing dependencies and install them. Just type: rosdep check simple_arm</p><p>It will output something like:</p><blockquote>System dependencies have not been satisified:<br>apt ros-lunar-gazebo-ros-control<br>apt ros-lunar-effort-controllers<br>apt ros-lunar-joint-state-controller</blockquote><p>If you want “rosdep” to install these packages:</p><pre>$ rosdep install -i simple_arm</pre><p>To be continued…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c628bafb87c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extended Kalman Filters for Dummies]]></title>
            <link>https://medium.com/@serrano_223/extended-kalman-filters-for-dummies-4168c68e2117?source=rss-49781efb5948------2</link>
            <guid isPermaLink="false">https://medium.com/p/4168c68e2117</guid>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[cars]]></category>
            <category><![CDATA[self-driving-cars]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[autonomous-cars]]></category>
            <dc:creator><![CDATA[Raúl Serrano]]></dc:creator>
            <pubDate>Fri, 18 Aug 2017 17:06:27 GMT</pubDate>
            <atom:updated>2017-08-18T17:16:23.995Z</atom:updated>
            <content:encoded><![CDATA[<p>Starting from Wikipedia:</p><blockquote><strong>“Kalman filtering</strong>, also known as <strong>linear quadratic estimation</strong> (<strong>LQE</strong>), is an <a href="https://en.wikipedia.org/wiki/Algorithm">algorithm</a> that uses a series of measurements observed over time, containing <a href="https://en.wikipedia.org/wiki/Statistical_noise">statistical noise</a> and other inaccuracies, and produces estimates of unknown variables that tend to be more accurate than those based on a single measurement alone, by using <a href="https://en.wikipedia.org/wiki/Bayesian_inference">Bayesian inference</a> and estimating a <a href="https://en.wikipedia.org/wiki/Joint_probability_distribution">joint probability distribution</a> over the variables for each timeframe.”</blockquote><p>Let’s say that “Bayesian inference” has to do with statistics. Its goal is to make predictions using all the information currently available until new information is generated. With this statement we can already get the main idea from Kalman Filters.</p><p>It is considered a Sensor Fusion Algorithm because it uses many inputs from different sensors that work better than the estimate obtained by only one measurement.</p><p>It has to deal with the Uncentainly of the Noise Sensor as well as external factors.</p><p>The Kalman Filter produces an estimate of the state of the system averaging all the Predictions about the state and the New Measurements. It uses a <strong>Weighted Average </strong>that selects the relevant data.</p><p>It works recursively but it doesn’t need the whole story, just the last “best guess”.</p><p>There is another concept called <strong>Kalman Gain. </strong>It is defined as a relative importance given to the measurements and to the current state estimate. We can tune this gain depending of the results we want to obtain. With a high gain the system places more weight to the most recent measurements so the system is going to fit them faster, more responsively. If the gain is lower, the system pays more attention to the predictions.</p><p>To summarize this, a gain closer to one will result in a jumpy estimated trayectory while with a gain close to zero the system will smooth out noise but decrease responsiveness.</p><p>For doing the calculations, “ the state estimate and covariances are coded into <a href="https://en.wikipedia.org/wiki/Matrix_(mathematics)">matrices</a> to handle the multiple dimensions involved in a single set of calculations”. Let’s says as we have multiple dimensions it is tricky to work with functions. To simplify the process we arrange the data into Matrices.</p><p>Let’s imagine a car that is detecting a pedestrian, this would be its processing flow. I’m going to take into account that our car has two sensors, Lidar and Radar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CCyfO0x0LZKADLjj.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><ul><li>First the system receive a measurement from the pedestrian position relative to a car.</li><li>The system initializes the pedestrian position based on the first measurement.</li><li>After a time period called Δ<em>t </em>the car will receive another sensor measurement.</li><li>As we are working with Extended Kalman Filter we assume that the velocity is constant, therefore we calculate the next position using <em>velocity*Δt. </em>This step is called<strong> Predict.</strong></li><li>Now the model compares the predicted location with what the sensor says. This is called <strong>Update. </strong>The Kalman Filter will give more importance to the predicted location or to the measured location depending on the uncertainty of each one.</li><li>The car keeps predicting and updating the postion of the pedestrian.</li></ul><p>It can be the case when the car receives measurements from different sensors at the same time. What the system does is doing one Update right after the other using the same Prediction for both Updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/0*IKBwcLZJSukjUjJb.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>Let’s talk now about maths and physics. Int the <strong>Prediction step</strong> we assume that in every time step the pedestrian keeps going at the same velocity, thus the next state can be described with this equation.</p><p><em>x</em>​′​​=<em>Fx</em>+<em>ν</em></p><p>As we don’t know exactly how the pedestrian has behaved in this last time step, it can accelerate or change the direction of movement, our uncertainty increases:</p><p><em>P</em>​′​​=<em>FPF_t</em>+<em>Q (F_t means F transpose)</em></p><p>As reminder, <strong>F</strong> is the Transition Matrix (the one that deals with time steps and constant velocities) and Q is the Covariance Matrix (the one that deals with the uncertainty). Let’s say there is a relation between the Uncertain and the the velocity, the <strong>Covariance Q</strong> is proportional to the velocity being bigger the Uncertainty whith higher velocities and more accurate with lower ones. This Process has a noise wich notation can be written as <em>ν</em>∼<em>N</em>(0,<em>Q</em>) wht means zero mean and covariance Q, <strong>Gaussian Distribution</strong> is the proper name.</p><p>There is another function called State Transition Function <strong>Bu</strong> that turns our equation into:</p><p><em>x</em>​′​​=<em>Fx</em>+<em>Bu</em>+<em>ν</em></p><p>We are not going to pay much attention to it. Let’s say it predicts the position taking into account the acceleration of the car as well. For our model we assume that the acceleration is constant.</p><p>Later in the <strong>Update step</strong> we compare where we think the pedestrian is with the sensor information:</p><p><em>y</em>=<em>z</em>−<em>Hx</em>​′</p><p><em>x</em>​′​​ is where we predict the object to be after time Δ<em>t.</em></p><p>Multiplying by the measurement function <strong>H matrix</strong> will drop the velocity information from the vector x. Now we can compare our belief of reality with the Lidar measurement position.</p><p>Using matrices handle mutliples dimensions in our set of calculations. This allows for a representation of linear relationships between different state variables (such as position, velocity, and acceleration). Here the matrices start to show up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/149/1*JdMasbGwFkefJ5jP3wa-tw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/1*r1MXuLrDRd8XXX3vJhWSLg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*3z15-kkd62da8Z22y9cgYQ.png" /></figure><p>So first we calculate the time intervals and then we estimate the 2D position and the 2D velocity. We are assuming that the velocity is constant between time intervals.</p><p>The State Transition Matrix contains the information for estimate the position and velocity in shape of a matrix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*WFu4g9yauIoxgkN0j6ukMw.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>Remember, time intervals are not constant:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*M36G6yc47UtaLTHdSTRVCw.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>As Time Interval increases we add more uncertain about our position and velocity to the State Covariance P.</p><p>We can divide the State Transition Matrix into two parts: <strong>Deterministic part</strong> and <strong>Stochastic part</strong>. The Stochastic part has to do with calculating the Covariance Matrix. This photo may help you to figure out the relation between both parts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jjq3tL2PXLiBWGR2oKpKkQ.png" /><figcaption>From my notes</figcaption></figure><p>As you can see the Noise vector can be splitted up in a non random matrix (4x2) and a random matrix (2x1).</p><p>Covariance matrix is about expectations as we don’t know yet how the Noise Vector is going to be. We can define it as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*cZ4aYBHhpTQoAj9QvgdRtA.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>The Process Covariance is equals to the Expectation of the noise times he noise transpose. As I showed before the noise can be decomposed in G times a.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*xgixOen5hLCJaltlS3aHhQ.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>As G doesn’t contain random variables we can put it outside. Let’s say now we have 3 statisticals moments:</p><ul><li>The expectation of the acceleration in x (ax).</li><li>The expectation of the acceleration in y (ay)</li><li>The expectation of the product. As ax and ay are not correlated this expectation is zero.</li></ul><p>When we multiply all the matrices we obtain:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*T5lPfuuVHprN7eU_5V5UKQ.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>We are going to obtain the data from two kind of measurements (sensors):</p><ul><li>Laser Measurements</li><li>Radar Measurements</li></ul><p><strong>Laser Measurement</strong> allows us to get the current position of the object but not its velocity. On the other hand Laser Measurements have more resolution.</p><p><strong>Radar Measurement </strong>goes further and allows us to get the velocity information as well although it is a little bit tricky. We are used to work with Cartesian Coordinates but this measurement comes in shape of Polar Coordinates.</p><p>This introduces a new kind of matrix, H. Let’s have a look to the next image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-mLp4evZUMgYkemB.jpg" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>The left side of the image represents a common Kalman filter. You just need to multiply H*x´ to get the position. In the rigth side the process is more complex, you need to calculate the mapping manually to convert from cartesian coordinates to polar coordinates.</p><p>Let’s start talking about <strong>Laser Measurements. </strong>The Lidar Measurement is coming in the next shape:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*MWbLusBPAYpzWNX5KdK9sA.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>During the Update step we need to compare this measurement with the one predicted. If you remember the Prediction Matrix has the shape:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/1*JPuedXIn55_1_qsWJ7MPEQ.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>So we need to get rid of the velocity component. It is easy to think of a matrix to perform that task, the H matrix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/204/1*uzAV8w0t1JWmYqlAxm2g9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/1*GLRrMG_uh7FzRfu6m4805Q.png" /></figure><p>The prime notation (´) means that you have already computed the Prediction Step but you haven’t updated the measurement yet.</p><p>But these measurements have their own covariance as well. Each component px and py is affected by a random noise. Our noise vector <strong>w</strong> has the same dimensions as the Measurement Vector <strong>z</strong>. If we multiply the noise vector by its transpose then we have a new covariance matrix <strong>R:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*nkWu0hVfdJMGKSCqlczZbQ.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>There are some zeros in the other diagonal that means that <strong>px</strong> and <strong>py</strong> noises are not correlated between eachother. You may wonder where are these noise values coming from, they are provided by the manufacturer.</p><p>Now let’s have some fun, <strong>Radar Measurements</strong> are the other part of the story. Unlike the Laser, Radar can measure <strong>radial velocity.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*75bsOE_ietUITex_bfqXVw.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>To make this simple to understand let’s plot our system. The origin from the plot represents our car and the point, the pedestrian.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*SjefEG2LETeQ5IYfEhCaHg.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p><strong>x</strong> always points in the direction of movement of the car and <strong>y</strong> to the left. <strong>Rho</strong> is the distance from the origin to the pedestrian. The bearing <strong>phi</strong> is the angle between rho and the x direction and rho dot is the change rate of rho.</p><p>It doesn´t exist any matrix <strong>H</strong> as for Lidar Measurement that will map the state vector <strong>x</strong> into Polar Coordinates. We need to map it manually converting from Cartesian to Polar coordinates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*x5UihcZTBCPJg6BRauB7BQ.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><p>We can linearize the system using <strong>First Order Taylor Expansion.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vDjn_2OKgJ9h6cWQ.png" /><figcaption>Taken from Udacity SDC Nanodegree</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PjYnYqbcESJ2yqwEWBF1A.jpeg" /><figcaption>From my notes</figcaption></figure><p>What Taylor does is trying is to predict the behaviour of a linear function taking into account a starting point, in this case the mean (which is zero).</p><p>But watch out!, as we are working with several dimensions the partial derivate turns into a Jacobian with this shape:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*TOrRub-1-hRaTbsOR7-CKA.png" /><figcaption>Taken from Udacity SDC</figcaption></figure><p>Let’s summarize the difference between Kalman Filters and Extended Kalman Filters:</p><ul><li><strong>H matrix</strong> in Kalman filters will be replaced by <strong>Hj (Jacobian</strong>)</li><li>To calculate <strong>y</strong> the <strong>h function</strong> is used instead of the <strong>H matrix.</strong></li><li>To calculate<strong> <em>x</em>​</strong>′​​, the prediction update function,<strong> <em>f</em></strong>, is used instead of the <em>F</em> matrix.</li><li>The <strong><em>F</em> matrix</strong> will be replaced by <strong><em>F</em>​<em>j</em>​​ </strong>when calculating<strong> <em>P</em>​′​​.</strong></li></ul><p>The matrices with j are Jacobians. As the linearization point changes I have to recompute the Jacobians at every time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*14g4BMjt9c8x_6wg.jpg" /><figcaption>Taken from Udacity SDC</figcaption></figure><p>This is my personal overview about Kalman Filters. I might have commited typos or conceptual errors troughout the article, if so all the feedback is welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4168c68e2117" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Talking about Flying Cars]]></title>
            <link>https://medium.com/@serrano_223/talking-about-flying-cars-9340731bb52b?source=rss-49781efb5948------2</link>
            <guid isPermaLink="false">https://medium.com/p/9340731bb52b</guid>
            <category><![CDATA[self-driving-cars]]></category>
            <category><![CDATA[cars]]></category>
            <category><![CDATA[planes]]></category>
            <category><![CDATA[flying]]></category>
            <category><![CDATA[silicon-valley]]></category>
            <dc:creator><![CDATA[Raúl Serrano]]></dc:creator>
            <pubDate>Sun, 25 Jun 2017 10:36:12 GMT</pubDate>
            <atom:updated>2017-06-25T10:36:12.921Z</atom:updated>
            <content:encoded><![CDATA[<p>So far Silicon Valley strategy was only programming and seminconductor based devices, let’s go further. Kitty Hawk’s flying car maybe doesn’t have the appearance of a car, you could say it is taken from an scify movie.</p><p>There are more than dozen start-ups that are taking on the dream of the flying cars. They all get the same conclusion, one day flying cars wouldn’t be a dream. But the problem is not about technology anymore, as it usually happens the main challenge is convincing the people about their posibilities.</p><p>Probably the name “Kitty Hawks’s” doesn’t sounds familiar to you but what if I mention Larry Page, even Sevastian Thrun (my self-driving car Nanodegree professor, regards) probably the most influential person into robotics cars. They are the main characters involved in that company.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDYBZxEvd9Lo%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDYBZxEvd9Lo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDYBZxEvd9Lo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/db6b9c09dc711e3a6f6ae38f998a27eb/href">https://medium.com/media/db6b9c09dc711e3a6f6ae38f998a27eb/href</a></iframe><p>We are already facing a huge resistance to the idea of unnamed drones flying over urban areas, flying cars would face the same. The whole world will need a new air traffic control system.</p><p>Back in Europe we find the Vahana flying car project. “Even addressing a small fraction of the total market will result in high production rates. Vahana is positioned to make the case for a new generation of aerial vehicles and nurture an ecosystem that will help enable the vertical cities of the future.” You just need your mobile app and the “device” will use dedicated areas for landing and taking off.</p><p>One of Airbus’ ambition with this project is to relieve traffic congestion, it intends to open up urban airways developing this way the first electric, self-piloted passenger aircraft. A full scale test will be held by the end of 2017. Anyway they admit “getting to fully deployed urban air mobility is likely about 10 years away”.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZaKD6LYj5eE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZaKD6LYj5eE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZaKD6LYj5eE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/081e2a505b9580848d1ea841833b6a49/href">https://medium.com/media/081e2a505b9580848d1ea841833b6a49/href</a></iframe><p>There is another well-know player in this game, what if i mention Uber? Its project its called Elevate althoug they are not actually developing its own ariborne vehicle. They say the first want to make sure their device is safe enough.</p><p>“In addition, we believe that a successful, optimised on-demand urban VTOL operation will necessitate a significantly higher frequency and airspace density of vehicles operating over metropolitan areas simultaneously. In order to handle this exponential increase in complexity, new ATC [air traffic control] systems will be needed.”</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FyGaeBsdu180%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyGaeBsdu180&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyGaeBsdu180%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6c759fd1bb6541a7d0375ff832a51f1/href">https://medium.com/media/e6c759fd1bb6541a7d0375ff832a51f1/href</a></iframe><p>And what is the main requirement for making a flying car safer? Two letters, AI. Some pioner universities in robosystems as Carnegie Mellon are already working in preparing this robots to situations like: What if the landing track becomes unavailable suddenly?</p><p>Communication is the other big word in this race, then other company shows up, Ehgang. Now we are moving to Asia. “The 4G data network is used in communication between the [vehicle] and the ground control centre. The company had also provided the support needed to ensure the continued communication between the[Ehang] and the control centre through M2M and LTE technologies.”</p><p>Here Asia has some advantages, above all Dubai. They are willing to change their laws for being in the top of the technology war. Going back to Ehgang, you don’t need to fly the drone yourself, everything is done via remote control as you can spot in the picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*iVfvakJCWlGuDAjP.jpg" /></figure><p>You just enter into the car, tap your destination on the touchscreen and let the vehicle do the rest. It can fly up to 160 km/h if you are in a rush. Now let’s talk about the price, starting at $260,000.</p><p>Self Driving Cars are already here, Flying Cars is just a matter of time, we might therefore putting some savings away for the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9340731bb52b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>