Judge ROS version number - Ubuntu 20.04 install ROS_noetic - modify mirror source

Keywords: Ubuntu ROS

Judge ROS version number

The robot uses raspberry pie, stm32 and ros.

First, configure the network, plug the sd card on the robot into the raspberry pie development board, and then configure the connected hotspot.

Next, plug the sd card back into the raspberry pie on the robot, turn on the hotspot, and the robot will automatically connect to the hotspot.

Use MobaXterm_Personal software to create an ssh connection.

First, open a terminal and enter roscore:

    ┌──────────────────────────────────────────────────────────────────────┐
    │                 • MobaXterm Personal Edition v21.3 •                 │
    │               (SSH client, X server and network tools)               │
    │                                                                      │
    │ ➤ SSH session to lemon@192.168.137.189                               │
    │   • Direct SSH      :  ✔                                             │
    │   • SSH compression :  ✔                                             │
    │   • SSH-browser     :  ✔                                             │
    │   • X11-forwarding  :  ✔  (remote display is forwarded through SSH)  │
    │                                                                      │
    │ ➤ For more info, ctrl+click on help or visit our website.            │
    └──────────────────────────────────────────────────────────────────────┘

Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1035-raspi aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


Last login: Sun Oct 24 12:03:52 2021 from 192.168.137.1
lemon@lemon:~$ roscore
... logging to /home/lemon/.ros/log/93e79cda-3486-11ec-a274-e94615cd611d/roslaunch-lemon-1399.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://lemon:40829/
ros_comm version 1.15.9


SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.9

NODES

auto-starting new master
process[master]: started with pid [1436]
ROS_MASTER_URI=http://lemon:11311/

setting /run_id to 93e79cda-3486-11ec-a274-e94615cd611d
process[rosout-1]: started with pid [1462]
started core service [/rosout]

Open another terminal and enter rosparam list

Then enter rosparam get /rosdistro

    ┌──────────────────────────────────────────────────────────────────────┐
    │                 • MobaXterm Personal Edition v21.3 •                 │
    │               (SSH client, X server and network tools)               │
    │                                                                      │
    │ ➤ SSH session to lemon@192.168.137.189                               │
    │   • Direct SSH      :  ✔                                             │
    │   • SSH compression :  ✔                                             │
    │   • SSH-browser     :  ✔                                             │
    │   • X11-forwarding  :  ✔  (remote display is forwarded through SSH)  │
    │                                                                      │
    │ ➤ For more info, ctrl+click on help or visit our website.            │
    └──────────────────────────────────────────────────────────────────────┘

Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1035-raspi aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Sun Oct 24 12:45:37 2021 from 192.168.137.1
lemon@lemon:~$ rosparam list
/rosdistro
/roslaunch/uris/host_lemon__40829
/rosversion
/run_id
lemon@lemon:~$ rosparam get /rosdistro
'noetic

  '

Then you can find that the current version of ROS is noetic. Noetic is the last long-term support version of ROS1.

Next, we will study ros and continue to configure noetic ros under Linux Ubuntu 20.04.

Install ROS

In vmware-linux-ubuntu 20.04, open the terminal and enter the instructions as follows.

1. Add ros source

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

2. Add key

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3. If the above addition fails, you can add a key as follows

curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -

4. Update software

sudo apt update

5. Install ros

sudo apt install ros-noetic-desktop-full

6. Add the ros environment loading script to bashrc

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Test ROS:

Open three terminals and write roscore, rosrun, turnlesim and turnlesim respectively_ node,rosrun turtlesim turtle_teleop_key

jym@ubuntu:~$ roscore 
... logging to /home/jym/.ros/log/5b2a055c-34a1-11ec-b36c-ed0dd69260d5/roslaunch-ubuntu-32694.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:42685/
ros_comm version 1.15.13


SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.13

NODES

auto-starting new master
process[master]: started with pid [32705]
ROS_MASTER_URI=http://ubuntu:11311/

setting /run_id to 5b2a055c-34a1-11ec-b36c-ed0dd69260d5
process[rosout-1]: started with pid [32715]
started core service [/rosout]

jym@ubuntu:~$ rosrun turtlesim turtlesim_node
[ INFO] [1635062998.850703821]: Starting turtlesim with node name /turtlesim
[ INFO] [1635062998.852881006]: Spawning turtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000]
jym@ubuntu:~$ rosrun turtlesim turtle_teleop_key
Reading from keyboard
---------------------------
Use arrow keys to move the turtle. 'q' to quit.

The tortoise can be controlled by the mouse, indicating that the installation is successful:

Change image source

It took three hours to install ros. It's too long, so I'll change the image source now.

Install vim in advance.

First, set the permission to enter root:

Enter sudo passwd root (pay attention to the spelling of passwd), and then enter the user password. Next, you will set the root password and confirm it again.

Next, enter su, and then enter the root password just set to enter root.

After that, if you want to exit, enter exit.

Then, after setting, start:

1. Back up the original file

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

2. Edit the image source file

vim /etc/apt/sources.list

In vim

Delete all codes: 0,$d

Then paste in:

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

Save and exit code: wq!

Update source:

sudo apt-get update

Update software:

sudo apt-get dist-upgrade
sudo apt-get upgrade

You can see the speed is very fast.

If you use ros, install the rospy package through pip

pip install rospkg
pip install catkin-tools

So far, ros is basically configured.

Posted by sig on Sun, 24 Oct 2021 01:59:08 -0700