sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update && sudo apt upgrade && sudo apt dist-upgrade
sudo apt-fast install ros-melodic-desktop-full
sudo apt install ros-melodic-desktop-full
sudo apt --fix-broken install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash --extend" >> ~/.bashrc
source ~/.bashrc
source /opt/ros/melodic/setup.bash
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential python3-opencv python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml ros-${ROS_DISTRO}-cv-bridge python-scikits-learn python-sklearn python3-scipy python-scipy
python2 -m pip install catkin-tools rospkg matplotlib scikit-image scikit-build
python3 -m pip install catkin-tools rospkg matplotlib scikit-image scikit-build
sudo rosdep init
rosdep update
记得要在python node的文件头部加上,否则rosrun仍会调用python2
#!/usr/bin/env python3
参考链接
sudo apt-get remove gazebo-*
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
cat /etc/apt/sources.list.d/gazebo-stable.list
输出为:
deb http://packages.osrfoundation.org/gazebo/ubuntu-stable xenial main
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install gazebo9 libgazebo9-dev
gazebo
killall gzserver gzclient
roscore
roscore& --后台启动
killall roscore rosmaster
sudo apt install libavformat-dev libavcodec-dev libswresample-dev libswscale-dev libavutil-dev libsdl1.2-dev liborocos-kdl-dev freeglut3 freeglut3-dev libsfml-dev ros-${ROS_DISTRO}-moveit ros-${ROS_DISTRO}-moveit-visual-tools ros-${ROS_DISTRO}-kdl-* ros-${ROS_DISTRO}-joint-state-publisher-gui ros-${ROS_DISTRO}-trac-ik ros-${ROS_DISTRO}-teleop-twist-keyboard ros-${ROS_DISTRO}-teleop-twist-joy ros-${ROS_DISTRO}-moveit-resources ros-${ROS_DISTRO}-navigation ros-${ROS_DISTRO}-gmapping ros-${ROS_DISTRO}-hector-slam ros-${ROS_DISTRO}-slam-karto ros-${ROS_DISTRO}-robot-state-publisher ros-${ROS_DISTRO}-geographic-msgs ros-${ROS_DISTRO}-libuvc-* ros-${ROS_DISTRO}-uvc-camera ros-${ROS_DISTRO}-usb-cam ros-${ROS_DISTRO}-camera-calibration ros-${ROS_DISTRO}-ar-track-alvar ros-${ROS_DISTRO}-rgbd-launch ros-${ROS_DISTRO}-pointcloud-to-laserscan ros-${ROS_DISTRO}-mbf-msgs ros-${ROS_DISTRO}-mbf-costmap-core ros-${ROS_DISTRO}-costmap-converter ros-${ROS_DISTRO}-bfl ros-${ROS_DISTRO}-serial ros-${ROS_DISTRO}-arbotix-* ros-${ROS_DISTRO}-laser-proc ros-${ROS_DISTRO}-depthimage-to-laserscan ros-${ROS_DISTRO}-rosserial-arduino ros-${ROS_DISTRO}-rosserial-python ros-${ROS_DISTRO}-rosserial-server ros-${ROS_DISTRO}-rosserial-client ros-${ROS_DISTRO}-rosserial-msgs ros-${ROS_DISTRO}-amcl ros-${ROS_DISTRO}-map-server ros-${ROS_DISTRO}-urdf ros-${ROS_DISTRO}-xacro ros-${ROS_DISTRO}-compressed-image-transport ros-${ROS_DISTRO}-rqt-image-view ros-${ROS_DISTRO}-interactive-markers ros-${ROS_DISTRO}-octomap* ros-${ROS_DISTRO}-joy* ros-${ROS_DISTRO}-dwa-local-planner ros-${ROS_DISTRO}-multirobot-map-merge ros-${ROS_DISTRO}-cv-bridge ros-${ROS_DISTRO}-imu-tools ros-${ROS_DISTRO}-rtabmap-ros ros-${ROS_DISTRO}-image-transport ros-${ROS_DISTRO}-image-transport-plugins ros-${ROS_DISTRO}-rosbridge-server ros-${ROS_DISTRO}-unique-id ros-${ROS_DISTRO}-yocs-math-toolkit ros-${ROS_DISTRO}-yocs-msgs ros-${ROS_DISTRO}-joystick-drivers joystick ros-${ROS_DISTRO}-async-web-server-cpp ros-${ROS_DISTRO}-web-video-server ros-${ROS_DISTRO}-cartographer* ros-${ROS_DISTRO}-turtlebot3-*
rosdep install rqt_plot imu_tools
sudo apt-get install ros-${ROS_DISTRO}-trac-ik liborocos-kdl-dev libboost-dev libkdl-parser-dev libeigen3-dev
rosdep install kdl_parser
rosmake kdl_parser
pip3 install smbus
登录ipaddress 、Dns查询;输入查询对应的ip
github.global.ssl.fastly.net
github.com
打开文件,修改host文件中的ip地址
sudo gedit /etc/hosts
sudo vim /etc/hosts
需要根据实际情况调整格式 ip与网址至少一个tab键的距离,网址上下尽量对齐。
151.101.228.133 raw.github.com
199.232.28.133 raw.githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
重启电脑,让hosts文件生效;你会发现git clone的速度快很多。
修改rosdep源码中下载资源的函数来解决这一问题。
sudo vim /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py 310行
找到download_rosdep_data函数,添加
url="https://ghproxy.com/"+url
修改URL;例如
DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
https://ghproxy.com/
sudo vim /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py 72行 310行
sudo vim /usr/lib/python2.7/dist-packages/rosdistro/__init__.py 68行
sudo vim /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py 36行
sudo vim /usr/lib/python2.7/dist-packages/rosdep2/rep3.py 39行
sudo vim /usr/lib/python2.7/dist-packages/rosdistro/manifest_provider/github.py 68行 119行
noetic
url="https://ghproxy.com/"+url
https://ghproxy.com/
sudo vim /usr/lib/python3/dist-packages/rosdep2/sources_list.py 72行 310行
sudo vim /usr/lib/python3/dist-packages/rosdistro/__init__.py 68行
sudo vim /usr/lib/python3/dist-packages/rosdep2/gbpdistro_support.py 36行
sudo vim /usr/lib/python3/dist-packages/rosdep2/rep3.py 39行
sudo vim /usr/lib/python3/dist-packages/rosdistro/manifest_provider/github.py 68行 119行
初始化并更新
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
sudo rosdep init
rosdep update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
The following packages have unmet dependencies:
ros-${ROS_DISTRO}-desktop-full :
Depends: ros-${ROS_DISTRO}-desktop but it is not going
解决方案更换软件源