安装链接
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 install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update
roscore
如果报错如下
修复网络bug采用单机模式
RLException: Unable to contact my own server at [http://192.168.89.135:41931/].
This usually means that the network is not configured properly.
A common cause is that the machine cannot connect to itself. Please check
for errors by running:
ping 192.168.89.135
For more tips, please see
http://wiki.ros.org/ROS/NetworkSetup
The traceback for the exception was written to the log file
(2)打开bashrc文件需要在文件中修改
gedit ~/.bashrc
修改一下两个指令:修改后Save
export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=http://localhost:11311
接下来,我们在运行roscore就可以啦
显示这样就是正确的,在Beginner Tutorials中有一个简单的示例程序。小乌龟
1、在Terminal中运行以下命令:
roscore
2、新开一个terminal,运行以下命令,弹出一个小乌龟窗口:
rosrun turtlesim turtlesim_node
3、新开一个terminal,运行以下命令,打开乌龟控制窗口,可使用方向键控制乌龟运动:
rosrun turtlesim turtle_teleop_key
4、选中控制窗口,按方向键,可看到小乌龟窗口中乌龟在运动。
5、新开一个terminal,运行以下命令,可以看到ROS的图形化界面,展示结点的关系:
安装rospkg这个解决方式比较好
vi ~/.bashrc
alias python=python3
source ~/.bashrc
conda activate py36
conda install pip
pip install rospkg
rosrun rqt_graph rqt_graph