ãããããå¿
èŠã«å¿ããŠã誰ããä»ããã¯ã¢ããã³ãã¿ãŒã§é£ã¶ããšãã§ããŸãã ããããèªåŸå¶åŸ¡ã®åé¡ã解決ããããã«ããªã¢ãŒãã³ã³ãããŒã«ã®ã¹ãã£ãã¯ãåãããŠãããŒã³ã絶ããç£èŠããå¿
èŠã¯ãããŸãã-ãã®èšå®ã§ã¯ããœãªã¥ãŒã·ã§ã³ã¯å€ãã®ãªãœãŒã¹ãå¿
èŠãšããå ŽåããããŸãïŒè³Œå
¥ãçµã¿ç«ãŠãã¯ãã ä»ããæ§æãé¢éžãèœäžãèœäžåŸ-ãµã€ã¯ã«ã®æåã«æ»ããŸãã
Aeronetã®å¯©æ»å¡/æåž«ã«ãããžã§ã¯ããæããéããã§ã«åºæ¬çãªç¥èãæã£ãŠããããããå·¥åŠ/ã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ã®æåž«åãã«ãç¡äººè»äž¡ã®ããããã¯ãžã®ãšã³ããªãããã°ã©ãã³ã°ãç°¡çŽ åããå¿
èŠããããŸãã
ãããŒã³ãã©ã€ãã®ããã°ã©ãã³ã°ã®åºæ¬ãåŠã¶ç°¡åãªæ¹æ³ããããŸããããã¯ãä»®æ³ã·ãã¥ã¬ãŒã·ã§ã³ç°å¢ã§ããããã®èšäºã§äœ¿çšæ¹æ³ã段éçã«èª¬æããŸãã
åºæ¬çãªãããŒã³ããã°ã©ãã³ã°ã¹ãã«ãã¢ããã°ã¬ãŒãããããã«äœãã賌å
¥ããå¿
èŠã¯ãããŸãããPX4ãããžã§ã¯ãã®jMAVSimãããŒã³ã·ãã¥ã¬ãŒã¿ãŒã䜿çšããã ãã§ãã PX4ã¯ãé£è¡ãšå°äžç§»åã®äž¡æ¹ã®ããŸããŸãªç¡äººè»äž¡ã§äœ¿çšããããã«èšèšããã匷åãªãªãŒãã³ãœãŒã¹ãœãããŠã§ã¢ã¹ã€ãŒãã§ãã ãããžã§ã¯ããœãããŠã§ã¢ã®ãœãŒã¹ã³ãŒãã¯Githubã«ãããŸãã
åœåãPX4ã®äœæè
ã¯éçºç°å¢ãšããŠLinux Ubuntu LTSãæšå¥šããŠããŸãã Macã®ãµããŒãããããŸãã ä»å¹ŽãWindowsçšã®ã·ãã¥ã¬ãŒã·ã§ã³ããã³éçºç°å¢ãCygwinã«ç»å ŽããŸãããããã«ãããã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ã®ææ¥ã§Windowsã䜿çšãããã·ã¢ã®æè²æ©é¢ã®ç掻ãç°¡çŽ åãããŸãã
次ã«ãLinuxããã³Windowsã§ã·ãã¥ã¬ãŒã¿ãŒãã€ã³ã¹ããŒã«ããã«ããå®è¡ããããã»ã¹ãèŠãŠãããŸãã
Linux Ubuntuã§ã®jMAVSimã®ã€ã³ã¹ããŒã«ãšå®è¡
PX4éçºè
ã¯ãæšæºã·ã¹ãã ãšããŠLinux Ubuntu 16.04 LTSãæšå¥šããŠããŸãã Linuxã§ã¯ããµããŒããããŠãããã¹ãŠã®ã·ã¹ãã ïŒNuttXãQualcomm Snapdragon FlightãLinuxãã·ãã¥ã¬ãŒã·ã§ã³ç°å¢ãROSã«åºã¥ãããŒããŠã§ã¢ãã©ãããã©ãŒã ïŒã®PX4ããã±ãŒãžãæ§ç¯ã§ããŸãã
ãŸãããã€ã€ã«ã¢ãŠãã°ã«ãŒãã«ãŠãŒã¶ãŒãè¿œå ããŸãã
sudo usermod -a -G dialout $USER
å€æŽãæå¹ã«ããããã«ã·ã¹ãã ã«ãã°ã€ã³ããŸãããã
jmavsimãå«ãPixhawk / NuttXã®éçºããŒã«ãã§ãŒã³ã¯ã ubuntu_sim_nuttx.shã¹ã¯ãªããã䜿çšããŠèªåçã«ã€ã³ã¹ããŒã«ãããŸãã ã¹ã¯ãªããããŠãŒã¶ãŒãã£ã¬ã¯ããªã«ããŠã³ããŒãããã³ãã³ãã䜿çšããŠå®è¡ããå¿
èŠããããŸã
source ubuntu_sim_nuttx.sh
ã¹ã¯ãªããããã®è³ªåã¯ãã¹ãŠè¯å®çã«åçãããŸãã
ã¹ã¯ãªããã®æåŸã«ãã³ã³ãã¥ãŒã¿ãŒãåèµ·åããŸãã
ãã©ã€ããå¶åŸ¡ãããã«ãããã³ã³ãããŒã©ãŒã®ãœãŒã¹ã³ãŒããããŠã³ããŒãããããšã¯æ®ããŸãã
githubã§PX4ãã©ã€ãã³ã³ãããŒã©ãŒãœãããŠã§ã¢ãªããžããªãè€è£œããŸãã
git clone https://github.com/PX4/Firmware.git
ãã¡ãŒã ãŠã§ã¢ãã©ã«ããŒã«ã¯ããã©ã€ãã³ã³ãããŒã©ãŒïŒããã³ã·ãã¥ã¬ãŒã¿ãŒïŒã§å®è¡ãããå®å
šãªãœãŒã¹ã³ãŒãããããŸãã å°æ¥çã«ã¯ãåŠç¿ãšä¿®æ£ã®äž¡æ¹ã®ç®çã§åœ¹ç«ã¡ãŸãã ãã¡ãŒã ãŠã§ã¢ãªããžããªã®ã³ããŒããããã©ã«ããŒã«ç§»åããŸãã
cd src/Firmware
ã·ãã¥ã¬ãŒã¿ãŒãã³ã³ãã€ã«ããŠå®è¡ããŸãã
make px4_sitl jmavsim
æåã®ã³ã³ãã€ã«ããã»ã¹ã«ã¯æéãããããŸãã æ£åžžã«å®äºãããšãPX4ã³ã³ãœãŒã«ãç»é¢ã«è¡šç€ºãããŸãã
ã³ã³ãœãŒã«ã«ã³ãã³ããå
¥åããŠããããŒã³ãé£è¡äžã«éä¿¡ã§ããŸãã
pxh> commander takeoff
ãããŒã³-ã³ãã³ãcommander land
ãã·ãã¥ã¬ãŒã·ã§ã³ã®åæ¢-CTRL + CãŸãã¯ã³ãã³ãã®shutdown
ã
Windowsã«jMAVSimãã€ã³ã¹ããŒã«ããŠå®è¡ãã
PX4 CygwinããŒã«ããã¯ã¹ã¯2018幎ã«ç»å ŽããŸããã ããã¯ãWindowsçšã®PX4ãã³ã³ãã€ã«/éçºããæã匷åãªæ¹æ³ã§ãã ã€ã³ã¹ããŒã«ããã«ã¯ã GithubãŸãã¯Amazonããã€ã³ã¹ããŒã«ãã¡ã€ã«ãããŠã³ããŒãããŠå®è¡ããŸãã
ããã©ã«ãã§ã¯ãããŒã«ãã§ãŒã³ã¯CïŒ\ PX4ãã©ã«ããŒã«ã€ã³ã¹ããŒã«ãããŸãã
ã€ã³ã¹ããŒã©ã®æåŸã®ã¹ãããã§ããPX4ãªããžããªã®ã¯ããŒã³ãäœæããjMAVSimã§ã·ãã¥ã¬ãŒã·ã§ã³ããã«ãããã³å®è¡ãããããã¯ã¹ããã§ãã¯ã§ããŸãïŒPX4ãªããžããªãã¯ããŒã³ããjMAVSimã·ãã¥ã¬ãŒã¿ãã³ã³ãã€ã«ããŠå®è¡ããŸãïŒã
éçºç°å¢ã¯ãã€ã³ã¹ããŒã«ãã£ã¬ã¯ããªïŒããã©ã«ãã§ã¯CïŒ\ PX4ïŒã®run-console.batãã¡ã€ã«ã䜿çšããŠCygwinã§èµ·åãããŸãã
ã€ã³ã¹ããŒã«ããã»ã¹äžã«jMAVSimèµ·åãã§ãã¯ããã¯ã¹ããã§ãã¯ããã®ãå¿ããå Žå-Cygwinã§ã¯ã次ã®ã³ãã³ãã䜿çšããŠãªããžããªã®ã¯ããŒã³ãäœæããã·ãã¥ã¬ãŒã¿ãå®è¡ã§ããŸãã
git clone --recursive -j8 https://github.com/PX4/Firmware.git cd Firmware make px4_sitl jmavsim
ã³ã³ãã€ã«åŸãPX4ã³ã³ãœãŒã«ãšã·ãã¥ã¬ãŒã¿ãŠã£ã³ããŠãç»é¢ã«è¡šç€ºãããŸãã
ç§ã®Windowsã§ã¯ã ã·ãã¥ã¬ãŒã¿ãŒã®éçºè
ã«å ±åãããŠããããã«ã空ãšæšã¯ãŸã 衚瀺ãããŠããããé»ãèæ¯ã§ã¯ãããŸããã
ãããŒã³ãå¶åŸ¡ããããã®ã³ã³ãœãŒã«ã³ãã³ãã¯åãã§ãïŒé¢éž- commander takeoff
ãçéž- commander land
ãã·ãã¥ã¬ãŒã·ã§ã³ã®åæ¢-CTRL + CãŸãã¯shutdown
ã
QGroundControl Ground Stationããã°ã©ã ã§ã®ãã©ã€ã
QGroundControlããã°ã©ã ã䜿çšãããšãPX4ãŸãã¯ArduPilotãã©ãããã©ãŒã ã§ãããŒã³ãå®å
šã«æ§æã§ããã ãã§ãªããGPSãä»ããèªåŸå±å€é£è¡ãèšç»ããã³å®è¡ã§ããŸãã
ããã°ã©ã ã³ãŒãã¯å®å
šã«ãªãŒãã³ã§ãããWindowsãOS XãLinuxãiOSãAndroidã®ãã©ãããã©ãŒã ã§åäœããŸãã ç®çã®ãã©ãããã©ãŒã ã®ã€ã³ã¹ããŒã«ãã¡ã€ã«ã¯ãããã°ã©ã Webãµã€ãã®ããŠã³ããŒãã»ã¯ã·ã§ã³ããããŠã³ããŒãã§ããŸãã
Windowsã®å Žåã ãã®ãã¡ã€ã«ãããŠã³ããŒãããŠå®è¡ããŸã ã
ã€ã³ã¹ããŒã«ãšèµ·ååŸãjMAVSimãã³ã³ãã¥ãŒã¿ãŒã§æ¢ã«å®è¡ãããŠããå Žåãããã°ã©ã ã¯èªåçã«æ¥ç¶ããŸãã
Fly-Takeoffãã¿ã³ã䜿çšããŠé£è¡äžã«ãããŒã³ãèµ·åããçéžããããšãã§ããŸã-Landã GPSãã€ã³ãã§ä»®æ³é£è¡ãå®è¡ããããšãã§ããŸãã
mavrosã䜿çšããèªåŸé£è¡ã®ããã°ã©ãã³ã°
jMAVSimä»®æ³ãããŒã³ã¯mavlinkãããã³ã«ã䜿çšããŠå¶åŸ¡ã§ããŸããmavlinkãããã³ã«ã¯ãããã€ãã®èšäºã§èª¬æãããŠããŸãïŒããšãã°ã 1ã2 ïŒã mavlinkéä¿¡ãå®è£
ããã«ã¯ã ROSïŒãããããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ïŒã·ã¹ãã ã®mavrosããã±ãŒãžã䜿çšããŸã ã
PX4éçºè
ã¯ãROS Kineticã®äœ¿çšãæšå¥šããŠããŸãã
mavrosããã±ãŒãžã¯ãROSïŒããšãã°ãLinuxãŸãã¯Raspberry PIãæèŒããä»®æ³ãã·ã³ïŒãå®è¡ããŠããã³ã³ãã¥ãŒã¿ãŒãšãã©ã€ãã³ã³ãããŒã©ãŒïŒå®ç°å¢ãŸãã¯ã·ãã¥ã¬ãŒã¿ãŒç°å¢ïŒéã®MAVLinkãããã³ã«ãä»ããéä¿¡ãæäŸããŸãã
mavrosããã±ãŒãžã¯ãROS Kineticã®å®å
šã€ã³ã¹ããŒã«äžã«ä»ã®ããã±ãŒãžãšãšãã«ã€ã³ã¹ããŒã«ãããŸãã
mavrosããã±ãŒãžã¯ãroslaunchã³ãã³ãã«ããã·ãã¥ã¬ãŒã¿ãŒãžã®æ¥ç¶ã§èµ·åãããã·ãã¥ã¬ãŒã¿ãŒãå®è¡ãããŠããã³ã³ãã¥ãŒã¿ãŒã®IPã¢ãã¬ã¹ãšããŒãã瀺ããŸãã
roslaunch mavros px4.launch fcu_url:="udp://@192.168.0.22:14557"
jmaVSimãå®è¡ãããŠãããã¹ãã§ã·ãã¥ã¬ãŒã¿ãŒãå®è¡ãããŠããªãå Žåãmavrosã«æ¥ç¶ããåã«ãjMAVSimã³ã³ãœãŒã«ã®param set MAV_BROADCAST 1
ã䜿çšããŠãããã¯ãŒã¯çµç±ã§mavlinkã¡ãã»ãŒãžã³ã°ãæå¹ã«ããå¿
èŠããããŸãã ã³ãã³ããå®è¡ããããšãmavlinkãããã³ã«ã«äœ¿çšããããã¹ãIPã¢ãã¬ã¹ã衚瀺ãããŸãã ããŒãã¯ãã·ãã¥ã¬ãŒã¿ã³ã³ãœãŒã«ã§mavlink status
ã³ãã³ãã䜿çšããŠmavlink status
ããšãã§ããŸãã
次ã®ã³ãã³ãã䜿çšããŠããã©ã€ãã³ã³ãããŒã©ãŒãžã®æ¥ç¶ã®æåã確èªããå¿
èŠããããŸãã
rostopic echo /mavros/state
æ¥ç¶ãæåãããšãããããã¡ãã»ãŒãžãã³ã³ãœãŒã«ã«è¡šç€ºãããŸãã mavlinkããŒãããŒãã1ç§éã«çŽ1åïŒ
ã¡ãã»ãŒãžã衚瀺ãããªã/æŽæ°ãããªã/ãã£ãŒã«ãConnected = Falseã®å Žå-ãã©ã€ãã³ã³ãããŒã©ãŒãšã®éä¿¡ã確ç«ãããŠããªããããçç±ã確èªããå¿
èŠããããŸãã
ãã®èšäºã®å·çæç¹ã§ã¯ãWindowsã®å Žåãparam set MAV_BROADCAST 1ã³ãã³ãã®åŸãjMAVSimã³ã³ãœãŒã«ã®ã¡ãã»ãŒãžãã«ãŒãã§è¡šç€ºããå§ããŸããã
WARN [mavlink] getting required buffer size failed.
ã·ãã¥ã¬ãŒã¿ãŒãWindowsã§æ£ããåäœãããã«ã¯ãsrc / modules / mavlink / mavlink_main.cppãã¡ã€ã«ã®1029è¡ç®ãè¿œå ããå¿
èŠããããŸãã
#if defined(__APPLE__) && defined(__MACH__) || defined(__CYGWIN__)
ã³ãã³ãmake px4_sitl jmavsim
䜿çšããŠã·ãã¥ã¬ãŒã¿ãåã³ã³ãã€ã«/åèµ·åããŸãã
ãã®åé¡ã¯éçºè
ã«å ±åãããŠãã ãå°æ¥ã®ãªãªãŒã¹ã§ä¿®æ£ãããå¯èœæ§ããããŸãã
æ¥ç¶ã«æåããããROSã·ã¹ãã ã³ã³ãœãŒã«ã®æ¬¡ã®ã³ãã³ãã䜿çšããŠãèªåŸé£è¡ã§ãããŒã³ãèµ·åã§ããŸãã
æåŸã®ã³ãã³ããå®è¡ããåŸãä»®æ³ãããŒã³ã¯é¢éžãã5ã¡ãŒãã«ã®é«ãã§ãããªã³ã°ããŸãã
ã·ã³ãã«ãªPythonã³ãŒãã䜿çšããŠãããŒã³ãèµ·åããããšãã§ããŸãã
import rospy from geometry_msgs.msg import PoseStamped from mavros_msgs.srv import CommandBool, SetMode rospy.init_node("offbrd",anonymous=True) rate=rospy.Rate(5) setpoint_pub=rospy.Publisher("/mavros/setpoint_position/local",PoseStamped,queue_size=10) arming_s=rospy.ServiceProxy("/mavros/cmd/arming",CommandBool) set_mode=rospy.ServiceProxy("/mavros/set_mode",SetMode) setpt=PoseStamped() setpt.pose.position.z=5 for i in range (0,10): setpoint_pub.publish(setpt) rate.sleep() set_mode(0,"OFFBOARD") arming_s(True) while (rospy.is_shutdown()==False): setpoint_pub.publish(setpt) rate.sleep()
äžèšã®ã³ãŒãã¯ãã³ãã³ãã©ã€ã³åŒã³åºãã®äŸãšåãROSãµãŒãã¹ãžã®åŒã³åºãã䜿çšããŠããŸãã
ã³ãŒããããã¹ããã¡ã€ã«ïŒfly_jmavsim.pyãªã©ïŒã«ã³ããŒãã python fly_jmavsim.py
ã䜿çšããŠã³ãã³ãã©ã€ã³ããå®è¡ããå¿
èŠããããŸãã
ãã®äŸããããã°ããéçšã§ãjMAVSimã·ãã¥ã¬ãŒã¿ãŒã®æ©èœã«ééããŸãããéåžžã®æäœã«ã¯åŒ·åãªããã»ããµãŒãå¿
èŠã§ãã Linuxä»®æ³ãã·ã³ã§ã¯ã圌ã¯äœãšã10 FPSããèšç®ã§ãããé¢éžåŸããã«èœã¡ãŸããã ã©ãããããäžã§ãç§ãèšäºãæžããŠããéã圌ã¯ãŸãå®æçã«ã³ã³ãããŒã«ã倱ããã¯ã©ãã·ã¥ããŸããã ã©ãããããããããã¯ãŒã¯ãã絊é»ãããã®ãå©ããŸãã-ãªããªã ããããªãŒããé»åãäŸçµŠããããšãçé»åã¢ãŒããã¢ã¯ãã£ãã«ãªããããã»ããµãŒã®ããã©ãŒãã³ã¹ãéå°è©äŸ¡ãããã·ãã¥ã¬ãŒã¿ãŒã«çŽæ¥åœ±é¿ããŸãã
äžããããäŸã«åºã¥ããŠãåžæãã人ã¯èªåŸé£è¡ããã°ã©ã ãéçºã§ããŸãïŒæ£æ¹åœ¢ãåãä»»æã®è»éãªã©ïŒã ãã®ãããªæŒç¿ã®å®è¡ã¯ãå®éã®ã¯ã¢ããã³ãã¿ãŒã§èªåŸããã·ã§ã³ãããã°ã©ãã³ã°ããããã®æºåã«åœ¹ç«ã¡ãŸãã
ãã©ã€ãã®æåããç¥ãããŸãïŒ
åç
§ïŒ
ãããããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ïŒROSïŒ
ãªãŒããã€ãããPX4