gazebo需要导入的是SDF模型,rviz才是urdf
-
应该是这里出错了:
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [py]: cannot import name 'LaunchConfiguration' from 'launch.substitution' (/opt/ros/humble/lib/python3.10/site-packages/launch/substitution.py)
d7b5a1c8-70f3-45c4-adad-c1a1cd76a785-image.png
终端运行后没有弹出rviz2,并且报错:
aeb7dded-f256-46b1-a827-8de836acadf0-image.png根据终端显示的错误找到了下面的文件:
from typing import Text from typing import TYPE_CHECKING if TYPE_CHECKING: from .launch_context import LaunchContext # noqa: F401 class Substitution: """Encapsulates a substitution to be performed at runtime.""" def describe(self) -> Text: """ Return a description of this substitution as a string. When inherited from, calling this base class's default method is not required. """ return repr(self) # Note: LaunchContext is in a string here to break a circular import. def perform(self, context: 'LaunchContext') -> Text: """ Perform the substitution, given the launch context, and return it as a string. This should be overridden by the derived classes, and the default raises NotImplementedError. :raises: NotImplementedError """ raise NotImplementedError('perform() not implemented for Substitution base class.')
1717cf00-0619-4637-b5d2-07cbba45986e-image.png但是,不知道是文件有问题还是,ros2版本的问题,求大佬解答。
-
0ebd4cb9-325d-4892-840b-56a0cc5b0fdd-image.png
nav2编译报错,与rclcpp的create_client函数不匹配,在rolling分支下rclcpp是匹配的760cbffd-2a6d-42cd-8120-fd807e6094c4-image.png
但在humble分支下则没有这个
d9505ff7-801c-4553-a9b0-11f0fa0b1758-image.png
通过二进制安装的,请问这种情况要怎么匹配版本? -
luo-ub22@Nitro-AN515-57:~$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
[INFO] [launch]: All log files can be found below /home/luo-ub22/.ros/log/2023-12-01-21-59-33-404812-Nitro-AN515-57-26296
[INFO] [launch]: Default logging verbosity is set to INFO
urdf_file_name : turtlebot3_burger.urdf
urdf_file_name : turtlebot3_burger.urdf
[INFO] [gzserver-1]: process started with pid [26297]
[INFO] [gzclient-2]: process started with pid [26299]
[INFO] [robot_state_publisher-3]: process started with pid [26301]
[INFO] [spawn_entity.py-4]: process started with pid [26303]
[robot_state_publisher-3] [INFO] [1701439174.185340046] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-3] [INFO] [1701439174.185437440] [robot_state_publisher]: got segment base_link
[robot_state_publisher-3] [INFO] [1701439174.185442406] [robot_state_publisher]: got segment base_scan
[robot_state_publisher-3] [INFO] [1701439174.185446789] [robot_state_publisher]: got segment caster_back_link
[robot_state_publisher-3] [INFO] [1701439174.185468371] [robot_state_publisher]: got segment imu_link
[robot_state_publisher-3] [INFO] [1701439174.185471157] [robot_state_publisher]: got segment wheel_left_link
[robot_state_publisher-3] [INFO] [1701439174.185473939] [robot_state_publisher]: got segment wheel_right_link
[spawn_entity.py-4] Traceback (most recent call last):
[spawn_entity.py-4] File "/opt/ros/humble/lib/gazebo_ros/spawn_entity.py", line 30, in <module>
[spawn_entity.py-4] from geometry_msgs.msg import Pose
[spawn_entity.py-4] File "/opt/ros/humble/local/lib/python3.10/dist-packages/geometry_msgs/msg/init.py", line 3, in <module>
[spawn_entity.py-4] from geometry_msgs.msg._accel_with_covariance import AccelWithCovariance # noqa: F401
[spawn_entity.py-4] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[spawn_entity.py-4] File "/opt/ros/humble/local/lib/python3.10/dist-packages/geometry_msgs/msg/_accel_with_covariance.py", line 13, in <module>
[spawn_entity.py-4] import numpy # noqa: E402, I100
[spawn_entity.py-4] ^^^^^^^^^^^^
[spawn_entity.py-4] ModuleNotFoundError: No module named 'numpy'
[ERROR] [spawn_entity.py-4]: process has died [pid 26303, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -entity burger -file /opt/ros/humble/share/turtlebot3_gazebo/models/turtlebot3_burger/model.sdf -x -2.0 -y -0.5 -z 0.01 --ros-args'].
截图 2023-12-01 22-02-26.png -
ROS(机器人操作系统)是一个用于开发机器人软件的开源框架,而rosbridge_server则提供了一种在ROS和其他系统之间进行通信的方式。在本文中,我们将介绍如何通过Web页面实现一个简单的ROS遥控器,使用rosbridge_websocket连接到ROS系统,并通过按键控制机器人的运动。
f27940a5-fe1b-499c-b870-113b20bec770-image.png
准备工作首先,确保你已经安装了ROS2,并且已经启动了rosbridge_server的rosbridge_websocket插件。你可以使用以下命令安装和启动:
sudo apt install ros-$ROS_DISTRO-rosbridge-suite ros2 run rosbridge_server rosbridge_websocket这将在本地WebSocket服务器的9090端口上启动rosbridge_websocket。
创建Web接着随便新建一个文件 index.html
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <style> body { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; font-family: Arial, sans-serif; } button { margin: 5px; padding: 10px 20px; font-size: 18px; border: 2px solid #3498db; border-radius: 5px; background-color: #3498db; color: #ffffff; cursor: pointer; transition: background-color 0.3s; } button:hover { background-color: #2980b9; } </style> <script src="https://cdn.jsdelivr.net/npm/roslib@1.3.0/build/roslib.js"></script> </head> <body> <h1>ROS Web Controller</h1> <div> <button onclick="moveForward()">Forward</button> <button onclick="moveBackward()">Backward</button> </div> <div> <button onclick="moveLeft()">Left</button> <button onclick="stopMovement()">Stop</button> <button onclick="moveRight()">Right</button> </div> <script> let ros; let cmdVel; function startConnection() { ros = new ROSLIB.Ros({ url: 'ws://localhost:9090' // 替换为你的Rosbridge服务器地址,主要将 localhost 改成你的主机IP地址,比如 ws://192.168.1.2:9090 }); ros.on('connection', () => { console.log('Connected to ROS Bridge'); cmdVel = new ROSLIB.Topic({ ros: ros, name: '/cmd_vel', messageType: 'geometry_msgs/Twist' }); }); ros.on('error', (error) => { console.error('Error connecting to ROS: ', error); alert('Error connecting to ROS: 9090', error); }); ros.on('close', () => { console.log('Disconnected from ROS'); alert('Disconnected from ROS'); }); } function move(direction) { if (!ros) { console.error('ROS connection not established'); alert('ROS connection not established'); return; } if (!cmdVel) { console.error('Publisher not created'); alert('Publisher not created'); return; } const twist = new ROSLIB.Message({ linear: { x: direction.linear.x, y: direction.linear.y, z: direction.linear.z }, angular: { x: direction.angular.x, y: direction.angular.y, z: direction.angular.z } }); cmdVel.publish(twist); } function moveForward() { const moveForwardMsg = { linear: { x: 0.2, y: 0, z: 0 }, angular: { x: 0, y: 0, z: 0 } }; move(moveForwardMsg); } function moveBackward() { const moveBackwardMsg = { linear: { x: -0.2, y: 0, z: 0 }, angular: { x: 0, y: 0, z: 0 } }; move(moveBackwardMsg); } function moveLeft() { const moveLeftMsg = { linear: { x: 0, y: 0.0, z: 0 }, angular: { x: 0, y: 0, z: 0.5 } }; move(moveLeftMsg); } function moveRight() { const moveRightMsg = { linear: { x: 0, y: 0, z: 0 }, angular: { x: 0, y: 0, z: 0.5 } }; move(moveRightMsg); } function stopMovement() { const stopMsg = { linear: { x: 0, y: 0, z: 0 }, angular: { x: 0, y: 0, z: 0 } }; move(stopMsg); } startConnection(); // 初始化ROS连接 </script> </body> </html> 访问服务接着使用 python 来新建一个服务器:
python3 -m http.server接着访问:http://0.0.0.0:8000/ 就可以看到下面的界面(这个网页可以远程访问,只需要修改下访问的IP地址为你的电脑局域网地址,比如用手机可以看到这个页面,这样手机就相当于一个无线遥控器用了)
f27940a5-fe1b-499c-b870-113b20bec770-image.png
点击界面上的按钮就可以发布数据到 cmd_vel 话题上,连上 fishbot 就可以控制机器人移动了
远程访问需要替换html中这一个地址:url: 'ws://localhost:9090' // 替换为你的Rosbridge服务器地址,主要将 localhost 改成你的主机IP地址,比如 ws://192.168.1.2:9090
cbb5d113-bb09-4a3f-8ee0-5ca24f4369cf-image.png
原理介绍rosbridge_websocket 节点会在本地的9090端口启动一个websocker服务,然后将 ros 数据进行互相的序列化传输,web端使用的是最常见的 websocket。
rosbridge_websocket <----websocket(json)---->web-html
从浏览器后台可以看到数据的传输
b0016334-e8f7-4bdb-afd6-e20a9655f746-image.png
-
-
-
wget http://fishros.com/install -O fishros && . fishros
--2023-11-30 10:46:27-- http://fishros.com/install
Resolving fishros.com (fishros.com)... 139.9.131.171
Connecting to fishros.com (fishros.com)|139.9.131.171|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://fishros.com/install/ [following]
--2023-11-30 10:46:27-- http://fishros.com/install/
Reusing existing connection to fishros.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 582 [application/octet-stream]
Saving to: ‘fishros’fishros 100%[===================>] 582 --.-KB/s in 0s
2023-11-30 10:46:27 (88.7 MB/s) - ‘fishros’ saved [582/582]
.: no such file or directory: fishros
求解 -
zlm@zlm-virtual-machine:~/dev_ws$ rosdepc install -i --from-path src --rosdistro humble -y
欢迎使用国内版rosdep之rosdepc,我是作者小鱼!
欢迎关注公众号《鱼香ROS》加入交流群
小鱼rosdepc正式为您服务executing command [sudo -H apt-get install -y ros-humble-joint-state-publisher-gui]
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
E: 无法定位软件包 ros-humble-joint-state-publisher-gui
ERROR: the following rosdeps failed to install
apt: command [sudo -H apt-get install -y ros-humble-joint-state-publisher-gui] failed -
ros2 service call /save_map cartographer_ros_msgs/srv/SaveMap "{path: /home/, include_unfinished_submaps: true}" Traceback (most recent call last): File "/opt/ros2/foxy/lib/python3.6/site-packages/rosidl_generator_py/import_type_support_impl.py", line 46, in import_type_support return importlib.import_module(module_name, package=pkg_name) File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'cartographer_ros_msgs.cartographer_ros_msgs_s__rosidl_typesupport_c' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/ros2/foxy/bin/ros2", line 11, in <module> load_entry_point('ros2cli==0.9.11', 'console_scripts', 'ros2')() File "/opt/ros2/foxy/lib/python3.6/site-packages/ros2cli/cli.py", line 67, in main rc = extension.main(parser=parser, args=args) File "/opt/ros2/foxy/lib/python3.6/site-packages/ros2service/command/service.py", line 41, in main return extension.main(args=args) File "/opt/ros2/foxy/lib/python3.6/site-packages/ros2service/verb/call.py", line 59, in main args.service_type, args.service_name, args.values, period) File "/opt/ros2/foxy/lib/python3.6/site-packages/ros2service/verb/call.py", line 83, in requester cli = node.create_client(srv_module, service_name) File "/opt/ros2/foxy/lib/python3.6/site-packages/rclpy/node.py", line 1249, in create_client check_for_type_support(srv_type) File "/opt/ros2/foxy/lib/python3.6/site-packages/rclpy/type_support.py", line 29, in check_for_type_support msg_type.__class__.__import_type_support__() File "/opt/eame/cartographer_ros_msgs/lib/python3.6/site-packages/cartographer_ros_msgs/srv/_save_map.py", line 279, in __import_type_support__ module = import_type_support('cartographer_ros_msgs') File "/opt/ros2/foxy/lib/python3.6/site-packages/rosidl_generator_py/import_type_support_impl.py", line 48, in import_type_support raise UnsupportedTypeSupport(pkg_name) rosidl_generator_py.import_type_support_impl.UnsupportedTypeSupport: Could not import 'rosidl_typesupport_c' for package 'cartographer_ros_msgs'
-
-
ubuntu20系统,rviz报错
[ERROR] [1701151739.199545856] [rviz2]: Vertex Program:rviz/glsl120/indexed_8bit_image.vert Fragment Program:rviz/glsl120/indexed_8bit_image.frag GLSL link result :
active samplers with a different type refer to the same texture image unit![46c33bf6-1251-46e5-9b16-0d7bf73a1bf2-图片.png]
-
-
个人在使用结构光相机D435i,在深度测距的时候,距离并不准确,距离达到两米的时候,测距能测出来两米三,个人目前使用过去噪和对齐处理,结果差强人意,请问下除了更换硬件设备,还能有什么办法可以优化
-
-
-
-
58131b38-e204-45fc-a18a-a3f1637036f6-image.png
-
-