ÉèÖÃLinuxϵͳÒÔÖ§³Ö¹¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²ú¿ª·¢
ÉèÖÃlinuxϵͳÒÔÖ§³Ö¹¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²ú¿ª·¢
Ëæ׏¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²úµÄ¿ìËÙÉú³¤£¬Ô½À´Ô½¶àµÄÆóÒµ×îÏÈʹÓÃLinuxϵͳÀ´Ö§³ÖËüÃǵÄÉú²ú¿ª·¢¡£Linuxϵͳ¾ßÓÐÓÅÒìµÄÎȹÌÐÔ¡¢ÎÞаÐԺͿɶ¨ÖÆÐÔ£¬ÕâʹµÃËü³ÉΪһ¸öÀíÏëµÄÑ¡Ôñ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÉèÖÃlinuxϵͳÒÔÖ§³Ö¹¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²ú¿ª·¢£¬²¢ÌṩһЩ´úÂëʾÀý¡£
×°ÖÃLinuxϵͳ
Ê×ÏÈ£¬ÄúÐèҪѡÔñÒ»¸öÊʺϵÄLinux¿¯Ðа沢½«Æä×°Öõ½ÄúµÄÅÌËã»úÉÏ¡£³£¼ûµÄÑ¡Ôñ°üÀ¨Ubuntu¡¢FedoraºÍCentOS¡£×°ÖÃÀú³Ì½«Òò²î±ðµÄ¿¯Ðаæ¶øÓÐËù²î±ð£¬Äú¿ÉÒԲο¼¹Ù·½Îĵµ»òÔÚÏ߽̳̾ÙÐвÙ×÷¡£
¸üÐÂϵͳ
×°ÖÃÍêLinuxϵͳºó£¬ÄúÐèҪʵʱ¸üÐÂϵͳÒÔ¼á³Ö×îеÄÇå¾²ÐԺ͹¦Ð§¡£·¿ªÖն˲¢ÔËÐÐÒÔÏÂÏÂÁîÀ´¸üÐÂϵͳ£º
sudo apt update
sudo apt upgrade
×°ÖÃÐëÒªµÄÈí¼þ°ü
½ÓÏÂÀ´£¬ÄúÐèҪװÖÃһЩÐëÒªµÄÈí¼þ°üÀ´Ö§³Ö¹¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²ú¿ª·¢¡£ÒÔÏÂÊÇһЩ³£ÓõÄÈí¼þ°ü£º
ROS£¨Robotic Operating System£©£ºÒ»¸öÓÃÓÚ»úеÈË¿ª·¢µÄ¿ªÔ´Æ½Ì¨¡£ÔËÐÐÒÔÏÂÏÂÁîÀ´×°ÖÃROS£º
sudo apt install ros-melodic-desktop-full
Gazebo£ºÒ»¸öÓÃÓÚÄ£Äâ»úеÈËÇéÐεĿªÔ´¹¤¾ß¡£ÔËÐÐÒÔÏÂÏÂÁîÀ´×°ÖÃGazebo£º
sudo apt install gazebo9
PythonºÍpip£ºÓÃÓÚ±àдºÍÖÎÀíPython¾ç±¾¡£ÔËÐÐÒÔÏÂÏÂÁîÀ´×°ÖÃËüÃÇ£º
sudo apt install python3 python3-pip
MATLAB£ºÒ»¸öÓÃÓÚ¹¤Òµ×Ô¶¯»¯¿ª·¢µÄÊ¢ÐеÄÊýÖµÅÌËãÈí¼þ¡£Äú¿ÉÒÔ´Ó¹Ù·½ÍøÕ¾ÏÂÔØMATLAB²¢Æ¾Ö¤Æä×°ÖÃ˵Ã÷¾ÙÐÐ×°Öá£
ÉèÖÃROS
×°ÖÃÍêROSºó£¬ÄúÐèÒª¶ÔÆä¾ÙÐÐһЩÉèÖ᣷¿ªÖն˲¢ÔËÐÐÒÔÏÂÏÂÁîÀ´ÉèÖÃROSµÄÇéÐαäÁ¿£º
echo “source /opt/ros/melodic/setup.bash” >> ~/.bashrc
source ~/.bashrc
½ÓÏÂÀ´£¬Äú¿ÉÒÔ½¨ÉèÒ»¸öROSÊÂÇéÇøÀ´×éÖ¯ÄúµÄ¹¤³Ì´úÂë¡£·¿ªÖն˲¢ÔËÐÐÒÔÏÂÏÂÁ
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
±àдºÍÔËÐÐROS½Úµã
ÔÚROSÖУ¬½Úµã£¨Node£©ÊÇÓÃÓÚÖ´ÐÐÌض¨Ê¹ÃüµÄ×ÔÁ¦Àú³Ì¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý´úÂ룬ÓÃÓÚ½¨ÉèÒ»¸öROS½Úµã²¢Ðû²¼ÐÂÎÅ£º
Ê×ÏÈ£¬½¨ÉèÒ»¸öÃûΪ”talker.py”µÄPythonÎļþ£¬²¢½«ÒÔÏ´úÂ븴ÖƲ¢Õ³Ìùµ½ÎļþÖУº
#!/usr/bin/env python import rospy from std_msgs.msg import String def talker(): pub = rospy.Publisher('chatter', String, queue_size=10) rospy.init_node('talker', anonymous=True) rate = rospy.Rate(10) while not rospy.is_shutdown(): hello_str = "hello world %s" % rospy.get_time() rospy.loginfo(hello_str) pub.publish(hello_str) rate.sleep() if __name__ == '__main__': try: talker() except rospy.ROSInterruptException: pass
µÇ¼ºó¸´ÖÆ
ÉúÑÄÎļþ²¢ÔËÐÐÒÔÏÂÏÂÁîÀ´Ê¹Æä¿ÉÖ´ÐУº
chmod +x talker.py
½ÓÏÂÀ´£¬·¿ªÖն˲¢ÔËÐÐÒÔÏÂÏÂÁîÀ´Æô¶¯ROS½Úµã£º
roscore
ÔÚÁíÒ»¸öÖÕ¶ËÖУ¬ÔËÐÐÒÔÏÂÏÂÁîÀ´ÔËÐДtalker.py”½Úµã£º
rosrun talker.py
ÕâÑù£¬Äú¾Í½¨ÉèÁËÒ»¸öROS½Úµã²¢×îÏÈÐû²¼”chatter”»°ÌâµÄÐÂÎÅ¡£
ÒÔÉÏÊÇÒ»¸ö¼òÆÓµÄʾÀý£¬Äú¿ÉÒÔƾ֤×Ô¼ºµÄÐèÇó±àдºÍÔËÐиüÖØ´óµÄROS½Úµã¡£
×ܽá
ÉèÖÃlinuxϵͳÒÔÖ§³Ö¹¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²ú¿ª·¢ÊÇÒ»¸öÏà¶Ô¼òÆÓµÄÀú³Ì¡£ÄúÖ»ÐèҪѡÔñÊʺϵÄLinux¿¯Ðа桢װÖÃÐëÒªµÄÈí¼þ°ü£¬²¢¾ÙÐÐһЩ»ù±¾µÄÉèÖᣱðµÄ£¬ROSÌṩÁËÒ»¸öÇ¿Ê¢µÄƽ̨À´¿ª·¢ºÍÖÎÀí»úеÈËÓ¦ÓóÌÐò¡£Ï£Íû±¾ÎĶÔÄúÓÐËù×ÊÖú£¬²¢ÄÜΪÄúµÄ¹¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²ú¿ª·¢Ìṩָµ¼¡£
ÒÔÉϾÍÊÇÉèÖÃLinuxϵͳÒÔÖ§³Ö¹¤Òµ»úеÈ˺Í×Ô¶¯»¯Éú²ú¿ª·¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