@小鱼 你好,小鱼,我想通过这个做一个类似于ros1中动态修改bool值的参数修改,但在ParameterDescriptor()没有填写bool值的属性,是需要通过别的方法去做吗?
c11397f2-aeb0-4623-9823-b87435c7b14d-image.png
da26f80b-39d5-4ba8-8cc3-5f59f9ab8c2c-image.png
在跟着b站鱼香ros 的ros2仿真教程学习的过程中,给机器人部件添加质量和关系报错。
common_inertia.xacro代码:
base.urdf.xacro代码:
<?xml version="1.0"?> <robot xmlns:xacro="http://www.wiki.ros.org/xacro" > <xacro:include filename="$(find fishbot_description)urdf/fishbot/common_inertia.xacro"/> <xacro:macro name="base_xacro" params="length radius"> <link name="base_footprint"/> <link name="base_link"> <visual> <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/> <geometry> <cylinder radius="${radius}" length="${length}"/> </geometry> <material name="white"> <color rgba="1.0 1.0 1.0 0.5"/> </material> </visual> <collision> <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/> <geometry> <cylinder radius="${radius}" length="${length}"/> </geometry> <material name="white"> <color rgba="1.0 1.0 1.0 0.5"/> </material> </collision> <xacro:cylinder_inertia m="1.0" r="${radius}" h="${length}"/> </link> <joint name="base_joint" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <axis xyz="0.0 0.0 0.0"/> <origin xyz="0.0 0.0 ${length/2.0+0.032-0.001}" rpy="0 0 0" /> </joint> </xacro:macro> </robot>报错是:
[INFO] [launch]: All log files can be found below /home/zmy/.ros/log/2025-01-14-18-00-57-621013-zmyTB-41493
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): executed command failed. Command: xacro /home/zmy/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/urdf/fishbot/fishbot.urdf.xacro
Captured stderr output: error: No such file or directory: /home/zmy/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_descriptionurdf/fishbot/common_inertia.xacro [Errno 2] No such file or directory: '/home/zmy/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_descriptionurdf/fishbot/common_inertia.xacro'
when processing file: /home/zmy/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/urdf/fishbot/base.urdf.xacro
included from: /home/zmy/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/urdf/fishbot/fishbot.urdf.xacro
3bb9fa0b-90da-41ef-9665-01815331397a-image.png
日志:Traceback (most recent call last):
File "/home/yozora/test_ws/src/test.py", line 2, in <module>
from rclpy import Node
ImportError: cannot import name 'Node' from 'rclpy' (/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/init.py)
版本:WSL(windows11)Ubuntu22.04 ROS2humble 使用python3.10和rclpy3.3.15
当我再尝试学习时发现在import Node上出了问题,请问有什么解决方法吗。我只能搜索到引用rclpy失败的却无法搜索到引用Node失败的。
(base) ros2@gs-ros2:~/test1$ ros2 pkg create --build-type ament_python --license Apache-2.0 demo_python_pkg
Failed to load entry point 'create': No module named 'catkin_pkg.package'
Traceback (most recent call last):
File "/opt/ros/humble/bin/ros2", line 33, in <module>
sys.exit(load_entry_point('ros2cli==0.18.11', 'console_scripts', 'ros2')())
File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 52, in main
add_subparsers_on_demand(
File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/command/init.py", line 250, in add_subparsers_on_demand
extension.add_arguments(
File "/opt/ros/humble/lib/python3.10/site-packages/ros2pkg/command/pkg.py", line 25, in add_arguments
add_subparsers_on_demand(
File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/command/init.py", line 237, in add_subparsers_on_demand
extension = command_extensions[name]
KeyError: 'create'
退出base环境后
ros2@gs-ros2:~/test1$ ros2 pkg create --build-type ament_python --license Apache-2.0 demo_python_pkg
Failed to load entry point 'create': No module named 'catkin_pkg.package'
Traceback (most recent call last):
File "/opt/ros/humble/bin/ros2", line 33, in <module>
sys.exit(load_entry_point('ros2cli==0.18.11', 'console_scripts', 'ros2')())
File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 52, in main
add_subparsers_on_demand(
File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/command/init.py", line 250, in add_subparsers_on_demand
extension.add_arguments(
File "/opt/ros/humble/lib/python3.10/site-packages/ros2pkg/command/pkg.py", line 25, in add_arguments
add_subparsers_on_demand(
File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/command/init.py", line 237, in add_subparsers_on_demand
extension = command_extensions[name]
KeyError: 'create'
屏幕截图 2025-01-14 132501.jpg
请教一下各位大佬,我该怎么样使这个机械臂沿zy轴运动
3050cde7bcae885cfad73cb50f83328.jpg
7ffa7e48-da95-4a90-8b4b-b620bbcd5b30-image.png
0cc2b0b1-eca0-4846-baf5-b3b6aa8a8fbd-截图 2025-01-12 21-28-46.png file:///home/lbj/%E5%9B%BE%E7%89%87/%E6%88%AA%E5%9B%BE/%E6%88%AA%E5%9B%BE%202025-01-12%2021-28-46.png
检测到程序发生异常退出,请打开:https://fishros.org.cn/forum 携带如下内容进行反馈
标题:使用一键安装过程中遇到程序崩溃
Traceback (most recent call last): File "/tmp/fishinstall/install.py", line 134, in <module> main() File "/tmp/fishinstall/install.py", line 60, in main from tools.base import CmdTask,FileUtils,PrintUtils,ChooseTask,ChooseWithCategoriesTask,Tracking File "/tmp/fishinstall/tools/base.py", line 782, in <module> osversion = GetOsVersion() File "/tmp/fishinstall/tools/base.py", line 112, in GetOsVersion import distro ModuleNotFoundError: No module named 'distro'本次运行详细日志文件已保存至 /tmp/fishros_install.log
安装distro也没有解决
ldh@ldh-LINUX:~$ wget http://fishros.com/install -O fishros && . fishros
--2025-01-12 15:40:34-- http://fishros.com/install
正在解析主机 fishros.com (fishros.com)... 198.18.0.75
正在连接 fishros.com (fishros.com)|198.18.0.75|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 301 Moved Permanently
位置:http://fishros.com/install/ [跟随至新的 URL]
--2025-01-12 15:40:34-- http://fishros.com/install/
再次使用存在的到 fishros.com:80 的连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 957 [application/octet-stream]
正在保存至: ‘fishros’
fishros 100%[===================>] 957 --.-KB/s 用时 0s
2025-01-12 15:40:34 (148 MB/s) - 已保存 ‘fishros’ [957/957])
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
python3-distro 已经是最新版 (1.9.0-1)。
python3-yaml 已经是最新版 (6.0.1-2build2)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 103 个软件包未被升级。
--2025-01-12 15:40:35-- http://mirror.fishros.com/install/tools/base.py
正在解析主机 mirror.fishros.com (mirror.fishros.com)... 198.18.0.79
正在连接 mirror.fishros.com (mirror.fishros.com)|198.18.0.79|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 51464 (50K) [application/octet-stream]
正在保存至: ‘/tmp/fishinstall//tools/base.py’
/tmp/fishinstall//t 100%[===================>] 50.26K --.-KB/s 用时 0.09s
2025-01-12 15:40:35 (589 KB/s) - 已保存 ‘/tmp/fishinstall//tools/base.py’ [51464/51464])
WARN:No Yaml Module!
检测到程序发生异常退出,请打开:https://fishros.org.cn/forum 携带如下内容进行反馈
标题:使用一键安装过程中遇到程序崩溃
Traceback (most recent call last): File "/tmp/fishinstall/install.py", line 134, in <module> main() File "/tmp/fishinstall/install.py", line 60, in main from tools.base import CmdTask,FileUtils,PrintUtils,ChooseTask,ChooseWithCategoriesTask,Tracking File "/tmp/fishinstall/tools/base.py", line 782, in <module> osversion = GetOsVersion() File "/tmp/fishinstall/tools/base.py", line 112, in GetOsVersion import distro ModuleNotFoundError: No module named 'distro'本次运行详细日志文件已保存至 /tmp/fishros_install.log
安装distro还是不行
rosidl_generate_interfaces() called without any interface files
按照b站鱼香ros ros2仿真教程进行学习时,遇到报错。
<?xml version="1.0"?> <robot xmlns:xacro="http://wiki.ros.org/xacro" name="first_robot"> <xacro:macro name="base_link" params="length radius"> <link name="base_link"> <!--部件的外观描述--> <visual> <!--沿着自己几何中心的偏移和旋转量--> <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/> <!--几何形状--> <geometry> <cylinder radius="${radius}" length="${length}"/> </geometry> <!--材质颜色--> <material name="white"> <color rgba="1.0 1.0 1.0 0.5"/> </material> </visual> </link> </xacro:macro> <xacro:macro name="imu_link" params="imu_name xyz"> <!--机器人的IMU部件,惯性测量传感器--> <link name="${imu_name}_link"> <!--部件的外观描述--> <visual> <!--沿着自己几何中心的偏移和旋转量--> <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/> <!--几何形状--> <geometry> <box size="0.02 0.0 0.0"/> </geometry> <!--材质颜色--> <material name="black"> <color rgba="0.0 0.0 1.0 0.5"/> </material> </visual> </link> </xacro:macro> <!--机器人的关节,用于组合机器人的部件--> <joint name="${imu_name}_joint" type="fixed"> <parent link="base_link" /> <child link="${imu_name}_link" /> <origin xyz="${xyz}" rpy="0.0 0.0 0.0" /> </joint> <xacro:base_link length="0.12" radius="0.1"/> <xacro:imu_link imu_name="imu_up" xyz="0.0 0.0 0.03"/> <xacro:imu_link imu_name="imu_down" xyz="0.0 0.0 -0.03"/> </robot>849a5235-eab6-4a3b-bb91-c795df2fced3-图片.png
截图 2025-01-12 11-49-35.png
73379503-5079-468e-9240-8782aed53f1e-a3d298e1169d90534e954bab7512dc7.png 替代文字
URDF文件时solidworks软件插件生成的,可以生成数学模型
1558b641-7c63-4880-ad6f-0af919416828-image.png
启动后有如下报错
a41d953b-006a-4ad4-a5b2-62f4bdee15cd-image.png
我先是在按教程步骤测试小车与电脑是否ping通了,配置MicroROS服务是没问题的,然后我就在虚拟机上建了一个包,创建了一个fishfish_node节点,编写代码并修改CMake和package后运行节点,但是小车却没有反应,我想请教一下是我哪个步骤少了或者有问题吗。
205ab30e-4aac-4eb7-840c-e5ee8c5a8248-image.png
fishfish_node.cpp代码如下:
CMake如下:
cmake_minimum_required(VERSION 3.8) project(fishfish_package) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() # Find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(std_msgs REQUIRED) find_package(geometry_msgs REQUIRED) include_directories( include ${geometry_msgs_INCLUDE_DIRS} ) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) # the following line skips the linter which checks for copyrights # comment the line when a copyright and license is added to all source files set(ament_cmake_copyright_FOUND TRUE) # the following line skips cpplint (only works in a git repo) # comment the line when this package is in a git repo and when # a copyright and license is added to all source files set(ament_cmake_cpplint_FOUND TRUE) ament_lint_auto_find_test_dependencies() endif() # Add the executable add_executable(fishfish_node src/fishfish_node.cpp) ament_target_dependencies(fishfish_node rclcpp geometry_msgs)package代码如下:
<?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org> <package format="2"> <name>fishfish_package</name> <version>0.0.0</version> <description>Package to control a two-wheeled robot</description> <maintainer email="your_email@example.com">Your Name</maintainer> <license>Apache-2.0</license> <!-- Dependencies --> <buildtool_depend>ament_cmake</buildtool_depend> <depend>rclcpp</depend> <depend>std_msgs</depend> <depend>geometry_msgs</depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <!-- Build type --> <export> <build_type>ament_cmake</build_type> </export> </package>Ubuntu18.04一键安装ROS,始终换源失败,无法安装
下文
wan@wan-ThinkPad-X1-Yoga-3rd:~/chapt6/chapt6_ws$ ros2 launch fishbot_description gazebo_sim.launch.py [INFO] [launch]: All log files can be found below /home/wan/.ros/log/2025-01-11-14-07-04-583880-wan-ThinkPad-X1-Yoga-3rd-14586 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [14600] [INFO] [gzserver-2]: process started with pid [14602] [INFO] [gzclient-3]: process started with pid [14604] [robot_state_publisher-1] [INFO] [1736575625.302549794] [robot_state_publisher]: got segment back_caster_link [robot_state_publisher-1] [INFO] [1736575625.302688095] [robot_state_publisher]: got segment base_footprint [robot_state_publisher-1] [INFO] [1736575625.302710647] [robot_state_publisher]: got segment base_link [robot_state_publisher-1] [INFO] [1736575625.302723829] [robot_state_publisher]: got segment camera_link [robot_state_publisher-1] [INFO] [1736575625.302735153] [robot_state_publisher]: got segment front_caster_link [robot_state_publisher-1] [INFO] [1736575625.302746297] [robot_state_publisher]: got segment imu_link [robot_state_publisher-1] [INFO] [1736575625.302759291] [robot_state_publisher]: got segment laser_cylinder_link [robot_state_publisher-1] [INFO] [1736575625.302770978] [robot_state_publisher]: got segment laser_link [robot_state_publisher-1] [INFO] [1736575625.302781974] [robot_state_publisher]: got segment left_wheel_link [robot_state_publisher-1] [INFO] [1736575625.302792327] [robot_state_publisher]: got segment right_wheel_link [gzclient-3] Gazebo multi-robot simulator, version 11.10.2 [gzclient-3] Copyright (C) 2012 Open Source Robotics Foundation. [gzclient-3] Released under the Apache 2 License. [gzclient-3] http://gazebosim.org [gzclient-3] [gzserver-2] Gazebo multi-robot simulator, version 11.10.2 [gzserver-2] Copyright (C) 2012 Open Source Robotics Foundation. [gzserver-2] Released under the Apache 2 License. [gzserver-2] http://gazebosim.org [gzserver-2] [gzclient-3] [Msg] Waiting for master. [gzclient-3] [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [gzclient-3] [Msg] Publicized address: 192.168.1.174 [gzclient-3] [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in "" [gzclient-3] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call [gzclient-3] [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.截图 2025-01-11 14-17-39.png
版块
-
1.1k
主题4.2k
帖子 -
309
主题2.2k
帖子 -
1
主题12
帖子 -
878
主题3.6k
帖子 -
892
主题3.3k
帖子 -
2
主题5
帖子 -
337
主题1.5k
帖子