文章

robot可视化相关

ros2 + rosbridge + lichtblick

lichtblick

docker

lichtblick可以直接docker启动

https://github.com/lichtblick-suite/lichtblick

doc: https://lichtblick-suite.github.io/docs/

1
sudo docker run --rm -p 8080:8080 ghcr.io/lichtblick-suite/lichtblick:latest

浏览器直接访问127.0.0.1:8080

web版本会有一些使用上的限制,例如无法从本地路径加载urdf等

源码

安装nodejs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"

# Download and install Node.js:
nvm install 22

# Verify the Node.js version:
node -v # Should print "v22.21.1".

# Download and install Yarn:
corepack enable yarn

# Verify Yarn version:
yarn -v

安装

Clone the repository:

1
git clone https://github.com/lichtblick-suite/lichtblick.git

Enable corepack:

1
corepack enable

Install packages from package.json:

1
2
cd licktblick
yarn install

安装rosbridge

rosbridge安装与ros对应的版本,例如ros2-humble

1
sudo apt install ros-humble-rosbridge-server

可以使用

1
ls /opt/ros/

查看已经安装的ros版本


### 启动rosbridige

1
ros2 launch rosbridge_server rosbridge_websocket_launch.xml

启动成功后

1
2
3
4
5
6
7
8
9
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
[INFO] [launch]: All log files can be found below /xxx/.ros/log/2025-12-18-16-37-15-657226-System-Product-Name-2008449
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rosbridge_websocket-1]: process started with pid [2008450]
[INFO] [rosapi_node-2]: process started with pid [2008452]
[rosbridge_websocket-1] [WARN] [1766047035.988190223] [rosbridge_websocket]: The 'default_call_service_timeout' parameter is currently set to 0.0, which means service calls will block indefinitely if no response is received. Please note that in the Jazzy and later releases, the default value for this parameter will be updated to 5.0 seconds.
[rosbridge_websocket-1] [WARN] [1766047035.988344673] [rosbridge_websocket]: The 'call_services_in_new_thread' parameter is currently set to False, which means service calls will block the main thread. Please note that in the Jazzy and later releases, the default value for this parameter will be updated to True.
[rosbridge_websocket-1] [WARN] [1766047035.988458115] [rosbridge_websocket]: The 'send_action_goals_in_new_thread' parameter is currently set to False, which means sending action goals will block the main thread. Please note that in the Jazzy and later releases, the default value for this parameter will be updated to True.
[rosbridge_websocket-1] [INFO] [1766047035.988924259] [rosbridge_websocket]: Rosbridge WebSocket server started on port 9090

检查是否启动成功

1
2
ros2 node list
# 启动成功后应该包含: /rosbridge_websocket

报错bson

首先检查ros使用的python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 报错
[rosbridge_websocket-1]     import bson
[rosbridge_websocket-1] ModuleNotFoundError: No module named 'bson'
[ERROR] [rosbridge_websocket-1]: process has died [pid 2007470, exit code 1, cmd '/opt/ros/humble/lib/rosbridge_server/rosbridge_websocket --ros-args -r __node:=rosbridge_websocket --params-file /tmp/

# 检查ros使用的pythyon
$ head -n 1 /opt/ros/humble/lib/rosbridge_server/rosbridge_websocket
#!/usr/bin/env python3

# 检查当前终端的python
$ which python3
# 如果不是,则conda deactivate退出conda环境

# 修复
python3 -m pip install --user pymongo
本文由作者按照 CC BY 4.0 进行授权