01.4 Navigation - pineland/px4 GitHub Wiki

1. ์„ผ์„œ ์ถ”๊ฐ€

1.1. 1D ์„ผ์„œ ์ถ”๊ฐ€ ๋ฐ ์„ผ์‹ฑ๊ฐ’ ๋ฐ›๊ธฐ

1.1.1 iris ๋ชจ๋ธ์— teraranger ๋ชจ๋“ˆ ์ถ”๊ฐ€
vi ~/src/Firmware/Tools/sitl_gazebo/models/iris.sdf ๋งจ ์•„๋ž˜์ชฝ ์œ„์— ๋‹ค์Œ์˜ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•œ๋‹ค.

<include>
    <uri>model://flow_cam</uri>
    <pose>-0.12 0.05 0 0 1.5708 1.5708</pose>
</include>
<joint name="flow_joint" type="revolute">
    <child>camera::link</child>
    <parent>iris::base_link</parent>
    <axis>
        <xyz>0 0 1</xyz>
        <limit>
            <upper>0</upper>
            <lower>0</lower>
        </limit>
    </axis>
</joint>

(ํ•ด์„ค1) ์„ผ์„œ์˜ ๋ชจ๋ธ ์ด๋ฆ„์„ ์ ์–ด์ค€๋‹ค.(์„ผ์„œ์˜ sdfํŒŒ์ผ ์•ˆ์— ๋ชจ๋ธ ์ด๋ฆ„์ด ๋“ค์–ด์žˆ๋‹ค)
model://flow_cam
(ํ•ด์„ค2) ์„ผ์„œ๋ฅผ ๋ถ™์ผ ์œ„์น˜๋ฅผ ์ •ํ•œ๋‹ค.
-0.12 0.05 0 0 1.5708 1.5708
(ํ•ด์„ค3) joint์˜ ์ด๋ฆ„์„ ์ •ํ•ด์ฃผ๊ณ  (์ด๊ฑด ์ž๊ธฐ ๋งˆ์Œ๋Œ€๋กœ)

(ํ•ด์„ค4) child์™€ parent๋ฅผ ์ •์˜ํ•ด์ฃผ๋Š”๋ฐ link์™€ link๋ฅผ joint๋กœ ์—ฐ๊ฒฐํ•œ ๊ฒƒ์œผ๋ฏ€๋กœ ๊ฐ๊ฐ ์˜ตํ‹ฐ์ปฌ ํ”Œ๋กœ์šฐ ์„ผ์„œ์˜ ๋งํฌ์™€ iris ๋“œ๋ก ์˜ ๋ฒ ์ด์Šค ๋งํฌ(์•„๋งˆ๋„ ๋“œ๋ก ์˜ ๋ฐ‘๋ฉด์ด์ง€ ์‹ถ๋‹ค)๋ฅผ ์ ์–ด์ค€๋‹ค.
camera::link
iris::base_link
โ€ป ์•„๋ž˜์— make๊ฐ€ ์•„๋‹Œ launch ํŒŒ์ผ์„ ์ด์šฉํ•˜์—ฌ ros๋ฅผ ์ž‘๋™์‹œํ‚ค๋Š” ๊ฒฝ์šฐ๋Š” urdf๋‚˜ ๋‹ค๋ฅธ ํŒŒ์ผ์„ ๋ณ€๊ฒฝํ•œ๋‹ค.
-> launch ํŒŒ์ผ์„ ์ด์šฉํ•˜๋Š” ๊ฒฝ์šฐ, sdf ํŒŒ์ผ ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ๋ฐ˜์˜์ด ์•ˆ๋จ.

1.2 ์‹คํ–‰

//Terminal 1  
roscore

//Terminal 2
cd ~/src/Firmware
no_sim=1 make posix_sitl_default gazebo

//Terminal 3
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:~/src/Firmware/Tools/sitl_gazebo/models
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:~/src/Firmware/Tools/sitl_gazebo/Build
roslaunch gazebo_ros empty_world.launch

