@小鱼 成功了,试了试还和VSCODE里面catkin_make的方式有关,以后注意下
通过launch可以启动rviz,但不显示模型,通过手动添加robotmodel并使用话题可以显示出模型。
launch文件如下:
配置文件如下(展示部分):
Panels: - Class: rviz_common/Displays Help Height: 85 Name: Displays Property Tree Widget: Expanded: - /Global Options1 - /Status1 - /RobotModel1 - /Axes1 Splitter Ratio: 0.5 Tree Height: 515 - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties Expanded: - /2D Goal Pose1 - /Publish Point1 Name: Tool Properties Splitter Ratio: 0.5886790156364441 - Class: rviz_common/Views Expanded: - /Current View1 Name: Views Splitter Ratio: 0.5 - Class: rviz_common/Time Experimental: false Name: Time SyncMode: 0 SyncSource: ""Docker安装的微信,如何设置微信的分辨率?微信安装后,字体非常小,几乎看不见
【《ROS 2机器人开发从入门到实践》3.4.3系统信息获取与发布】 https://www.bilibili.com/video/BV1GnH5eGEC3/?share_source=copy_web&vd_source=1a420da13de2005a4b95c85b21a48ff4
目前,该视频只有python版本的发布者代码,我已经照着视频改了一版cpp的代码。测试通过,可以正常运行。运行依赖于3.4.2节的接口和3.4.5的消息展示,这两节的内容课程中都有对应的cpp实现,所以,本篇文章只针对3.4.3节只有python实现的代码进行cpp实现。
代码:src/status_publisher/src/sys_status_pub.cpp
#include "rclcpp/rclcpp.hpp" #include "status_interfaces/msg/system_status.hpp" #include "sys/sysinfo.h" #include <bits/local_lim.h> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <sstream> #include <string> #include <unistd.h> using namespace std::chrono_literals; using SystemStatus = status_interfaces::msg::SystemStatus; class SysStatusPub : public rclcpp::Node { private: rclcpp::Publisher<SystemStatus>::SharedPtr _status_publiser; rclcpp::TimerBase::SharedPtr _timer; void timer_callback() { struct sysinfo info; if (sysinfo(&info) != 0) { RCLCPP_ERROR(this->get_logger(), "获取系统信息失败"); return; } /*TODO:计算CPU使用率*/ float cpu_percent = (float)(info.loads[0] * 100 / (1 << SI_LOAD_SHIFT)); /*获取内存信息*/ float memory_percent = (float)(info.totalram - info.freeram) / info.totalram * 100; float memory_total = (float)info.totalram / (1024 * 1024); float memory_available = (float)info.freeram / (1024 * 1024); /*获取网络I/O计数器*/ float net_sent = 0.0; float net_recv = 0.0; getNetworkIO(net_sent, net_recv); auto msg = std::make_shared<SystemStatus>(); /*获取当前时间并设置消息的时间戳*/ msg->stamp = this->get_clock()->now(); /*获取主机名*/ char hostname[HOST_NAME_MAX]; if (gethostname(hostname, HOST_NAME_MAX) == 0) { msg->host_name = hostname; } else { msg->host_name = "unknown"; } msg->cpu_percent = cpu_percent; msg->memory_percent = memory_percent; msg->memory_total = memory_total; msg->memory_available = memory_available; msg->net_sent = net_sent; msg->net_recv = net_recv; // RCLCPP_INFO(this->get_logger(), "发布:%s", rclcpp::tostring(*msg).c_str()); // std::cout<<msg<<std::endl; // rclcpp::fromStdstring /*发布消息*/ _status_publiser->publish(*msg); } /*从/proc/net/dev文件读取网络I/O信息并汇总字节数*/ void getNetworkIO(float &net_sent, float &net_recv) { std::ifstream file("/proc/net/dev"); if (!file) { RCLCPP_ERROR(this->get_logger(), "无法打开/proc/net/dev文件"); return; } std::string line; /*跳过文件头两行,头两行为标题信息等,不是具体数据*/ std::getline(file, line); std::getline(file, line); while (std::getline(file, line)) { std::stringstream iss(line); std::string interface; /*读取网络接口名称*/ std::getline(iss, interface, ':'); /*去除接口名称后的空格*/ interface.erase(interface.find_last_not_of(" \n\\t") + 1); /*对应接受和发送字节的位置,在文件中固定顺序*/ long long int bytes_recv, bytes_sent; iss >> bytes_recv; /*跳过中间其他统计数据,直接读取发送字节数*/ for (int i = 0; i < 7; ++i) { long long int t; iss >> t; } iss >> bytes_sent; net_recv += (float)bytes_recv / (1024 * 1024); net_sent += (float)bytes_sent / (1024 * 1024); } file.close(); } public: SysStatusPub() : Node("sys_status_pub") { /*创建发布者,话题名称为“sys_status”,队列长度为10*/ _status_publiser = this->create_publisher<SystemStatus>("sys_status", 10); /*创建定时器,每隔1s触发一次回调函数*/ _timer = this->create_wall_timer(std::chrono::seconds(1), std::bind(&SysStatusPub::timer_callback, this)); } }; int main(int argc, char **argv) { rclcpp::init(argc, argv); auto node = std::make_shared<SysStatusPub>(); rclcpp::spin(node); rclcpp::shutdown(); return 0; }src/status_publisher/CMakeLists.txt
cmake_minimum_required(VERSION 3.8) project(status_publisher) 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(status_interfaces REQUIRED) # find_package(rosidl_default_generators REQUIRED) add_executable(sys_status_pub src/sys_status_pub.cpp) ament_target_dependencies(sys_status_pub rclcpp status_interfaces) 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() install(TARGETS sys_status_pub DESTINATION lib/${PROJECT_NAME} ) ament_package() 启动打开两个终端,分别进入你的工作空间目录下,分别执行sys_status_pub和sys_status_display。
wd@ubuntu22:~/cpp_proj/241224/topic_practice_workspace$ colcon build wd@ubuntu22:~/cpp_proj/241224/topic_practice_workspace$ source install/setup.bash在第一个终端运行:
wd@ubuntu22:~/cpp_proj/241224/topic_practice_workspace$ ros2 run status_display sys_status_display在第二个终端运行:
wd@ubuntu22:~/cpp_proj/241224/topic_practice_workspace$ ros2 run status_publisher sys_status_pub 运行结果因为图片用外链工具生成,不保证时效性,大家可以自己运行一下,看看结果。
运行结果图
参照jupyter导入rclpy报错的解决方案,在vscode中安装了jupyter拓展,
参照3.2 编写ROS2代码
代码如下
1ddbb592-c7fd-4481-b037-d1c16705a525-image.png
执行后发现rclpy行无法中断
803df1d5-0351-463c-ac62-1af8f7ee91f5-image.png
执行中断后,发现上一次执行启动的节点并未关闭,出现了多个同名节点
78f1290a-c1bc-4473-a0b2-5a7315f12255-image.png
有可执行文件,配置好环境无法rosrun找到
背景:学习ros基础操作时发现
问题描述:在ros中,配置好了环境变量,在~/gongzuomul/devel/lib下也有可执行文件,但是rosrun找不到
具体细节和上下文:一、
rosrun找不到可执行文件,在devel/lib/包/中已经生成.o可执行文件
c92c1b73-1945-421b-9ea5-9d06c116d6b9-image.png
在rosrun时没有相应可执行文件
58dbf5a5-abac-43ab-9275-7b939232921d-image.png
二、
rosrun执行可执行文件是老文件,之前的turtle_new文件以及删除,新生成的为turtle_new1,但是rosrun找不到,而且仍然可以执行已经删除的turtle_new
67d132de-19ab-446f-9f46-8cfa701a8da5-image.png
在调用开源库驱动章节,使用原代码运行时,没有输出,更改代码setup部分后,dc71ad1e-d28c-4b76-81b0-8d26f5716d7c-image.png 输出结果如下图b164d275-78ad-4f58-9bee-6401e5f692a7-image.png 请问有人遇到过这个问题吗
launch文件gazebo_world.launch.py
import os from launch import LaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription from launch_ros.actions import Node from launch.substitutions import Command , LaunchConfiguration from launch_ros.parameter_descriptions import ParameterValue from ament_index_python.packages import get_package_share_directory def generate_launch_description(): urdf_package_path = get_package_share_directory('robot_description') default_urdf_path=os.path.join(urdf_package_path,'urdf','robot_description.urdf') action_declare_arg_model_robot = DeclareLaunchArgument('model', default_value = default_urdf_path, description = 'Model of the robot') substitutions_command_result = Command(['xacro ',LaunchConfiguration('model')]) robot_description_value = ParameterValue(substitutions_command_result, value_type=str) action_declare_x_pos = DeclareLaunchArgument('x_pos', default_value='0.0', description='X position') action_declare_y_pos = DeclareLaunchArgument('y_pos', default_value='0.0', description='Y position') action_declare_z_pos = DeclareLaunchArgument('z_pos', default_value='0.0', description='Z position') action_launch_gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join( get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py' ) ), launch_arguments={ 'world': os.path.join(get_package_share_directory('robot_description'), 'world', 'room.world'), 'paused': 'false', 'use_sim_time': 'true', 'gui': 'true', 'headless': 'false', 'debug': 'true' }.items() ) action_robot_state_publisher = Node( package='robot_state_publisher', executable='robot_state_publisher', output='screen', parameters=[{ 'robot_description': robot_description_value }] ) action_spawn_entity = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=[ '-topic','/robot_description', '-entity','Fu_robot' ] ) return LaunchDescription([ action_declare_x_pos, action_declare_y_pos, action_declare_z_pos, action_declare_arg_model_robot, action_robot_state_publisher, action_launch_gazebo, action_spawn_entity ])终端输入:
ros2 launch robot_description gazebo_world.launch.py model:=/home/leolanqin/catkin_ws_ros2/src/robot_description/urdf/robot_description.urdf.xacro终端显示:
[INFO] [launch]: All log files can be found below /home/leolanqin/.ros/log/2024-12-24-19-48-39-601713-leolanqin-virtual-machine-137116 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [137128] [INFO] [gzserver-2]: process started with pid [137130] [INFO] [gzclient-3]: process started with pid [137132] [INFO] [spawn_entity.py-4]: process started with pid [137134] [robot_state_publisher-1] [INFO] [1735040920.589923166] [robot_state_publisher]: got segment /ball_wheel_link [robot_state_publisher-1] [INFO] [1735040920.591342777] [robot_state_publisher]: got segment /base_camera_link [robot_state_publisher-1] [INFO] [1735040920.591364087] [robot_state_publisher]: got segment /base_footprint [robot_state_publisher-1] [INFO] [1735040920.591374176] [robot_state_publisher]: got segment /base_laser_link [robot_state_publisher-1] [INFO] [1735040920.591382682] [robot_state_publisher]: got segment /base_link [robot_state_publisher-1] [INFO] [1735040920.591391448] [robot_state_publisher]: got segment /imu [robot_state_publisher-1] [INFO] [1735040920.591401007] [robot_state_publisher]: got segment /left_wheel_link [robot_state_publisher-1] [INFO] [1735040920.591411176] [robot_state_publisher]: got segment /right_wheel_link [spawn_entity.py-4] [INFO] [1735040921.331660406] [spawn_entity]: Spawn Entity started [spawn_entity.py-4] [INFO] [1735040921.333053717] [spawn_entity]: Loading entity published on topic /robot_description [spawn_entity.py-4] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead. [spawn_entity.py-4] warnings.warn( [spawn_entity.py-4] [INFO] [1735040921.338627613] [spawn_entity]: Waiting for entity xml on /robot_description [spawn_entity.py-4] [INFO] [1735040921.355291473] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-4] [INFO] [1735040921.355721465] [spawn_entity]: Waiting for service /spawn_entity [gzserver-2] Error: Non-unique names detected in <link name='link'> [gzserver-2] <collision name='surface'> [gzserver-2] <pose>0 0 1 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <box> [gzserver-2] <size>1.5 0.8 0.03</size> [gzserver-2] </box> [gzserver-2] </geometry> [gzserver-2] <surface> [gzserver-2] <friction> [gzserver-2] <ode> [gzserver-2] <mu>0.6</mu> [gzserver-2] <mu2>0.6</mu2> [gzserver-2] </ode> [gzserver-2] <torsional> [gzserver-2] <ode/> [gzserver-2] </torsional> [gzserver-2] </friction> [gzserver-2] <contact> [gzserver-2] <ode/> [gzserver-2] </contact> [gzserver-2] <bounce/> [gzserver-2] </surface> [gzserver-2] <max_contacts>10</max_contacts> [gzserver-2] </collision> [gzserver-2] <visual name='visual1'> [gzserver-2] <pose>0 0 1 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <box> [gzserver-2] <size>1.5 0.8 0.03</size> [gzserver-2] </box> [gzserver-2] </geometry> [gzserver-2] <material> [gzserver-2] <script> [gzserver-2] <uri>file://media/materials/scripts/gazebo.material</uri> [gzserver-2] <name>Gazebo/Wood</name> [gzserver-2] </script> [gzserver-2] </material> [gzserver-2] </visual> [gzserver-2] <collision name='front_left_leg'> [gzserver-2] <pose>0.68 0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <max_contacts>10</max_contacts> [gzserver-2] <surface> [gzserver-2] <contact> [gzserver-2] <ode/> [gzserver-2] </contact> [gzserver-2] <bounce/> [gzserver-2] <friction> [gzserver-2] <torsional> [gzserver-2] <ode/> [gzserver-2] </torsional> [gzserver-2] <ode/> [gzserver-2] </friction> [gzserver-2] </surface> [gzserver-2] </collision> [gzserver-2] <visual name='front_left_leg'> [gzserver-2] <pose>0.68 0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <material> [gzserver-2] <script> [gzserver-2] <uri>file://media/materials/scripts/gazebo.material</uri> [gzserver-2] <name>Gazebo/Grey</name> [gzserver-2] </script> [gzserver-2] </material> [gzserver-2] </visual> [gzserver-2] <collision name='front_right_leg'> [gzserver-2] <pose>0.68 -0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <max_contacts>10</max_contacts> [gzserver-2] <surface> [gzserver-2] <contact> [gzserver-2] <ode/> [gzserver-2] </contact> [gzserver-2] <bounce/> [gzserver-2] <friction> [gzserver-2] <torsional> [gzserver-2] <ode/> [gzserver-2] </torsional> [gzserver-2] <ode/> [gzserver-2] </friction> [gzserver-2] </surface> [gzserver-2] </collision> [gzserver-2] <visual name='front_right_leg'> [gzserver-2] <pose>0.68 -0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <material> [gzserver-2] <script> [gzserver-2] <uri>file://media/materials/scripts/gazebo.material</uri> [gzserver-2] <name>Gazebo/Grey</name> [gzserver-2] </script> [gzserver-2] </material> [gzserver-2] </visual> [gzserver-2] <collision name='back_right_leg'> [gzserver-2] <pose>-0.68 -0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <max_contacts>10</max_contacts> [gzserver-2] <surface> [gzserver-2] <contact> [gzserver-2] <ode/> [gzserver-2] </contact> [gzserver-2] <bounce/> [gzserver-2] <friction> [gzserver-2] <torsional> [gzserver-2] <ode/> [gzserver-2] </torsional> [gzserver-2] <ode/> [gzserver-2] </friction> [gzserver-2] </surface> [gzserver-2] </collision> [gzserver-2] <visual name='back_right_leg'> [gzserver-2] <pose>-0.68 -0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <material> [gzserver-2] <script> [gzserver-2] <uri>file://media/materials/scripts/gazebo.material</uri> [gzserver-2] <name>Gazebo/Grey</name> [gzserver-2] </script> [gzserver-2] </material> [gzserver-2] </visual> [gzserver-2] <collision name='back_left_leg'> [gzserver-2] <pose>-0.68 0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <max_contacts>10</max_contacts> [gzserver-2] <surface> [gzserver-2] <contact> [gzserver-2] <ode/> [gzserver-2] </contact> [gzserver-2] <bounce/> [gzserver-2] <friction> [gzserver-2] <torsional> [gzserver-2] <ode/> [gzserver-2] </torsional> [gzserver-2] <ode/> [gzserver-2] </friction> [gzserver-2] </surface> [gzserver-2] </collision> [gzserver-2] <visual name='back_left_leg'> [gzserver-2] <pose>-0.68 0.38 0.5 0 -0 0</pose> [gzserver-2] <geometry> [gzserver-2] <cylinder> [gzserver-2] <radius>0.02</radius> [gzserver-2] <length>1</length> [gzserver-2] </cylinder> [gzserver-2] </geometry> [gzserver-2] <material> [gzserver-2] <script> [gzserver-2] <uri>file://media/materials/scripts/gazebo.material</uri> [gzserver-2] <name>Gazebo/Grey</name> [gzserver-2] </script> [gzserver-2] </material> [gzserver-2] </visual> [gzserver-2] <self_collide>0</self_collide> [gzserver-2] <enable_wind>0</enable_wind> [gzserver-2] <kinematic>0</kinematic> [gzserver-2] </link> [gzserver-2] [spawn_entity.py-4] [INFO] [1735040922.136157557] [spawn_entity]: Calling service /spawn_entity [gzserver-2] Topic [default/Fu_robot//base_footprint/csi_Camera/image] is not valid. [gzserver-2] [INFO] [1735040922.819461672] [camera_controller]: Publishing camera info to [/csi_Camera/camera_info] [spawn_entity.py-4] [INFO] [1735040923.350189398] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [Fu_robot] [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 137134]我新建了一个ros2的功能包,src下面的代码是qt写的,colcon build可以生成可执行程序。但是ros2run的时候报错找不到可执行程序,手动执行可执行程序是可以的。```
3073d401-3955-4c82-ad18-55872ac81939-截图 2024-12-24 17-25-03.png file:///home/zzy/%E5%9B%BE%E7%89%87/%E6%88%AA%E5%9B%BE/%E6%88%AA%E5%9B%BE%202024-12-24%2017-25-03.png
0be964cc-4f5e-4234-b630-f297bb498706-截图 2024-12-24 17-26-52.png file:///home/zzy/%E5%9B%BE%E7%89%87/%E6%88%AA%E5%9B%BE/%E6%88%AA%E5%9B%BE%202024-12-24%2017-26-52.png
d87fb118-d9c4-4d9d-a623-36c7c915b82a-截图 2024-12-24 17-28-13.png file:///home/zzy/%E5%9B%BE%E7%89%87/%E6%88%AA%E5%9B%BE/%E6%88%AA%E5%9B%BE%202024-12-24%2017-28-13.png
代码都是按照鱼哥视频一步一步来的但是在运行发布的节点的时候一直不能运行,我看了下确定功能包名字没有写错哇,鱼哥救我
报错日志:
sys_status_pub.py
import rclpy from rclpy.node import Node from status_interface.msg import SystemStatus # 导入消息接口 import psutil import platform class SysStatusPub(Node): def __init__(self, node_name): super().__init__(node_name) self.status_publisher_ = self.create_publisher( SystemStatus, 'sys_status', 10) self.timer = self.create_timer(1, self.timer_callback) def timer_callback(self): cpu_percent = psutil.cpu_percent() memory_info = psutil.virtual_memory() net_io_counters = psutil.net_io_counters() msg = SystemStatus() msg.stamp = self.get_clock().now().to_msg() msg.host_name = platform.node() msg.cpu_percent = cpu_percent msg.memory_percent = memory_info.percent msg.memory_total = memory_info.total / 1024 / 1024 msg.memory_available = memory_info.available / 1024 / 1024 msg.net_sent = net_io_counters.bytes_sent / 1024 / 1024 msg.net_recv = net_io_counters.bytes_recv / 1024 / 1024 self.get_logger().info(f'发布:{str(msg)}') self.status_publisher_.publish(msg) def main(): rclpy.init() node = SysStatusPub('sys_status_pub') rclpy.spin(node) rclpy.shutdown() ``` setup.pyfrom setuptools import find_packages, setup
package_name = 'status_publisher'
setup(
name=package_name,
version='0.0.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='mzebra',
maintainer_email='mzebra@foxmail.com',
description='TODO: Package description',
license='Apache-2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'sys_status_pub=status_publisher.sys_status_pub:main'
],
},
)
《ROS 2机器人开发从入门到实践》书籍配套视频,对应章节3.4.4在功能包中使用QT。社区地址:fishros.org.cn
运行时报以下错误:
wd@ubuntu22:~/cpp_proj/241224/topic_practice_workspace$ ros2 run stat us_display hello_qt /home/wd/cpp_proj/241224/topic_practice_workspace/install/status_display/lib/status_display/hello_qt: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE [ros2run]: Process exited with failure 127hello.qt.cpp
#include <QApplication> #include <QLabel> #include <QString> int main(int argc, char **argv) { QApplication app(argc, argv); QLabel *label = new QLabel(); QString msg = QString::fromStdString("Hello Qt!\nFROM ROS2"); label->setText(msg); label->show(); app.exec(); return 0; }CMakeLists.txt
cmake_minimum_required(VERSION 3.8) project(status_display) 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(status_interfaces REQUIRED) find_package(Qt5 REQUIRED COMPONENTS Widgets) add_executable(hello_qt src/hello_qt.cpp) target_link_libraries(hello_qt Qt5::Widgets) 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() install(TARGETS hello_qt DESTINATION lib/${PROJECT_NAME} ) ament_package()package.xml
<?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <package format="3"> <name>status_display</name> <version>0.0.0</version> <description>TODO: Package description</description> <maintainer email="wd@todo.todo">wd</maintainer> <license>Apache-2.0</license> <buildtool_depend>ament_cmake</buildtool_depend> <depend>rclcpp</depend> <depend>status_interfaces</depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <export> <build_type>ament_cmake</build_type> </export> </package>各位鱼香ROS社区的小伙伴们,大家好!
由于社区用户的持续增长,以及小鱼个人精力有限,无法做到全天候在线回复问题。最近两天,有用户因深夜提问未能及时回复而发脾气或冷嘲热讽,为了更好地维护社区秩序和提升服务质量,决定对社区问答规则进行如下调整:
优先支持范围
【VIP问答专区】和【产品&店铺相关问题】:保证有问必答。 其他问题根据帖子提问质量选择性回复,无法保证全覆盖。回复时效
一般回复时间不超过24小时,产品&店铺相关问题如超时未回复,可将帖子链接发送至淘宝客服催促。提问要求
请详细说明:系统版本、操作步骤,并提供文字版终端日志或代码(便于排查问题)。 非必要情况下,请尽量避免使用截图描述问题。关于新书相关问题
由于盗版和PDF流传泛滥,产出远小于投入,对新书相关问题不再保证有问必答,仅选择性回答高质量提问。开源工具问题
如一键安装工具等开源项目,建议优先到GitHub的ISSUE专区提问,其次选择社区发帖。本规则将试行一段时间,并根据实际情况进行调整。感谢大家的理解与支持!
—— 小鱼
没有可用的软件包 ros-jazzy-gazebo-ros-pkgs,但是它被其它的软件包引用了。
标记的地方RX和TX是485接口吗?
微信图片_20241223155614-2.jpg
四驱四转小车,gazebo启动成功:
967f34fb-e944-441c-9edf-b2989bdfeb9e-image.png
但是在运行以下代码时出错:
出错截图:
cd84b31d-561c-46be-acbc-c2908f4628f5-image.png
gazebo进程报错:
e05e4517-d1a6-4a14-b72d-789935d80f15-image.png
YAML文件截图:
029e0849-dab8-443c-8bc7-2fc78e69ba66-image.png
URDF文件:
鱼哥,催更啊!手里的fishbot手痒想跑起来啊!!大佬快快更新
d0eee703-8fbf-42f2-ba2d-7cfaba700247-image.png 3f27d9e8-bb71-49a9-85da-9262fff0c68e-image.png
哪个口是485,哪个是CAN口 ,哪个是IO输入,哪个是IO输出
版块
-
1.1k
主题4.1k
帖子 -
292
主题2.0k
帖子 -
0
主题0
帖子 -
845
主题3.4k
帖子 -
882
主题3.2k
帖子 -
1
主题3
帖子 -
335
主题1.5k
帖子