<?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 Frank Kung on Medium]]></title>
        <description><![CDATA[Stories by Frank Kung on Medium]]></description>
        <link>https://medium.com/@k3083518729?source=rss-ca37093061db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4taJTAP-J8elHS8O.</url>
            <title>Stories by Frank Kung on Medium</title>
            <link>https://medium.com/@k3083518729?source=rss-ca37093061db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 01:24:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@k3083518729/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[Robot Localization using Laser Scanner and Pose-graph Optimization]]></title>
            <link>https://medium.com/@k3083518729/robot-localization-using-laser-scanner-and-pose-graph-optimization-fc40605bf5bc?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc40605bf5bc</guid>
            <category><![CDATA[localization]]></category>
            <category><![CDATA[robotics]]></category>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Thu, 05 Sep 2019 09:44:05 GMT</pubDate>
            <atom:updated>2019-09-05T09:44:05.300Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This is the research project during my internship in UC San Diego Existential Robotics Laboratory(ERL) 2019 summer. In this project we use Hokuyo Laser Scanner with CSM and GTSAM to achieve localization and run our algorithm onboard on Nvidia TX2 in Ubuntu18.04.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*miO4N4iAfOGo0to2hIpVOw.png" /></figure><p>ERL Racecar equiped with Nvidia TX2 computer, Hokuyo laser scanner, ZED stereo camera, IMU, and wheel encoders.</p><h3>GitHub:</h3><p><a href="https://github.com/kungfrank/icp_gtsam_localization">kungfrank/icp_gtsam_localization</a></p><h3>Real Robot Demo Video</h3><ul><li><a href="https://drive.google.com/file/d/1_k2YIY7HVO2xy-Rzm54KW5I0d2BVx68Q/view?usp=sharing">posegraph_bag_demo.mp4</a></li><li><a href="https://drive.google.com/open?id=1A_ZUJpiYa6hVECfYVhc-O7IT-Wl9gziG">racecardemo.mov</a></li></ul><h3>Third Party Introduction</h3><h4>CSM: Canonical Scan Matcher</h4><p><a href="https://censi.science/software/csm/">CSM</a> is a pure C implementation of a very fast variation of ICP using a point-to-line metric optimized for range- finder scan matching.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*BbjhHKV6q1ThXDUG2MXZ1w.png" /></figure><p>The ROS package we used in our project is</p><p><strong>Laser Sacn Matcher </strong><em>(</em><a href="http://wiki.ros.org/laser_scan_matcher"><em>http://wiki.ros.org/laser_scan_matcher</em></a><em>)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AAqC6szdrS9qGIPIjC4rYA.png" /></figure><figure><img alt="Caculate robot transformation from laser scan" src="https://cdn-images-1.medium.com/max/1024/1*zInY8SF6t6rCeGTH0hdb0Q.png" /><figcaption>Caculate robot transformation from laser scan data</figcaption></figure><h4>GTSAM</h4><p><a href="https://gtsam.org/">GTSAM</a> is a library of C++ classes that implement smoothing and mapping (SAM) in robotics and vision, using factor graphs and Bayes networks as the underlying computing paradigm rather than sparse matrices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pvKUL0IHFN0eb2RTKG7XLA.png" /><figcaption>factor graph with loop closure</figcaption></figure><h3>Our Approach: CSM+GTSAM</h3><h4>Part 1: Localization by pure CSM</h4><p>In this part we use <strong>Laser scan data</strong> on the racecar as the input of Laser Scan Matcher package. Also, use <strong>IMU</strong> to estimate the change of the <strong>orientation angle </strong>of the robot and <strong>Encoder </strong>to estimate the change of <strong>x, y, and orientation angle </strong>of the robot.</p><h4>why do we need GTSAM instead of pure CSM?</h4><p>Indeed, frame by frame laser scan matching in part1 can have good result in small-scale localization case. However, due to the frame by frame caculation, it can easily be affected by noise and cause <strong>accumulated error</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ITLB2UeU5-P6olEuxY-jag.png" /></figure><p>Thus, we can use <strong>Pose-graph Optimization</strong> to minimize the accumulated error by given more observation(laser scan matching). And GTSAM is a useful library to do pose-graph optimization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*46nVK2ck97ToXQP5i_q1ag.png" /></figure><h4>Part 2: Use GTSAM with CSM</h4><p>A loop-free topology provide by Laser Scan Matcher cannot improve from its initial configuration since there is no ‘contradiction’ in the graph. Thus, we use “<strong>history edges</strong>” to create loop in pose-graph, so that the graph can be optimize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n9r0SZZcKGr8SDACEERPSw.png" /></figure><p>p.s. in the launch file posegraph.launch you can see there is a parameter called history_num. If you set this parameter as 1, it will create edges between node1 to node3, node2 to node4... If you set it as 2, it will create edges between 1 to 3, 1 to 4, 2 to 4, 2 to 5... and so on.</p><h3>Installation and Usage</h3><p><strong>1. install laser_scan_matcher:</strong></p><pre>$ git clone <a href="https://github.com/AndreaCensi/csm.git">https://github.com/AndreaCensi/csm.git</a><br>$ cd csm<br>$ source install_quickstart.sh<br>$ sudo cp -r /home/frank/csm/deploy/bin /opt/ros/melodic/bin<br>$ sudo cp -r /home/frank/csm/deploy/include /opt/ros/melodic/include<br>$ sudo cp -r /home/frank/csm/deploy/lib /opt/ros/melodic/lib<br>$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/ros/melodic/lib/lib/pkgconfig<br>$ cd catkin_ws/src<br>$ git clone <a href="https://github.com/ccny-ros-pkg/scan_tools.git">https://github.com/ccny-ros-pkg/scan_tools.git</a><br>$ cd ~/catkin_ws<br>$ wstool init src<br>$ wstool merge -t src <a href="https://raw.githubusercontent.com/ccny-ros-pkg/scan_tools/indigo/.rosinstall">https://raw.githubusercontent.com/ccny-ros-pkg/scan_tools/indigo/.rosinstall</a><br>$ rosdep install — from-paths src — ignore-src — rosdistro indigo -r -y<br>$ catkin_make (or any build commands available in ROS, e.g. `catkin build`)<br>$ source devel/setup.bash</pre><pre><strong>test:<br></strong>$ roslaunch laser_scan_matcher demo.launch</pre><p><strong>2. install gtsam:</strong></p><pre>$ sudo apt-get install libboost-all-dev &amp;&amp; sudo apt-get install cmake<br>$ git clone <a href="https://github.com/borglab/gtsam.git">https://github.com/borglab/gtsam.git</a><br>$ cd gtsam<br>$ mkdir build<br>$ cd build<br>$ pip install Cython<br>$ cmake .. -DGTSAM_PYTHON_VERSION=2.7 -DGTSAM_INSTALL_CYTHON_TOOLBOX=Enabled -DGTSAM_WITH_TBB=OFF<br>$ make check<br>$ sudo make install<br>$ cd /usr/local/cython/<br>$ sudo python setup.py install</pre><pre><strong>test:<br></strong>$ cd ~/gtsam/cython/gtsam/examples<br>$ python OdometryExample.py</pre><p><strong>3. Download icp_gtsam_localization github repo:</strong></p><pre>$ git clone https://github.com/kungfrank/icp_gtsam_localization.git</pre><p><strong><em>Step1.</em></strong> Overwrite scan_tools package with the new scan_tools code in this repo.</p><p><strong><em>Step2.</em></strong> Put erl_graph_slam package in your workspace and compile it.</p><p><strong><em>Step3. </em></strong>Extract the rosbag file in posegraph_demo folder.</p><p>4. Run rosbag demonstration:</p><pre>$ roslaunch posegraph_demo rosbag.launch<br>$ roslaunch posegraph_demo rosbag_posegraph.launch</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc40605bf5bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Knightcar]]></title>
            <link>https://medium.com/@k3083518729/k-bot-a218c075e2ee?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/a218c075e2ee</guid>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Mon, 21 May 2018 04:17:29 GMT</pubDate>
            <atom:updated>2018-05-24T06:11:56.692Z</atom:updated>
            <content:encoded><![CDATA[<h4>Knightcar is a low-cost platform base on raspberry pi 3, comes with rpi3 official camera, wide-angle len, and YDlidar for learning autonomy.</h4><h4><strong><em>GitHub:</em></strong></h4><p><a href="https://github.com/kungfrank/Knight_car">kungfrank/Knight_car</a></p><blockquote>reference</blockquote><p><a href="https://duckietown.mit.edu/materials.html">https://duckietown.mit.edu/materials.html</a></p><h3>Installation</h3><h4>Download dependence</h4><pre>$ sudo apt-get install git synaptic ros-kinetic-navigation ros-kinetic-hector-mapping ros-kinetic-geographic-msgs ros-kinetic-slam-gmapping ros-kinetic-mrpt-slam ros-kinetic-mrpt-icp-slam-2d -y</pre><h4>Download rf2o</h4><pre>git clone <a href="https://github.com/MAPIRlab/rf2o_laser_odometry">https://github.com/MAPIRlab/rf2o_laser_odometry</a></pre><h4>Adding swap for RPI3</h4><p>Check whether your computer is using swap</p><pre>free -m</pre><p>Adding swap</p><pre>sudo su ## type your password ##<br>cd /var<br>fallocate -l 1G swapfile<br>chmod 600 swapfile<br>mkswap /var/swapfile<br>swapon /var/swapfile</pre><p>Check swap&#39;s status</p><pre>swapon -s</pre><h4>* Fix crashing firefox problem in ubuntu mate 16.04</h4><pre>sudo apt-get purge firefox<br>sudo apt-get install firefox=45.0.2+build1–0ubuntu1</pre><p><a href="https://ubuntu-mate.community/t/firefox-55-0-2-doesnt-start-crashes-on-ubuntu-mate-raspberrypi-3/14637/25">https://ubuntu-mate.community/t/firefox-55-0-2-doesnt-start-crashes-on-ubuntu-mate-raspberrypi-3/14637/25</a></p><h3>Operation</h3><h4>Joystick control</h4><pre>$ roslaunch duckietown_demos joystick.launch veh:=knightcar</pre><h4>Lane following</h4><pre>$ roslaunch duckietown_demos lane_following.launch veh:=knightcar</pre><h4>SLAM</h4><pre>$ roslaunch kbot Kbot_gmapping.launch veh:=knightcar</pre><h4>Navigation</h4><pre>$ roslaunch kbot Kbot_amcl_nav.launch veh:=knightcar<br>$ roslaunch kbot Kbot_nav_control.launch veh:=knightcar</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a218c075e2ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ardrone indoor SLAM & navigation]]></title>
            <link>https://medium.com/@k3083518729/ardrone-indoor-slam-navigation-eec3812581dd?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/eec3812581dd</guid>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[robots]]></category>
            <category><![CDATA[drones]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Tue, 24 Apr 2018 13:59:56 GMT</pubDate>
            <atom:updated>2018-04-26T07:18:34.122Z</atom:updated>
            <content:encoded><![CDATA[<p>Using recursive least-squares (fusion by PTAM+IMU) to caculate scale info of LSD-SLAM</p><h4><strong>GitHub :</strong></h4><p><a href="https://github.com/Hypha-ROS/hypharos_ardrone_navigation">Hypha-ROS/hypharos_ardrone_navigation</a></p><h3>Brief introduction</h3><p><em>This project uses recursive least squares algorithm to caculate the transfer function of tum_ardrone/pose (in real size) and LSD_slam/pose(nonscale). After recursive least square converges completely, we used this transfer function to convert nonscale point cloud map from LSD_slam to real world’s map which is used for navigation.</em></p><h3>System Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_rrKPBH8TqhXT-UVP4Rfw.png" /></figure><h3>TUM_Ardrone</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*K5OfK4S_emt6QH67Y2SkNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*6ng_IjV_8wTmyWc2_0Ej5Q.png" /></figure><h3>LSD_SLAM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*TWG5EvVTGY8OC_UWICqezw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*eYzvslmNxxvg30F9tjefXQ.png" /></figure><h3>Hypharos_Ardrone</h3><h4>coordinate transform</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3EkaL1nqwmtf2Suj9902g.png" /></figure><h4>Least-squares</h4><p>consider y = Ax</p><p>where A ∈ Rm×n is (strictly) skinny(overdetermined set of linear equations )</p><p>define error <strong><em>r = Ax − y</em></strong></p><p>find x = xls that minimizes ∥r∥</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZ9Rjs9St6MfgXObCljl5Q.png" /></figure><h4>Recursive least-squares</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ktBZA19vjSfmK7qnpWxWsw.png" /></figure><p>In our case ----&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9PbnE-owGkM52Sw30NU8Uw.png" /></figure><p>recursively caculate least-squares (approximate) solution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KbeN-6dP4PSYS5QUOH8fYg.png" /></figure><p>Rotation(quaternion) :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlS4ZzIN97aeWU2104FnLA.png" /><figcaption><em>M is quaternion multiplication matrix R is quaternion rotation matrix</em></figcaption></figure><p>Positon :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFWRvUnjGSr8VAV-Xykkog.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eec3812581dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git note]]></title>
            <link>https://medium.com/@k3083518729/git-note-3bc9613d8754?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bc9613d8754</guid>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Tue, 20 Mar 2018 09:59:46 GMT</pubDate>
            <atom:updated>2018-03-20T09:59:46.509Z</atom:updated>
            <content:encoded><![CDATA[<p>進入需要被上傳的資料夾，將其建立成一個本地版本庫</p><pre>cd ~/Test<br>git init</pre><p>把該目錄下的所有檔案新增到倉庫</p><pre>git add .</pre><p>過程中可以使用git status檢查狀態</p><pre>git status</pre><p>用git commit把專案提交到倉庫，&quot; &quot;內為本次變動的註解</p><pre>git commit -m &quot;first commit&quot;</pre><p>在github添加一個online版本庫repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8IMI0Es3fGYV7SXJ9OWzhA.png" /></figure><p>我們用下面這個命令來加入遠端的 repository 這裡命名為origin，後面那串網址則是 repository 的位置</p><pre>git remote add origin https://github.com/kungfrank/Test.git</pre><p>由此指令可以查看現在存在的遠端repository</p><pre>git remote -v</pre><p>若有不需要的，可以用此指令移除</p><pre>git remote rm origin</pre><p>推送本地master到遠端repository origin</p><pre>git push -u origin master</pre><p>由於新建的遠端倉庫是空的，所以要加上-u，之後再上傳時不需要加-u</p><pre>git pull --rebase origin master</pre><p>若修改了一些內容後，我們可以通過以上命令先將內容合併再push</p><pre>git push origin master</pre><blockquote>reference</blockquote><ul><li><a href="https://morvanzhou.github.io/tutorials/others/git/5-1-github/">Github 在线代码管理 - Git 版本管理 | 莫烦Python</a></li><li><a href="https://itw01.com/VIWCESK.html">Git使用教程：如何將本地專案上傳到Github - ITW01</a></li><li><a href="https://www.peterdavehello.org/2014/02/update_forked_repository/">更新從 GitHub 上 fork 出來的 repository (或是同步兩個不同 server 端的 repository)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bc9613d8754" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Convolutional Neural Networks]]></title>
            <link>https://medium.com/@k3083518729/convolutional-neural-networks-9b81714fa04e?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b81714fa04e</guid>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Wed, 03 Jan 2018 16:53:45 GMT</pubDate>
            <atom:updated>2018-01-16T16:08:19.665Z</atom:updated>
            <content:encoded><![CDATA[<p>卷積神經網絡</p><blockquote>reference</blockquote><p><a href="https://www.youtube.com/watch?v=FrKWiRv254g&amp;t=642s">https://www.youtube.com/watch?v=FrKWiRv254g&amp;t=642s</a></p><p><a href="https://classroom.udacity.com/courses/ud730/lessons/6377263405/concepts/63741833610923">Udacity</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*beu7MuJ7m0oy_0kPYrFZ-A.png" /></figure><p>可將卷積神經網絡想為對圖片的每一小部分(patch)做普通的NN（output size為k）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bd_olmi4U9Om9cf0GjMRaA.png" /></figure><p>將k個輸出想像為立起來的，則再經過掃描整張圖後會發現厚度增加（長寬也可能改變）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyDeZycfQyEvh9abvAUKIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GEFgml-5XO6g0SPd0Imb1Q.png" /></figure><p>Filter的物理意義</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w32icXR6v-HKNmBqgOuk9Q.png" /></figure><p>高度變為k代表有k個Filter (depth 正比於filter的數量)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sSDwcgZfPK4IHQdGSuJqNg.png" /></figure><h4>名詞解釋</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcDfBYUfG1v_cls7LM26OQ.png" /></figure><p><strong>patch/kernel</strong> : filter (包含weight &amp; bias)</p><p><strong>stride</strong> : 步長</p><h4>share weight</h4><p>(共用patch/kernel)</p><p>因為我們的目標在圖中的哪裡並不重要，我們只要知道他在或不在</p><p>EX : 辨識人臉識時，Filter可能就是眼睛＆鼻子＆嘴巴...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p610-N_ZjuB5Jf9HRttkeg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZwAMrusQa2of0Fa3S8-dg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TQtiTutVKT2UtqhQsLA2ww.png" /></figure><p>共享權重（share weight）時不影響梯度的計算。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMip05qBcK91H-lUxWMF9A.png" /></figure><h3>常用技巧</h3><h4><strong>padding</strong></h4><p>valid padding -&gt; 不對邊緣做任何處理（convolution後，長寬減小）</p><p>same padding -&gt; 對邊緣補上0（使convolution後，長寬不變）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fjh0q05HnHeyciShyRWrxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rnEgnBQbNtbxOPeCQGG8KA.png" /></figure><h4>Pooling (池化)</h4><p>用來壓縮維度，若在convolution使用valid padding或stride!=1時雖然降低維度但也會使資料丟失，故通常使用same padding＋stride1保留完整資料，再加上pooling來壓縮維度。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*irmMX_DXETW3TDluUwrq9Q.png" /></figure><h4>max pooling V.S average pooling</h4><p>max pooling較常使用且較精確，average pooling相當於將一張圖的畫質降低。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j4kFhoS5IXI11S8hkhztMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*Q6BHbO2N-Gru6mrVVHETkw.png" /></figure><h4>max pooling</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK4xPM5JxsKTHCcyUuCBLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPaFPZHHTo5b8fFgrauniw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b81714fa04e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tensorflow Image Recognition in ROS]]></title>
            <link>https://medium.com/@k3083518729/tensorflow-image-recognition-58b0ac77c263?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/58b0ac77c263</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[robots]]></category>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Sat, 16 Dec 2017 07:10:02 GMT</pubDate>
            <atom:updated>2018-08-24T09:45:38.312Z</atom:updated>
            <content:encoded><![CDATA[<h4>This repository contains the code which run tensorflow image recognition in ROS ,and also enable to train your own model for image recognition.(<a href="http://arxiv.org/abs/1512.00567">Inception-v3</a>) (in ROS kinetic)</h4><h3>GoogLeNet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IbENz6fyntYz2wdWBIc2ZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYyKmZN1dhvyDXuxhTC0Qg.png" /></figure><h4>GitHub:</h4><p><a href="https://github.com/kungfrank/ros_inception_v3">kungfrank/ros_inception_v3</a></p><blockquote>reference</blockquote><p>https://github.com/akshaypai/tfClassifier</p><p>https://github.com/OTL/rostensorflow</p><h3>Tutorial</h3><h4>ROS camera driver &amp; dependencies install</h4><pre>$ sudo apt-get install ros-kinetic-cv-bridge ros-kinetic-opencv3</pre><pre>$ sudo apt-get install ros-kinetic-cv-camera</pre><h4>Download code for retrain your own model</h4><pre>$ git clone <a href="https://github.com/akshaypai/tfClassifier">https://github.com/akshaypai/tfClassifier</a></pre><pre>$ cd tfClassifier/image_classification</pre><p>Test the code (parameter after image_file is path of picture you want to recognize)</p><pre>$ python classifier.py — image_file /Users/apple/Desktop/church.jpg</pre><p><strong>Result：church, church building (score = 0.88516)</strong></p><h4>Installation</h4><pre>$ git clone <a href="https://github.com/kungfrank/ros_inception_v3">https://github.com/kungfrank/ros_inception_v3</a></pre><p>Test the code</p><pre>$ roscore<br>$ rosrun cv_camera cv_camera_node<br>$ python image_recognition.py image:=/cv_camera/image_raw<br>$ rostopic echo /result</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6BM6Q_mKKD36px3hiA1OQ.png" /></figure><blockquote>Time to retrain your own model</blockquote><h4>download dataset</h4><pre>$ cd ~<br>$ curl -O<br>$ http://download.tensorflow.org/example_images/flower_photos.tgz<br>$ tar xzf flower_photos.tgz</pre><h4>retrain</h4><pre>$ python retrain.py --model_dir ./inception --image_dir ~/flower_photos ./output --how_many_training_steps 1000</pre><p><em>ERROR</em></p><pre>AttributeError: module ‘tensorflow.python.training.training’ has no attribute ‘SummaryWriter’</pre><p><strong><em>solution：switch </em></strong><a href="https://stackoverflow.com/questions/41482913/module-object-has-no-attribute-summarywriter"><strong><em>tf.train.SummaryWriter — &gt; tf.summary.FileWriter</em></strong></a></p><p><em>ERROR</em></p><pre>AttributeError: &#39;NoneType&#39; object has no attribute &#39;keys&#39;</pre><p><strong><em>solution： </em></strong><a href="https://github.com/tensorflow/tensorflow/issues/7659"><strong><em>the problem was here</em></strong></a><a href="https://github.com/tensorflow/tensorflow/issues/7659"><strong><em>Image directory &#39;/tf_files/flower_photos&#39; not found</em></strong></a></p><blockquote>~/ros_inception_v3</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*nGnS0IaZdOboLd9MP1ZRAQ.png" /></figure><p>After retrain process finish you can find ./output.pb and ./labels.txt in /tmp folder .</p><p>Move or copy them to ros_inception_v3 folder just replace original ./output.pb and ./labels.txt file with new file.</p><p>Test again</p><pre>$ roscore<br>$ rosrun cv_camera cv_camera_node<br>$ python image_recognition.py image:=/cv_camera/image_raw<br>$ rostopic echo /result</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58b0ac77c263" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ROS — TF(transforms)]]></title>
            <link>https://medium.com/@k3083518729/ros-tf-transforms-d00d4bd7add9?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/d00d4bd7add9</guid>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Sat, 09 Dec 2017 15:35:44 GMT</pubDate>
            <atom:updated>2017-12-10T06:44:17.253Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>reference</blockquote><p><a href="http://wiki.ros.org/tf/Tutorials">tf/Tutorials - ROS Wiki</a></p><h3>範例程式架構圖</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZD5RlLepKSPCtwzovLF0A.png" /></figure><p><strong>TF tree</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWFfttMEQNh0M6m0DI_52A.png" /></figure><h3>Introduction</h3><p><strong>TF tree</strong></p><pre>$ rosrun rqt_tf_tree rqt_tf_tree</pre><p><strong>tf_echo(tf_echo reports the transform between any two frames broadcast over ROS)</strong></p><pre>$ rosrun tf tf_echo turtle1 turtle2</pre><h3>tf broadcaster</h3><blockquote>learning_tf/nodes/turtle_tf_broadcaster.py</blockquote><pre>import roslib<br>roslib.load_manifest(&#39;learning_tf&#39;)<br>import rospy<br>import tf<br>import turtlesim.msg</pre><pre><strong><em>##callback function 用以將/pose轉為TF並發布</em></strong><br>def handle_turtle_pose(msg, turtlename):<br>    br = tf.TransformBroadcaster()<br>    br.sendTransform((msg.x, msg.y, 0),<br>                     tf.transformations.quaternion_from_euler(0, 0, msg.theta),<br>                     rospy.Time.now(),<br>                     turtlename,<br>                     &quot;world&quot;)<br><br>if __name__ == &#39;__main__&#39;:<br>    rospy.init_node(&#39;turtle_tf_broadcaster&#39;)<br>    turtlename = rospy.get_param(&#39;~turtle&#39;)<br>    rospy.Subscriber(&#39;/%s/pose&#39; % turtlename,<br>                     turtlesim.msg.Pose,<br>                     handle_turtle_pose,<br>                     turtlename)<br>    rospy.spin()</pre><p>此程式用於廣播ＴＦ，運作原理為不斷訂閱turtle的/pose也就是當前位置，接著於callback function中將當前位置利用sendtransform函式，轉為相對於world的TF訊息，並發布出去。</p><h3>tf listener</h3><blockquote>learning_tf/nodes/turtle_tf_listener.py</blockquote><pre>import roslib<br>roslib.load_manifest(&#39;learning_tf&#39;)<br>import rospy<br>import math<br>import tf<br>import geometry_msgs.msg<br>import turtlesim.srv<br><br>if __name__ == &#39;__main__&#39;:<br>    rospy.init_node(&#39;turtle_tf_listener&#39;)<br><br>    listener = tf.TransformListener()</pre><pre><strong><em>##多生成一隻turtle(使用spawner服務)<br> </em></strong>   rospy.wait_for_service(&#39;spawn&#39;)<br>    spawner = rospy.ServiceProxy(&#39;spawn&#39;, turtlesim.srv.Spawn)<br>    spawner(4, 2, 0, &#39;turtle2&#39;)</pre><pre><strong><em>##宣告一個vel發布器</em></strong><em><br></em>    turtle_vel = rospy.Publisher(&#39;turtle2/cmd_vel&#39;, geometry_msgs.msg.Twist,queue_size=1)</pre><pre><strong><em>##10HZ</em></strong><br>    rate = rospy.Rate(10.0)</pre><pre><strong><em>##不斷監聽turtle1,2之間的相對位置（trans即為turtle2相對於turtle1的相對位置）</em></strong></pre><pre>while not rospy.is_shutdown():<br>        try:<br>            (trans,rot) = listener.lookupTransform(&#39;/turtle2&#39;, &#39;/turtle1&#39;, rospy.Time(0))<br>        except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):<br>            continue</pre><pre><strong><em>##根據turtle1,2之間的相對位置計算出turtle2應該要的vel(才能追上turtle1)</em></strong></pre><pre><strong><em>##trans[0],trans[1]即為turtle1,2之間相對位置的x,y</em></strong><br>        angular = 4 * math.atan2(trans[1], trans[0])<br>        linear = 0.5 * math.sqrt(trans[0] ** 2 + trans[1] ** 2)<br>        cmd = geometry_msgs.msg.Twist()<br>        cmd.linear.x = linear<br>        cmd.angular.z = angular<br>        turtle_vel.publish(cmd)<br><br>        rate.sleep()</pre><p>此程式不斷監聽turtle1,2之間的相對位置計算出turtle2應該要有的vel以追上turtle1，並發布vel。</p><h4>“math.atan2(trans[1], trans[0])”</h4><p><em>tan2(y,x)所表達的意思是坐標原點為起點，指向(x,y)的射線在坐標平面上與x軸正方向之間的角的角度。</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*zdYZtXQVRJIiKFGlcDU7-w.png" /></figure><h4>&quot;math.sqrt(trans[0] ** 2 + trans[1] ** 2)&quot;</h4><p><em>即計算兩者之間的距離。</em></p><h3>launch</h3><blockquote>learning_tf/launch/start_demo.launch</blockquote><pre>&lt;launch&gt;</pre><pre>&lt;! — Turtlesim Node -&gt;</pre><pre>&lt;node pkg=”turtlesim” type=”turtlesim_node” name=”sim”/&gt;</pre><pre>&lt;node pkg=”turtlesim” type=”turtle_teleop_key” name=”teleop” output=”screen”/&gt;</pre><pre>&lt;node name=”turtle1_tf_broadcaster” pkg=”learning_tf” type=”turtle_tf_broadcaster.py” respawn=”false” output=”screen” &gt;</pre><pre>&lt;param name=”turtle” type=”string” value=”turtle1&quot; /&gt;</pre><pre>&lt;/node&gt;</pre><pre>&lt;node name=”turtle2_tf_broadcaster” pkg=”learning_tf” type=”turtle_tf_broadcaster.py” respawn=”false” output=”screen” &gt;</pre><pre>&lt;param name=”turtle” type=”string” value=”turtle2&quot; /&gt;</pre><pre>&lt;/node&gt;</pre><pre>&lt;node pkg=”learning_tf” type=”turtle_tf_listener.py”</pre><pre>name=”listener” /&gt;</pre><pre>&lt;/launch&gt;</pre><p><em>程式執行結果</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*_QA2wSAMaOcW56RrWiQd8Q.png" /></figure><blockquote>Adding a frame</blockquote><h3>Add static frame</h3><blockquote>learning_tf/nodes/fixed_tf_broadcaster.py</blockquote><pre>#!/usr/bin/env python  <br>import roslib<br>roslib.load_manifest(&#39;learning_tf&#39;)<br><br>import rospy<br>import tf<br><br>if __name__ == &#39;__main__&#39;:<br>    rospy.init_node(&#39;fixed_tf_broadcaster&#39;)<br>    br = tf.TransformBroadcaster()<br>    rate = rospy.Rate(10.0)<br>    while not rospy.is_shutdown():<br>        br.sendTransform((0.0, 2.0, 0.0), <strong><em>##前後，左右，上下</em></strong><br>                         (0.0, 0.0, 0.0, 1.0),<br>                         rospy.Time.now(),<br>                         &quot;carrot1&quot;,<br>                         &quot;turtle1&quot;)<br>        rate.sleep()</pre><p>廣播一個新的坐標系carrot1，位於turtle1之左側。</p><p>Edit the <strong>demo.launch</strong></p><pre>&lt;launch&gt;<br>    ...<br>    &lt;node pkg=&quot;learning_tf&quot; type=&quot;fixed_tf_broadcaster.py&quot;<br>          name=&quot;broadcaster_fixed&quot; /&gt;<br>&lt;/launch&gt;</pre><p>Edit<strong> nodes/turtle_tf_listener.py</strong></p><pre>(trans,rot) = listener.lookupTransform(&quot;/turtle2&quot;, &quot;/carrot1&quot;, rospy.Time(0))</pre><h4>Result</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*A5Fyw55YBqMdq0MpunqLAw.png" /></figure><h3>Add dynamic frame</h3><blockquote>learning_tf/nodes/dynamic_tf_broadcaster.py</blockquote><pre>#!/usr/bin/env python  <br>import roslib<br>roslib.load_manifest(&#39;learning_tf&#39;)<br><br>import rospy<br>import tf<br>import math<br><br>if __name__ == &#39;__main__&#39;:<br>    rospy.init_node(&#39;dynamic_tf_broadcaster&#39;)<br>    br = tf.TransformBroadcaster()<br>    rate = rospy.Rate(10.0)<br>    while not rospy.is_shutdown():<br>        t = rospy.Time.now().to_sec() * math.pi<br>        br.sendTransform((2.0 * math.sin(t), 2.0 * math.cos(t), 0.0),<br>                         (0.0, 0.0, 0.0, 1.0),<br>                         rospy.Time.now(),<br>                         &quot;carrot1&quot;,<br>                         &quot;turtle1&quot;)<br>        rate.sleep()</pre><p>廣播一個新的坐標系carrot1，與turtle1為時變三角函數關係。</p><p>Edit the <strong>demo.launch</strong></p><pre>&lt;launch&gt;<br>    ...<br>    &lt;node pkg=&quot;learning_tf&quot; type=&quot;dynamic_tf_broadcaster.py&quot;<br>          name=&quot;broadcaster_dynamic&quot; /&gt;<br>&lt;/launch&gt;</pre><p>Edit<strong> nodes/turtle_tf_listener.py</strong></p><pre>(trans,rot) = listener.lookupTransform(&quot;/turtle2&quot;, &quot;/carrot1&quot;, rospy.Time(0))</pre><h4>Result</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*OjjVUyMv85E4Fx8PShSSHA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d00d4bd7add9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ROS note]]></title>
            <link>https://medium.com/@k3083518729/ros-%E7%AD%86%E8%A8%98-53a9e9b5d65?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/53a9e9b5d65</guid>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Wed, 15 Nov 2017 12:56:54 GMT</pubDate>
            <atom:updated>2018-01-30T14:10:40.420Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating a catkin Workspace</h3><pre>$ mkdir -p ~/catkin_ws/src <br>$ cd ~/catkin_ws/src<br>$ catkin_init_workspace<br>$ cd..<br>$ catkin_make<br>$ echo &quot;source ~/(WS)/devel/setup.bash&quot; &gt;&gt; ~/.bashrc</pre><pre>$ echo $ROS_PACKAGE_PATH<br><strong><em>(check)</em></strong></pre><h3><strong>Doing a “make clean” with catkin</strong></h3><pre>$ cd ~/catkin_ws<br>$ \rm -rf devel build install</pre><p><strong><em>remake</em></strong></p><pre>$ cd ~/catkin_ws<br>$ catkin_make<br>$ source devel/setup.bash</pre><h3>Install dependencies</h3><pre>$ cd ~/catkin_ws<br>$ rosdep install --from-paths src --ignore-src </pre><h3>Time synchronization</h3><pre>$ sudo apt-get install chrony</pre><h3>Dynamic Reconfigure(<a href="http://wiki.ros.org/rqt_reconfigure">rqt_reconfigure</a>)</h3><p><a href="http://wiki.ros.org/dynamic_reconfigure/Tutorials/SettingUpDynamicReconfigureForANode%28python%29">dynamic_reconfigure/Tutorials/SettingUpDynamicReconfigureForANode(python) - ROS Wiki</a></p><h3><strong><em>Zeroconf(</em></strong>network<strong><em>)</em></strong></h3><pre><strong><em>desktop</em></strong><br>$ hostname<br>my_desktop</pre><pre><strong><em>robot</em></strong><br>$ hostname<br>my_robot</pre><pre>$ ping my_desktop.local<br>$ ping my_robot.local</pre><p><strong>NOTE: </strong>If the ping test fails with an “unknown host” error, try restarting the avahi-daemon process on the machine that is not responding back:</p><pre>$ sudo service avahi-daemon restart</pre><h3>ROS network config</h3><p>ROS_MASTER_URI &amp; ROS_IP &amp; ROS_HOSTNAME</p><p>c<strong><em>hange host name:</em></strong></p><blockquote>/etc/hostname</blockquote><p>&quot;Name&quot;</p><blockquote>/etc/hosts</blockquote><p>127.0.0.1 localhost</p><p>127.0.1.1 &quot;Name&quot;</p><pre>sudo reboot</pre><h4>open webcam</h4><pre>cheese</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53a9e9b5d65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HyphaROS RaceCar note(II)]]></title>
            <link>https://medium.com/@k3083518729/hypharos-racecar-note-ii-596a448401c6?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/596a448401c6</guid>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[robots]]></category>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Thu, 09 Nov 2017 14:13:10 GMT</pubDate>
            <atom:updated>2017-11-14T04:36:17.164Z</atom:updated>
            <content:encoded><![CDATA[<h3>AMCL</h3><p><em>(Map Localization)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gAWZ8cMlRTKgaKzG3i0Xug.png" /></figure><h3>Navigation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smc1xkHhPObO0Fz_1dOJ-g.png" /></figure><h4>move_base package:</h4><blockquote>roscd move_base</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_mzYvt4raPN6KKkL8Jo1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-s0yJM7DJXxRJ6OkNdrGsQ.png" /></figure><p>可調整之參數：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXEvAVC3-pwxXeA8er25vw.png" /></figure><blockquote><em>simulation example</em></blockquote><blockquote>~/catkin_ws/src/hypha-racecar/launch/Simulation/Stage_sim.launch</blockquote><pre>$roslaunch hypha_racecar Stage_sim.launch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lZjCobPBNhBsaIHeAdtoaw.png" /></figure><h4><strong><em>Costmap</em></strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-bM3yMjikhvn2sKuDA5tCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fn9gsU_I-1YVvlIAnjEfwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pRC0QCvE3mCNWkF4FB0Dvg.png" /></figure><blockquote>~/catkin_ws/src/hypha-racecar/launch/Simulation/includes/global_costmap_params.yaml</blockquote><blockquote>~/catkin_ws/src/hypha-racecar/launch/Simulation/includes/local_costmap_params.yaml</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NKerlbld7oWrMlNlkoehBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C4Jfs_Sag2eI7C5kfQc-9w.png" /><figcaption>local_cost map</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QxOevZ7MNz_UZNYsdex_4w.png" /><figcaption>global_cost map</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LDPJNxU5G4ghFylOQhhB9Q.png" /></figure><h4>Global Planner Algorithm Introduction:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wMKgS9Y1obnRNLrQ25MSQg.png" /></figure><p><em>we choose Dijkstra’s algorithm in this case.</em></p><h4>Global Planner Algorithm Introduction:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfXjtxBC1rOsLOkO-FYL5A.png" /></figure><p><em>we choose DWA algorithm in this case.</em></p><p><strong><em>DWA planner :</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcjEL2aaNZ7oUPMjiU6maQ.png" /></figure><p>規劃路徑之cost function</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AtALvAU1NKWCGTWQaBK-XQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y86ZS1fE3XCOErBF2yxJAQ.png" /></figure><blockquote>~/catkin_ws/src/hypha-racecar/launch/Simulation/includes/dwa_local_planner_params.yaml</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5pXjgB5And5GnSEtdBVnQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*795KhVUP6gGYA9ljdTut3A.png" /></figure><blockquote>動態調整參數</blockquote><pre>$rosrun rqt_reconfigure rqt_reconfigure</pre><h3>On Racecar :</h3><pre><strong>[Racecar]</strong> $roslaunch hypha_racecar RACECAR_amcl_nav.launch</pre><blockquote><strong>[Racecar]</strong></blockquote><blockquote>~/catkin_ws/src/hypha-racecar/launch/RACECAR_amcl_nav.launch</blockquote><p>需要調整map path，base_speed，base_angle</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=596a448401c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HyphaROS RaceCar Note (I)]]></title>
            <link>https://medium.com/@k3083518729/hypharos-racecar-%E4%B8%8A%E8%AA%B2%E7%AD%86%E8%A8%98-f99991c28a03?source=rss-ca37093061db------2</link>
            <guid isPermaLink="false">https://medium.com/p/f99991c28a03</guid>
            <category><![CDATA[robots]]></category>
            <category><![CDATA[robotics]]></category>
            <dc:creator><![CDATA[Frank Kung]]></dc:creator>
            <pubDate>Wed, 01 Nov 2017 16:49:12 GMT</pubDate>
            <atom:updated>2018-04-20T08:52:36.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TKJsUcU9mz0_6xMPcSGxnQ.jpeg" /></figure><h3>github:</h3><p><a href="https://github.com/Hypha-ROS/hypha-racecar">Hypha-ROS/hypha-racecar</a></p><p><a href="https://docs.google.com/document/d/1CeDA3NaDOK65OM9v9KrpK02UlYhZvvWX--KrNS4AxLw/edit">https://docs.google.com/document/d/1CeDA3NaDOK65OM9v9KrpK02UlYhZvvWX--KrNS4AxLw/edit</a></p><h4>整體系統架構圖：</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zd0OrlTyse5bUrvKJwup8A.png" /></figure><h4>SLAM</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGwZpHWw1jll97Dg971DEg.png" /></figure><h4>Navigation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsrZm-xff3mOsiixXFrr6g.png" /></figure><h3>2D Laser SLAM:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nA5OD4-a17NJeHukmRKnjQ.png" /></figure><p>由結果圖可看出icp由於沒有external odom，單純使用特徵匹配，當地圖上沒有明顯的特徵時（ex:筆直的走廊）會產生失誤。hector對感測器要求過高。所以在本地圖使用gmapping較適合。</p><blockquote>roscd gmapping</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pQhNhi1vEzP00vaQbh11g.png" /></figure><h3>odom</h3><blockquote>雷射雷達推算odom:</blockquote><h4>rf2o laser odom package:</h4><blockquote>~/catkin_ws/src/mapir-ros-pkgs/src/rf2o_laser_odometry</blockquote><p>&lt; ! &gt; Performance of rf2o is bad in rotation behavior</p><p>(由於雷達本身也在自轉，所以於轉動時odom會產生問題)</p><blockquote>解決辦法：</blockquote><h4>EKF Package:</h4><p>(加入IMU改變轉動時產生的問題)</p><ol><li><strong>robot_pose_ekf</strong></li><li><strong>robot_localization</strong> → supports multi-sensors (including GPS, imu, vo, etc)</li><li><strong>ethzasl_msf </strong>→ 可知道當前姿態（用於旋翼機）</li></ol><h4><strong>robot_localization package:</strong></h4><blockquote>roscd robot_localization/src/ekf_localization_node.cpp</blockquote><p>All state estimation nodes track the 15-dimensional state of the vehicle:</p><pre>x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az</pre><p>we choose <em>Vx(車速)</em>, <em>Vy(車體側移速度)</em> from <strong><em>rf2o</em></strong>, <em>yaw(轉向) </em>from <strong><em>imu</em></strong>, custom covariance settings.</p><blockquote>~/catkin_ws/src/hypha-racecar/param/hypha_ekf_params_bag.yaml</blockquote><blockquote>~/catkin_ws/src/hypha-racecar/param/hypha_ekf_params.yaml</blockquote><blockquote>content:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-5IFZh4KpaTjfYuZn5BfQ.png" /></figure><pre>odom0: /rf2o_laser_odometry/odom<br>odom0_config: [false, false, false,<br>               false, false, false,<br>               <strong><em>true</em></strong>, <strong><em>true</em></strong>, false,<br>               false, false, false,<br>               false, false, false]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ajd1EOUV_Z1Dh6lCyClPpQ.png" /></figure><pre>imu0: /imu_data<br>imu0_config: [false, false, false,<br>              false, false, <strong><em>true</em></strong>,<br>              false, false, false,<br>              false, false, false,<br>              false, false, false]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYQkIxvYohv2ISz5P7XAlw.png" /></figure><p>調整信心指數（可以看見yaw為2.5，Vx為5）</p><h4>TF ( odom座標 ) :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmEXxHLByBsEgoKlyQSc1A.png" /></figure><h3>Communication &amp; Control</h3><h4>HARDWARE Communication -&gt;</h4><p><strong>rplidar：</strong><em>rplidar_ros package</em></p><blockquote>roscd <em>rplidar_ros</em></blockquote><p><strong>MOTOR &amp; UNO：</strong><em>rosserial</em></p><blockquote>~/catkin_ws/src/hypha-racecar/document/arduino/racecar_uno/racecar_uno.ino <strong><em>(ino file)</em></strong></blockquote><p><strong>GY85 &amp; NANO : </strong><em>pyserial</em></p><blockquote>~/catkin_ws/src/hypha-racecar/script/imu_auto.py <strong><em>(node)</em></strong></blockquote><blockquote>~/catkin_ws/src/hypha-racecar/document/arduino/Razor_AHRS <strong><em>(ino file)</em></strong></blockquote><h4>L1 CONTROLLER -&gt;</h4><p>（根據當前速度，演算出往前看的距離 ＆ 馬達轉速控制）</p><blockquote>~/catkin_ws/src/hypha-racecar/src/L1_controller_v2.cpp</blockquote><p>根據當前速度，演算出往前看的距離(正比)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gogpIYu_ymkA_kePgF-9PQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_icCSbJQNUkXIzwCCqoyEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Azh6hgXoZgxqlsLHxT-XNQ.png" /></figure><p>但由於我們的當前速度是由rplidar來估算（不準確），故改為固定速度為1m/s</p><blockquote>~/catkin_ws/src/hypha-racecar/launch/Test/Test_L1_controller.launch</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_dhBDt3KSCUlZjRrxJY2bw.png" /></figure><blockquote>補充：</blockquote><h3>Simulation :</h3><p><strong><em>Gmapping</em></strong></p><pre>$ roslaunch hypha_racecar desktop_gmapping.launch</pre><p><strong><em>MRPT-ICP SLAM</em></strong></p><pre>$roslaunch hypha_racecar desktop_icp_mapping.launch</pre><p><strong><em>Hector SLAM</em></strong></p><pre>$ roslaunch hypha_racecar Test_hector_rplidar.launch</pre><h3>On Racecar :</h3><p><strong><em>SLAM</em></strong></p><pre><strong>[Racecar] </strong>$ roslaunch hypha_racecar Test_gmapping.launch</pre><p><strong><em>save map</em></strong></p><pre><strong>[Racecar] </strong>$ rosrun map_server map_saver -f ~/map_xxx   <strong><em>(map name)</em></strong></pre><p><strong><em>remote control</em></strong></p><pre>$rosrun hypha_racecar racecar_teleop.py</pre><h4>Remmina:</h4><p>remmina 遠端桌面連線（直接於終端機輸入remmina開啟）</p><h4>Udev Setting( 設定usb名稱 ):</h4><pre>$ lsusb <strong><em>(check the idV and idP of each component)</em></strong><br>$ udevadm info -a /dev/ttyACM0 <strong><em>(若裝置位於/dev/ttyACM0)</em></strong><br>$ sudo cp ./xxxxxxx.rules /etc/udev/rules.d/<br><strong><em>(將自己的rules檔加入rules.d)</em></strong><br>$ sudo udevadm control --reload-rules <strong><em>(reload)</em></strong><br>$ sudo udevadm trigger <strong><em>(trigger)</em></strong></pre><p>xxx.rules example：</p><pre>KERNEL==”ttyACM*”, ATTRS{idVendor}==”2341&quot;, ATTRS{idProduct}==”0043&quot;, MODE:=”666&quot;, SYMLINK+=”uno”</pre><p>check :</p><pre>ls -l /dev |grep ttyACM</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f99991c28a03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>