(ํ•ด์„ค1) no_sim=1์„ ์•ž์— ๋ถ™์—ฌ์•ผ ๊ธฐ์กด์— ์‚ฌ์šฉํ•˜๋˜ mavros ํŒจํ‚ค์ง€ ์•ˆ์— ์žˆ๋Š” topic๋“ค ๋ง๊ณ  ๋‹ค๋ฅธ ์ •๋ณด๋“ค์„ gazebo์—์„œ ํ† ํ”ฝ์œผ๋กœ ๋ฐ›์•„๋ณผ ์ˆ˜ ์žˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด gazebo๊ฐ€ ๋ฐ”๋กœ ์‹คํ–‰๋˜์ง€๋Š” ์•Š๋Š”๋‹ค.
(ํ•ด์„ค2) ํ™˜๊ฒฝ๋ณ€์ˆ˜(plugin/model)์— sitl_gazebo ํด๋”๋ฅผ ํฌํ•จ
(ํ•ด์„ค3) default๋กœ empty world๋ฅผ ๋ถ€๋ฅด๊ณ  gazebo ์•ˆ์—์„œ ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ฌ ๊ฒƒ์ด๋‹ค.

1.3 gazebo ๋‚ด์—์„œ ๋“œ๋ก  ๋ถˆ๋Ÿฌ์˜ค๊ธฐ

gazebo ์™ผ์ชฝ insert ํ•ญ๋ชฉ์—์„œ /home/youngsoo/src/Firmware ...์— ์ถ”๊ฐ€ํ•ด์ค€ model๋“ค์ด ์žˆ๋‹ค.
(์ด ๋ถ€๋ถ„์ด ์—†๋‹ค๋ฉด ํ™˜๊ฒฝ์„ค์ •์ด ์•ˆ ๋œ ๊ฒƒ์ด๋ฏ€๋กœ ๊ทธ ๋ถ€๋ถ„์„ ๋‹ค์‹œ ์‹คํ–‰ํ•˜๊ณ  ๊ฐ€์ œ๋ณด๋ฅผ ์‹คํ–‰ํ•˜๊ธธ!)
ํด๋ฆญํ•˜์—ฌ Scene์œผ๋กœ ๊ธ์–ด์˜ค๋ฉด ๋œ๋‹ค. Box๋‚˜ ๋‹ค๋ฅธ ๋ชจ๋ธ๋“ค๋„ ๋ถˆ๋Ÿฌ์™€๋„ ๋œ๋‹ค.

1.4 Iris์—๊ฒŒ ๋ช…๋ น์ฃผ๊ธฐ

Iris ๋“œ๋ก ์„ import ํ•œ ์ˆœ๊ฐ„ px4์™€ ์—ฐ๊ฒฐ์ด ๋˜๋ฏ€๋กœ Takeoff๋ช…๋ น์„ ์ค„ ์ˆ˜๊ฐ€ ์žˆ๋‹ค.
no_sim=1 make posix_sitl_default gazebo๋ฅผ ์‹คํ–‰์‹œํ‚จ ํ„ฐ๋ฏธ๋„ ์ฐฝ์—์„œ ์‰˜์ด ๋œฌ๋‹ค.

pxh>commander takeoff  

์ด ๋•Œ ์‰˜์ด ๋‚˜์˜ค์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๋Š” ์•„๋ž˜๋ฅผ ์‹คํ–‰์‹œ์ผœ์ค€๋‹ค.

cd ~/src/Firmware/Tools/sitl_gazebo/Build  
cmake ..  
make

2. ์ฃผํ–‰ํ•˜๊ธฐ

3. ์žฅ์• ๋ฌผ ํ™˜๊ฒฝ์—์„œ ์ฃผํ–‰ํ•˜๊ธฐ

4. ์„ผ์„œ ๊ฐ’์„ ์ฝ์–ด์„œ ์ฃผํ–‰ ์ปจํŠธ๋กค

5. Navigation Map ๋งŒ๋“ค๊ธฐ

โš ๏ธ **GitHub.com Fallback** โš ๏ธ