<?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 Van Malleghem Antoine on Medium]]></title>
        <description><![CDATA[Stories by Van Malleghem Antoine on Medium]]></description>
        <link>https://medium.com/@a.vanmalleghem?source=rss-785e835549fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Jt_gEBConq4aZVVyNB0wwg.png</url>
            <title>Stories by Van Malleghem Antoine on Medium</title>
            <link>https://medium.com/@a.vanmalleghem?source=rss-785e835549fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:39:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@a.vanmalleghem/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[Test GPIO and PWM pins on Jetson Nano]]></title>
            <link>https://medium.com/@a.vanmalleghem/test-gpio-and-pwm-pins-on-jetson-nano-bd9cb07667d0?source=rss-785e835549fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd9cb07667d0</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[jetson-nano]]></category>
            <category><![CDATA[pwm]]></category>
            <category><![CDATA[gpio]]></category>
            <category><![CDATA[bash]]></category>
            <dc:creator><![CDATA[Van Malleghem Antoine]]></dc:creator>
            <pubDate>Wed, 29 Mar 2023 14:01:52 GMT</pubDate>
            <atom:updated>2023-03-29T14:01:52.652Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you like this article, don’t hesitate to like and/or comment it. You can also follow me for more stories around robotics / embedded systems. Thanks in advance for your support.</em></p><p>In my previous story, I connected an Hat-MDD10 to my Jetson Nano using the 40-pins header. The purpose was to control a PWM driver. You can find the full story here : <a href="https://medium.com/@a.vanmalleghem/integrate-pwm-driver-for-dc-motors-with-jetson-nano-13ead585069a">https://medium.com/p/13ead585069a</a></p><p>In this context, I had to control 4 different pins. Indeed, for each motor, I had one GPIO pin for the direction (clockwise/counterclockwise) and one PWM pin for the speed. I had 2 motors so… 4 pins.</p><p>We all know that hardware is hard. When the hardware is complete, we want to verify everything is ok. That’s the purpose of this article.</p><p>First of all, you have to know that a 1-to-1 mapping exists between the pin number and it’s linux number in sysfs. You can find this mapping in the “Linux” column of the picture below (<a href="https://forum.dronebotworkshop.com/jetson-nano/jetson-nano-and-the-mdd10/">found here</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9stZ-MksB8ul82THJmjiVQ.png" /></figure><p>For example, pin32 is 168 in linux while pin12 is 79.</p><p>Now, let’s say you want to test PIN12, you can execute the following commands :</p><pre>echo 79 &gt; /sys/class/gpio/export # activate it<br>echo out &gt; /sys/class/gpio/gpio79/direction # output type (not an input)<br>echo 1 &gt; /sys/class/gpio/gpio79/value # send 1 (HIGH)</pre><p>A 1 is now send to PIN12 and you can verify that the behavior is as expected.</p><p>It works to test GPIO (high and low values) but what if you want to test PWM instead ? You can do it aswell with the following example (for PWM0)</p><pre>echo 0 &gt; /sys/class/pwm/pwmchip0/export # enable PWM0. echo 2 to enable PWM2<br>echo 50000 &gt; /sys/class/pwm/pwmchip0/pwm0/period # set period<br>echo 25000 &gt; /sys/class/pwm/pwmchip0/pwm0/duty_cycle # set duty_cycle<br>echo 1 &gt; /sys/class/pwm/pwmchip0/pwm0/enable # enable</pre><p>In conclusion, you are now able to control GPIO and PWM pins of the jetson nano using bash.</p><p>Don’t hesitate to contact me if you have any question. If you want to follow our project, you can visit our website and register to our newsletter : <a href="https://www.otto-project.golf/">https://www.otto-project.golf/</a> (it is in french for now but your browser is able to deal with it I think).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd9cb07667d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate PWM driver for DC motors with Jetson nano]]></title>
            <link>https://medium.com/@a.vanmalleghem/integrate-pwm-driver-for-dc-motors-with-jetson-nano-13ead585069a?source=rss-785e835549fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/13ead585069a</guid>
            <category><![CDATA[pwm-controller]]></category>
            <category><![CDATA[pinmux]]></category>
            <category><![CDATA[cytron]]></category>
            <category><![CDATA[jetson-nano]]></category>
            <category><![CDATA[pwm]]></category>
            <dc:creator><![CDATA[Van Malleghem Antoine]]></dc:creator>
            <pubDate>Wed, 22 Mar 2023 15:02:16 GMT</pubDate>
            <atom:updated>2023-03-22T15:02:16.247Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you like this article, don’t hesitate to like and/or comment it. You can also follow me for more stories around robotics / embedded systems. Thanks in advance for your support.</em></p><p>In this story, I would like to explain how you can integrate a Nvidia Jetson Nano with an <a href="https://www.cytron.io/p-10amp-6v-24v-dc-motor-driver-hat-for-rpi-2-channels">Hat-MDD10</a> to drive your DC motors with PWM.</p><h3>Hardware setup</h3><p>From the Hat-MDD10 official <a href="https://docs.google.com/document/d/19JLDnzU0y-9FKH4ZXm0lk4xtMJKtaKTDBT5ulGgj8UI/view">User’s Manual</a>, you can find the following picture :</p><figure><img alt="Hardware configuration of the Hat-MDD10" src="https://cdn-images-1.medium.com/max/617/1*wKXe8ng5Z-0zQYtlgxjuaQ.png" /></figure><p>From Nvidia documentation, you can find that you have 2 PWM pins on your Nano: 32 (PWM0) and 33 (PWM2). For directions, you can use the <a href="https://jetsonhacks.com/nvidia-jetson-nano-j41-header-pinout/">GPIO pins you want</a> (we choose 12 and 13).</p><p>One remaining task : don’t forget the ground ! We choose pin 25 of the header on Jetson Nano</p><p>In summary :</p><ul><li>PWM1 is connected to the pin33 of the header on Jetson Nano</li><li>PWM2 is connected to the pin32 of the header on the Jetson Nano</li><li>DIR1 is connected to the pin13 of the header on the Jetson Nano</li><li>DIR2 is connected to the pin12 of the header on the Jetson Nano</li><li>GND is connected to the pin25 of the header on the Jetson Nano</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pVlI0sK_vE8IaRZfKWQjMQ.jpeg" /><figcaption>Global setup</figcaption></figure><h3>Software setup</h3><p>Now that everything is connected, you must set the pin 32 and 33 as PWM pins. Otherwise, you will not be able to send PWM commands. There is several ways to do so. I tried 4 different ways. Let me explain my conclusions for each tentative.</p><ul><li>With <a href="https://docs.nvidia.com/jetson/archives/r35.1/DeveloperGuide/text/HR/ConfiguringTheJetsonExpansionHeaders.html#running-jetson-io">the script</a> provided by Nvidia</li></ul><pre>sudo /opt/nvidia/jetson-io/jetson-io.py<br># UI :<br># - Configure Jetson 40pin<br># - Configure header pins manually<br># - Activate pwm0 [32] and pwm2 [33]<br># - Save <br># - Reboot</pre><p>This way is the easiest way proposed by Nvidia but I tried it and <strong>looks like it doesn’t work</strong>. I guess it depends on several things like the Jetpack version for example.</p><ul><li>With <a href="https://docs.nvidia.com/jetson/archives/r35.1/DeveloperGuide/text/HR/ConfiguringTheJetsonExpansionHeaders.html#command-line-interface">the CLI</a> provided by Nvidia</li></ul><pre>sudo /opt/nvidia/jetson-io/config-by-function.py 1=&quot;pwm0 pwm2&quot; -o dtbo<br>dtc -I dtb -O dts -o my-overlay.dts /boot/kernel_tegra210-p3448-0000-p3449-0000-b00-hdr40-user-custom.dtbo<br>dtc -O dtb -o my-overlay.dtbo -@ my-overlay.dts<br>sudo cp my-overlay.dtbo /boot</pre><p>This does the same as the first way but programmaticaly. Consequently, it <strong>doesn’t work on my Nano</strong>.</p><ul><li>Manually using busybox</li></ul><pre># Enable pin 32 / PWM0<br>sudo busybox devmem 0x700031fc 32 0x45<br>sudo busybox devmem 0x6000d504 32 0x2<br><br># Enable pin 33 / PWM2<br>sudo busybox devmem 0x70003248 32 0x46<br>sudo busybox devmem 0x6000d100 32 0x00</pre><p>And guess what, <strong>it works </strong>! You can now control your motors with PWM. Unfortunately, you will see that it stops working if you reboot your Nano. To solve this issue, put these 4 commands (without sudo) into the “rc.local” file and <a href="https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd">enable the related service</a>.</p><p>In my opinion, this is more a workaround than the cleanest solution but at least it allows you to quickly have a working solution.</p><ul><li>With pinmux</li></ul><p>This is the best, cleanest and recommended way to accomplish this task. Unfortunately, you have to re-compile Uboot, re-flash your SD card and you need a Windows to use a provided excel sheet. If you want to implement it, here is a great link : <a href="https://www.seeedstudio.com/blog/2020/05/27/configure-pwm-output-on-jetson-nano-m/">https://www.seeedstudio.com/blog/2020/05/27/configure-pwm-output-on-jetson-nano-m/</a></p><p>You can find the last version of the excel sheet here : <a href="https://developer.nvidia.com/jetson-nano-pinmux">https://developer.nvidia.com/jetson-nano-pinmux</a></p><p>Don’t hesitate to contact me if you have any question. If you want to follow our project, you can visit our website and register to our newsletter : <a href="https://www.otto-project.golf/">https://www.otto-project.golf/</a> (it is in french for now but your browser is able to deal with it I think).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13ead585069a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TensorRT inference with ROS]]></title>
            <link>https://medium.com/@a.vanmalleghem/tensorrt-inference-with-ros-afa0c4fa33c6?source=rss-785e835549fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/afa0c4fa33c6</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tensorrt]]></category>
            <category><![CDATA[golf]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[robots]]></category>
            <dc:creator><![CDATA[Van Malleghem Antoine]]></dc:creator>
            <pubDate>Mon, 21 Nov 2022 08:01:48 GMT</pubDate>
            <atom:updated>2022-11-22T07:49:15.045Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you are here, I assume you already know the advantages of TensorRT for inference and this discussion is consequently out of scope. For curious people, I used TensorFlow to create the model and then convert it in pure TensorRT. This article talks about Python ROS.</em></p><p>For the product I currently develop, I had to create an object detection model for an embedded system involving an <strong>Nvidia GPU</strong>. The hardware is part of the famous Nvidia <strong>Jetson</strong> family and the product itself is <a href="https://www.otto-project.golf/"><em>an autonomous golf trolley</em></a>. This trolley has a lot of features and that’s why the software is based on ROS (<strong>noetic</strong> for now).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLvhUpBaYDk39LNr9p8eTQ.png" /><figcaption>Nvidia logo</figcaption></figure><p>Let’s go back to my usecase : I have a model taking an image from the camera as input and able to output what’s on this image (a bunker on a golf course for example). With ROS, the traditional way to handle it is :</p><ul><li><strong>Initialize the model</strong> when starting the node. For a TensorRT model, you will typically create the context and allocate GPU resources during this step.</li><li><strong>Create a callback</strong> subscribed to the image topic, doing inference and publishing detections to another topic.</li></ul><p>If you do that… You will run into an error at inference time :</p><pre>Error &quot;pycuda._driver.LogicError: &lt;your operation&gt; failed: invalid device context</pre><p>That’s because this device context is bound to a <strong>thread</strong>. You created the context during the initialization of the model so the context is bind to <strong>the main thread</strong>. Unfortunately, <em>a callback code in ROS doesn’t run on this main thread</em> and so the error becomes explicit.</p><p>It exists a workaround to deal with this issue : the usage of a timer in addition to the callback. The purpose is to move the inference logic to the main thread while the callback function acts like a buffer. Here is an implementation (I removed the ROS subscriber or publisher logic).</p><pre>image = None <br><br># This callback is triggered every time an image is published <br># in the camera topic<br>def image_callback(self, new_image):<br>    image = new_image<br><br># initialize the TensorRT model<br>detector = Detector()<br>rate = rospy.Rate(4)<br>while not rospy.is_shutdown():<br>    # use the TensorRT model <br>    predictions = detector.infer(image)<br>    <br>    # publish predictions to a topic.<br>    publisher.publish(predictions)<br>    <br>    # sleep to respect the specified rate 4/s here<br>    rate.sleep()</pre><p>Following this example, you will have a node publishing predictions 4 times each second based on the last image received.</p><p>For the experiment, I also tried to initialize the model the first time the callback is triggered. It works for 15–20 images before running into the same issue. It looks like callback function occurences don’t always run on the same thread.</p><p>TL;DR : I created this article especially because it isn’t that trivial to use TensorRT in ROS. Indeed, when you initialize your TensorRT model, you have to create a cuda device context. The think is that this <strong>context is bind to a thread</strong>. Why is it an issue with ROS ? Because callbacks are not executed in the main thread.</p><p><em>👉 Don’t hesitate to </em><strong><em>like</em></strong><em> this story if you find it interesting.</em></p><p>❓<strong><em>Comment</em></strong><em> if you have any question or feedback.</em></p><p><em>👉 You can also </em><strong><em>follow</em></strong><em> me for more stories around robotics.</em></p><p>❤️ <em>Thanks in advance for your support.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afa0c4fa33c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configure GPS based navigation in Gazebo]]></title>
            <link>https://medium.com/@a.vanmalleghem/configure-gps-based-navigation-in-gazebo-22d0e7665d13?source=rss-785e835549fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/22d0e7665d13</guid>
            <category><![CDATA[gazebo]]></category>
            <category><![CDATA[gps-navigation]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[robot-operating-system]]></category>
            <category><![CDATA[gps]]></category>
            <dc:creator><![CDATA[Van Malleghem Antoine]]></dc:creator>
            <pubDate>Mon, 10 Oct 2022 07:06:01 GMT</pubDate>
            <atom:updated>2022-10-10T07:06:01.028Z</atom:updated>
            <content:encoded><![CDATA[<p>Simulation is an important part of the implementation of a robot ! Even more in the context of a GPS based robot because it means you are working on an outdoor robot and without simulation you would have to go outside each time you want to test something.</p><p>Long story short, when you use a GPS sensor in a simulated world, you should be able to give a reference GPS coordinate to the simulator and it will be responsible of updating the robot coordinates according to this initial coordinate.</p><figure><img alt="The logo of Gazebo" src="https://cdn-images-1.medium.com/max/978/1*AsYYeVxVco4FxNYIBWuXGA.png" /><figcaption>Gazebo logo</figcaption></figure><p>In Gazebo, the main simulator of the <strong>ROS</strong> world, The first step is to configure a GPS plugin. In my case, I used the URDF format and the libhector_gazebo_ros_gps.so plugin with a <strong>ROS noetic</strong> robot. You can then define the reference/initial GPS coordinates in 2 different ways :</p><ul><li>In the GPS model plugin : In this case, you define the <strong>initial GPS coordinate of the robot</strong>. It means that wherever the robot starts on the Gazebo world, it will have this coordinate. You can implement it in XML using&lt;referenceLatitude&gt; and &lt;referenceLongitude&gt; tags directly into the plugin configuration. The drawback of this solution is that the GPS position of the world is not constant and depends on where you spawn the robot. That’s why another solution exists.</li><li>In the gazebo world : the major difference with the previous method is that you define the <strong>GPS coordinate of the world origin</strong>. It means that you fix the GPS position of your world and the robot GPS location is computed based on the world origin. To do so, be sure you removed the &lt;referenceLatitude&gt; and &lt;referenceLongitude&gt; tags from the plugin and instead set the &lt;useWorldSphericalCoordinates&gt; tag to true. Then, add the &lt;spherical_coordinates&gt; section to your world according to the <a href="https://gazebosim.org/api/gazebo/6.0/spherical_coordinates.html">specifications</a>.</li></ul><p>Eventually, you can verify the effect of each method by spawning the robot to different locations (using spawn_model node from gazebo_ros package for example) and rostopic echo the GPS topic name you defined in the plugin definition to see the actual position of your wonderful robot.</p><p>In conclusion, the most important part for the developer is to know if he wants to fix the initial position of the robot or of the world during its simulation. It really depends on your usecase. The second solution is a bit more complex and I consequently suggest you use the first one by default unless you really need a fixed world.</p><p><em>👉 Don’t hesitate to </em><strong><em>like</em></strong><em> this story if you find it interesting.</em></p><p>❓<strong><em>Comment</em></strong><em> if you have any question or feedback.</em></p><p><em>👉 You can also </em><strong><em>follow</em></strong><em> me for more stories around robotics.</em></p><p>❤️ <em>Thanks in advance for your support.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22d0e7665d13" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GPS based navigation on a map with ROS]]></title>
            <link>https://medium.com/@a.vanmalleghem/gps-based-navigation-on-a-map-with-ros-af2a1e90e6f9?source=rss-785e835549fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/af2a1e90e6f9</guid>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[golf-marketing]]></category>
            <category><![CDATA[golf]]></category>
            <category><![CDATA[robot-operating-system]]></category>
            <category><![CDATA[golf-trolley]]></category>
            <dc:creator><![CDATA[Van Malleghem Antoine]]></dc:creator>
            <pubDate>Mon, 26 Sep 2022 07:02:20 GMT</pubDate>
            <atom:updated>2022-09-26T07:02:20.004Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you like this article, don’t hesitate to like and/or comment it. You can also follow me for more stories around robotics. Thanks in advance for your support.</em></p><p>In the context of an R&amp;D project, I created an autonomous robot ables to navigate through golf courses while avoiding golfers, trees, bunkers and so on. A bit like a human, right ? More specifically, the purpose was to create a fully autonomous <a href="https://en.wikipedia.org/wiki/Golf_trolley">golf trolley</a>. In this article, I want to give my lessons learned as well as a path to follow in order to implement your own outdoor fully autonomous robot using ROS.</p><h3>Specifications</h3><p>I gave you a quick overview of what we expect from this robot but as an engineer you definitely know it isn’t enough to start the implementation. Let’s dive into what is required :</p><ul><li>The owner of the caddy must be able to give him a GPS goal with the help of a friendly user interface and without giving any other information to the caddy. In other words, the robot must automatically find its position at startup without any input from its golfer.</li><li>Golf rules are strict for trolleys : trolleys can’t go through a bunker, ride on the green and should avoid the rough. In addition to it, the robot can obviously not fall into water.</li><li>This golfer friend must avoid static objects like trees as well as dynamic objects like golfers, animals, other trolleys,…</li></ul><h3>Hardware</h3><p>I don’t want to go deep into this section because it isn’t the purpose of this article which is ROS oriented but that’s nevertheless mandatory to give you a quick overview of the choices my teammates and I made to achieve this goal.</p><figure><img alt="Gazebo representation of our trolley" src="https://cdn-images-1.medium.com/max/529/1*rf-5T67b1Qr6_ubUNGnIJg.png" /><figcaption>The gazebo representation of our trolley</figcaption></figure><ul><li>The robot is composed of 3 wheels as on the picture above : a front castor wheel and 2 back wheels. Each back wheel is controlled by a motor. It is a <strong>differential wheeled robot</strong>.</li><li>The main sensor is a <strong>GPS</strong>. In an outdoor environment, this kind of device is almost mandatory if you want to do autonomous navigation. But it isn’t sufficient on its own. Indeed, that kind of signal isn’t continuous and the provided accuracy isn’t acceptable. That’s why 2 other inputs provide odometry of the robot while it is moving : an <strong>IMU sensor</strong> and a<strong> feedback from the motors</strong>.</li><li>A <strong>camera</strong> ables to provide distance to an obstacle (human, animal, tree,…) is widely used to avoid them when the robot navigates to its goal.</li><li>Last but not least, the brain of the robot is a Jetson Nano from Nvidia. It isn’t mandatory for pure navigation stuff but some enhanced features not covered by this paper are GPU dependent.</li></ul><h3>Implementation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*yf432vT6bU_GuUY0JQqyxQ.jpeg" /></figure><p>And now, what I guess you are looking for since the beginning of this paper… The implementation using <strong>ROS Noetic</strong>. Of course, the main piece of the puzzle is the ROS navigation stack. While a lot of tutorials are provided for indoor navigation, you can’t find that much tutorials on outdoor navigation. That’s why I wanted to publish this paper.</p><p>Let me share with you a list of the different nodes in the final system. For each node, we can review its purpose and I can give you some insights on how to implement it on your own. I have voluntary omitted nodes responsible of converting raw input sensors (GPS, IMU and camera) signals in ROS standard format.</p><ul><li>rosbridge_websocket : the entrypoint of the system. This node is provided by the <a href="http://wiki.ros.org/rosbridge_suite">rosbdrige_suite</a> package and allow a simple web frontend to interact with the robot using websocket protocol. This node will receive GPS goal instructions from the user interface and convert it into a ros message published in a ros topic. Notice that it isn’t required for our usecase to use an action but it is something you can do if required.</li><li>gps_navigation_goal : this node listens to the ros topic described above and converts GPS goal in an understandable goal for the navigation stack. I created this node using C++ and it simply translates GPS coordinates into coordinates relative to the map frame. 2 steps are required to get the expected goal : convert longitude and latitude to UTM and then transform UTM coordinates to map frame. When it’s done, the goal is sent to the navigation stack.</li><li>map_server : this node is the standard node from the <a href="http://wiki.ros.org/map_server">map_server</a> package. That’s interesting to notice that you can specify the frame ID you want to localize your map into. In my case, I decided to use the map_image frame ID and keep the map frame for the initial position of the robot. Using another frame ID is the first step if your robot must automatically localize itself based on GPS signal. The other steps are provided by the 2 localizer nodes described below.</li><li>initial_localizer : provide the initial position of the robot. Most of the time, in other tutorials, this information is provided manually but our specification are clear for this point and the robot must be able to automatically find its position (translation + orientation) on the provided map. This custom node creates a static transformation between earth (the global frame) and map (frame for the initial position of the robot). To do so, you must convert GPS position toUTM format. The <a href="http://wiki.ros.org/geonav_transform">geonav_transform</a> package can help you.</li><li>map_image_localizer : provide the static transformation between earth frame and map_image based on GPS coordinates of the bottom left point of the map. You need of course to provide this GPS coordinate (using a parameter for example). Again, don’t forget to convert latitude and longitude to UTM before sending the transformation.</li><li>navsat_transform : this is a standard node from the <a href="http://docs.ros.org/en/noetic/api/robot_localization/html/index.html">robot_localization</a> package. In my case, the output is directly used by the ekf_filter_map node. In fact, I really follow the diagram <a href="http://docs.ros.org/en/noetic/api/robot_localization/html/integrating_gps.html">provided by the package itself</a></li></ul><figure><img alt="Overview on how to integrate GPS data using the robot_localization package. 3 different nodes are used : one to create the EKF Local (transformation between odom and base link), one to create the EKF global (transformation between map and odom) and one to get GPS odometry." src="https://cdn-images-1.medium.com/max/1024/1*PwomIQylgre5IqOAED0NdA.png" /><figcaption>Integrating GPS Data diagram from robot_localization package</figcaption></figure><ul><li>ekf_filter_map : on the diagram above, this is called EKF global. It provides the map to odom transformation based on GPS (output of navsat_transform), IMU and wheel odometry.</li><li>ekf_filter_odom : as the package suggests, it is the EKF Local and it provides the odom to base transformation based on IMU and wheel odometry. For this one, GPS is not used.</li><li>point_cloud_provider : provide point cloud information from images provided by the camera. This one is really related to the camera you use. You need a depth camera in order to get distances to points.</li><li>diff_drive_controller : <a href="http://wiki.ros.org/diff_drive_controller">controller</a> receiving a Twist from the navigation stack and able to output a command for each wheel. We had to provide a custom robot hardware implementation according to our robot motors specifications.</li><li>controller_rosserial : this node is provided by the <a href="http://wiki.ros.org/rosserial">rosserial package</a> and it receives the output commands from the controller and converts it to serial commands because it is the protocol used by our motors.</li><li>move_base : do I really need to talk about this one ? This is the main node for the navigation stack of course ! This one takes everything you did before and provide the smart algorithm so that your robot can move towards a given goal given the set of constraints I described above. It will for example use the map to avoid static objects like bunkers and the point cloud informations to avoid dynamic objects.</li></ul><p>That’s it ! I hope you have now a clear view on how to implement your own robot ables to localize itself in an outdoor environment and to navigate based on a global and local map.</p><p>Don’t hesitate to contact me if you have any question. If you want to follow our project, you can visit our website and register to our newsletter : <a href="https://www.otto-project.golf/">https://www.otto-project.golf/</a> (it is in french for now but your browser is able to deal with it I think).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af2a1e90e6f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish and monitor your website on AWS using Pulumi]]></title>
            <link>https://medium.com/@a.vanmalleghem/publish-and-monitor-your-website-on-aws-using-pulumi-187cf619d54f?source=rss-785e835549fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/187cf619d54f</guid>
            <category><![CDATA[pulumi]]></category>
            <category><![CDATA[checkly]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Van Malleghem Antoine]]></dc:creator>
            <pubDate>Thu, 15 Sep 2022 14:25:20 GMT</pubDate>
            <atom:updated>2022-09-15T14:28:52.651Z</atom:updated>
            <content:encoded><![CDATA[<p>You work for a startup and you would like to deploy your super website, an <strong>SPA</strong>, in a restricted list of countries. In the same time, you would like to <strong>monitor</strong> the availability of this website so that you are aware if something bad happens (yes, you know that something bad can happen… That’s a nice starting point). Of course, pricing is important and you don’t have any on-premise infrastructure. Consequently using cloud resources is a natural choice and you want to use <strong>AWS</strong>. In addition, you know how cloud resources are configurable so you want to have a reproducible infrastructure. That’s exactly the purpose of a challenge suggested by <a href="https://www.pulumi.com/challenge/startup-in-a-box/">pulumi</a> itself. Compared to the initial pulumi challenge, I want to add a constraint to the S3 bucket so that it can’t be accessed directly but only through the CDN (CloudFront distribution). That’s why I talk about a private S3 bucket.</p><p>In this context, here is what I achieve during this tutorial :</p><ul><li>Create a private S3 bucket</li><li>Deploy the website</li><li>Create a CloudFront distribution</li><li>Create a Checkly check</li></ul><figure><img alt="Pulumi logo" src="https://cdn-images-1.medium.com/max/300/1*Q9u9b2xRcyVbj0IXTbw7Fg.png" /></figure><p>Before diving into these steps, what is Pulumi ? In short, <a href="https://www.pulumi.com/">Pulumi</a> is a <strong>true</strong> and <strong>universal</strong> infrastructure as code (<strong>IaC</strong>) tool. In this sentence, words “true” and “universal” are important.</p><p>By “true”, I mean that you can write Pulumi code with several programming languages (Golang, Typescript, Java, .NET,…). It gives you all the benefits of these languages like unit testing, 3rd party libraries, creation of custom libraries for your company and all of this without having to learn a new language. You can really use the full power of the language of your choice.</p><p>The other important word is “universal”. Indeed, you can deploy your infrastructure using Pulumi on all major Cloud providers.</p><p>Let’s now deploy our startup website using it !</p><h3>Create a private S3 bucket</h3><p>The following code creates this bucket without any public access.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9750d34b97746b179f4ecddd8940efe/href">https://medium.com/media/a9750d34b97746b179f4ecddd8940efe/href</a></iframe><p>If you execute this pulumi code, you can see a new empty S3 bucket in your AWS account. It’s now time to deploy the content of your website to it.</p><h3>Deploy the website</h3><p>The deployment of the website follows the code snippet provided by the pulumi challenge. It deploys the content of a provided website directory. Don’t forget to install the “mime” package to infer content type from filename.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a97ae350525a5a0abc4c6510a13d7543/href">https://medium.com/media/a97ae350525a5a0abc4c6510a13d7543/href</a></iframe><p>Using the user interface, you can now observe that your bucket is not empty anymore. Nevertheless, if you try to access an object using it’s HTTP url, you will get an Access Denied response. No worries, that’s the expected behavior. It will avoid having a user directly accessing your S3 bucket without passing through the CDN.</p><h3>Create a CloudFront distribution</h3><p>To have a working CloudFront (a.k.a CDN in AWS) in front of a private bucket, we have to execute several actions.</p><ul><li>The first one is to create an origin access identity. This identity will represent the CloudFront and will allow us to authorize it to access our bucket.</li><li>Then we can create a CloudFront distribution. Don’t forget to take a look at the geoRestriction locations. This array contains countries ISO2 code where the website will be available. Add your country to the list so that you will be able to access it (you will see that I’m from Belgium, that’s right). Moreover, I added “DE” because the monitoring healtcheck is executed from “eu-central-1” (Frankfurt).</li><li>Create a BucketPolicy allowing the OAI (Origin Access Identity) to read everything into the bucket.</li></ul><p>The following code does all these steps for you. I voluntary omitted default values for the distribution but don’t hesitate to take a look at the documentation if you need to customize its behavior.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47dcd818998c6c3eea9d035dddab5e2e/href">https://medium.com/media/47dcd818998c6c3eea9d035dddab5e2e/href</a></iframe><p>After executing this code, your application is available through the CDN. You can easily find the domain name to use in order to access your website via the console or by creating a Pulumi output using the domainName property of the freshly created CloudFront distribution.</p><h3>Create a Checkly check</h3><p>Good news ! Checkly is now well integrated with Pulumi ! That’s easier than ever to create a Checkly check. The first step is to configure your accountId and apiKey to use with your Pulumi stack. You can do it by setting 2 environment variables like this :</p><p>$ export CHECKLY_API_KEY={YOUR_API_KEY}</p><p>$ export CHECKLY_ACCOUNT_ID={YOUR_ACCOUNT_ID}</p><p>OR You can add these values to your pulumi config file by setting “checkly:accountId” and “checkly:apiKey” configs. Don’t forget to set your apiKey as a secret. When it’s done, you can create a check either with inline code either by providing a path to a file. The second choice allows you to take advantage of your IDE. I don’t want to dive into how to create the check itself but instead ensure you know how to deploy it using Pulumi. To create the check, I recommend the <a href="https://www.checklyhq.com/product/pulumi-provider/">official documentation</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ffc5bf630b60e5b82e8577d8741c650b/href">https://medium.com/media/ffc5bf630b60e5b82e8577d8741c650b/href</a></iframe><p>Don’t forget to whitelist the specified locations in your CloudFront distribution. The final result is available on the Checkly website :</p><figure><img alt="The monitoring status on Checkly" src="https://cdn-images-1.medium.com/max/1024/1*92oRTL28TqcFm3iL7ImU3A.png" /><figcaption>Your checkly dashboard</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=187cf619d54f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>