问题
今天写了一个ros节点,因为没有rospkg这个包,所以就运行sudo apt-get install rospkg命令,但是一运行,rospkg倒是安装上了,rospy什么的都被卸载了,头疼。
解决方案:
1.删除现有的ros包:
sudo apt-get purge ros-*
2.重新安装noetic
# Setup sources
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# Set up keys
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# Update package index
sudo apt-get update
# Install ROS Noetic full version
sudo apt-get install ros-noetic-desktop-full
3.初始化rosdep
sudo rosdep init
rosdep update
4.设置环境变量
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc