ubuntu20.04一键安装没有ros2的humble版本,
求ros2-humble版本安装教程 或者 一件安装可以增加humble版本吗-
-
-
-
我安装鱼香ros的博文尝试了运行以下命令来安装tf2_tools
sudo apt install ros-eloquent-tf2-tools报错显示找不到包
我想问下是哪个包运行什么命令可以查看tf2_tree呢? -
鱼哥,安装了ros+docker后 环境里很多package都没有,比如gedit、vim等,而且用apt-get install也下载不了;另外在系统中安装了ompl后,进入ros环境中编译功能包找不到ompl所在位置,不知道该怎么弄了
root@97c1f2f03f64:/home/lws/lws0531/src/path_planner# apt-get install gedit
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package geditCMake Error at path_planner/CMakeLists.txt:63 (find_package):
By not providing "Findompl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ompl", but
CMake did not find one.Could not find a package configuration file provided by "ompl" with any of
omplConfig.cmake ompl-config.cmake
the following names:Add the installation prefix of "ompl" to CMAKE_PREFIX_PATH or set
"ompl_DIR" to a directory containing one of the above files. If "ompl"
provides a separate development package or SDK, be sure it has been
installed.-- Configuring incomplete, errors occurred!
See also "/home/lws/lws0531/build/CMakeFiles/CMakeOutput.log".
See also "/home/lws/lws0531/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed -
aurora_borealis@DESKTOP-4KV591G:~$ roscore
... logging to /home/aurora_borealis/.ros/log/a2268cbe-ff9d-11ed-aa85-00155db53ee7/roslaunch-DESKTOP-4KV591G-12683.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://DESKTOP-4KV591G:43315/
SUMMARY
ros_comm version 1.14.13PARAMETERS
/rosdistro: melodic /rosversion: 1.14.13NODES
auto-starting new master
process[master]: started with pid [12697]
ROS_MASTER_URI=http://DESKTOP-4KV591G:11311/setting /run_id to a2268cbe-ff9d-11ed-aa85-00155db53ee7
process[rosout-1]: started with pid [12708]
started core service [/rosout]aurora_borealis@DESKTOP-4KV591G:~$ roscore
... logging to /home/aurora_borealis/.ros/log/a2268cbe-ff9d-11ed-aa85-00155db53ee7/roslaunch-DESKTOP-4KV591G-12814.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://DESKTOP-4KV591G:35349/
SUMMARY
ros_comm version 1.14.13PARAMETERS
/rosdistro: melodic /rosversion: 1.14.13NODES
RLException: roscore cannot run as another roscore/master is already running.
Please kill other roscore/master processes before relaunching.
The ROS_MASTER_URI is http://DESKTOP-4KV591G:11311/
The traceback for the exception was written to the log file
aurora_borealis@DESKTOP-4KV591G:~$ rosrun turtlesim turtlesim_node
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-aurora_borealis'
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.
aurora_borealis@DESKTOP-4KV591G:~$c7597943-03df-4069-aaba-27cf4a7117a7-image.png
-
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-yaml is already the newest version (3.12-1build2).
python3-distro is already the newest version (1.0.1-2).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
code : Depends: libsecret-1-0 (>= 0.18) but it is not going to be installed
Depends: libxkbfile1 but it is not going to be installed
Depends: xdg-utils (>= 1.0.2) but it is not going to be installed
Recommends: libvulkan1 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
--2023-05-31 17:39:13-- http://fishros.com/install/install1s/tools/base.py
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... 200 OK
Length: 42293 (41K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/base.py’/tmp/fishinstall/tools/base 100%[===========================================>] 41.30K --.-KB/s in 0.08s
2023-05-31 17:39:13 (537 KB/s) - ‘/tmp/fishinstall/tools/base.py’ saved [42293/42293]
Run CMD Task:[dpkg --print-architecture]
基础检查通过... ======欢迎使用一键安装工具,人生苦短,三省吾身,省时省力省心!=======
[-]Result:success
======一键安装已开源,请放心使用:https://github.com/fishros/install======= .-~~~~~~~~~-._ _.-~~~~~~~~~-. __.' ~. .~ `.__ .'// 开卷有益 \./ 书山有路 \ `. .'// 可以多看看小鱼的文章 | 关注公众号鱼香ROS \ `. .'// .-~"~~~~-._ | _,-~~~~"~-. \`. .'//.-" `-. | .-' "-.\`. .'//______.============-.. \ | / ..-============.______\`. .'______________________________\|/______________________________` ----------------------------------------------------------------------RUN Choose Task:[请输入括号内的数字]
---众多工具,等君来用---
[1]:一键安装:ROS(支持ROS和ROS2,树莓派Jetson)
[2]:一键安装:github桌面版(小鱼常用的github客户端)
[3]:一键配置:rosdep(小鱼的rosdepc,又快又好用)
[4]:一键配置:ROS环境(快速更新ROS环境设置,自动生成环境选择)
[5]:一键配置:系统源(更换系统源,支持全版本Ubuntu系统)
[6]:一键安装:nodejs
[7]:一键安装:VsCode开发工具
[8]:一键安装:Docker
[9]:一键安装:Cartographer(内测版v0.1)
[10]:一键安装:微信(可以在Linux上使用的微信)
[11]:一键安装:ROS+Docker(支持所有版本ROS/ROS2)
[12]:一键安装:PlateformIO MicroROS开发环境(支持Fishbot)
[77]:测试模式:运行自定义工具测试
[0]:quit
请输入[]内的数字以选择:11
--2023-05-31 17:39:19-- http://fishros.com/install/install1s/tools/tool_install_ros_with_docker.py
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... 200 OK
Length: 11540 (11K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/tool_install_ros_with_docker.py’/tmp/fishinstall/tools/tool 100%[===========================================>] 11.27K --.-KB/s in 0.006s
2023-05-31 17:39:20 (1.97 MB/s) - ‘/tmp/fishinstall/tools/tool_install_ros_with_docker.py’ saved [11540/11540]
--2023-05-31 17:39:20-- http://fishros.com/install/install1s/tools/tool_install_vscode.py
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... 200 OK
Length: 1366 (1.3K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/tool_install_vscode.py’/tmp/fishinstall/tools/tool 100%[===========================================>] 1.33K --.-KB/s in 0s
2023-05-31 17:39:20 (316 MB/s) - ‘/tmp/fishinstall/tools/tool_install_vscode.py’ saved [1366/1366]
--2023-05-31 17:39:20-- http://fishros.com/install/install1s/tools/tool_install_docker.py
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... 200 OK
Length: 2882 (2.8K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/tool_install_docker.py’/tmp/fishinstall/tools/tool 100%[===========================================>] 2.81K --.-KB/s in 0.002s
2023-05-31 17:39:20 (1.30 MB/s) - ‘/tmp/fishinstall/tools/tool_install_docker.py’ saved [2882/2882]
欢迎使用一键安装ROS-Docker版,支持所有版本ROS,本工具由作者小鱼提供
================================1.版本选择======================================
RUN Choose Task:[请输入括号内的数字]
请选择你要安装的ROS版本名称(请注意ROS1和ROS2区别):
[1]:noetic
[2]:humble
[3]:foxy
[4]:galactic
[5]:melodic
[6]:rolling
[7]:kinetic
[8]:eloquent
[9]:dashing
[10]:crystal
[11]:bouncy
[12]:ardent
[13]:lunar
[14]:indigo
[0]:quit
请输入[]内的数字以选择:5
你选择了melodic(ROS1),该版本目前状态:长期支持
================================2.安装Docker======================================
Run CMD Task:[docker version]
[-]Result:success a0e4e17bddfbd388f38=================3.下载镜像(该步骤因网络原因会慢一些,若失败请重试)==================
Run CMD Task:[sudo docker pull fishros2/ros:melodic-desktop-full ]
melodic-desktop-full: Pulling from fishros2/ros
Digest: sha256:3d95b89365e60cf96696288f32816e2324fd8c891d379f0e8fae62b08a22e763
Status: Image is up to date for fishros2/ros:melodic-desktop-full
docker.io/fishros2/ros:melodic-desktop-full
Run CMD Task:[sudo docker pull fishros2/ros:melodic-desktop-full ]
melodic-desktop-full: Pulling from fishros2/ros
Digest: sha256:3d95b89365e60cf96696288f32816e2324fd8c891d379f0e8fae62b08a22e763
Status: Image is up to date for fishros2/ros:melodic-desktop-full
docker.io/fishros2/ros:melodic-desktop-full
Run CMD Task:[sudo docker pull fishros2/ros:melodic-desktop-full ]
melodic-desktop-full: Pulling from fishros2/ros
Digest: sha256:3d95b89365e60cf96696288f32816e2324fd8c891d379f0e8fae62b08a22e763
Status: Image is up to date for fishros2/ros:melodic-desktop-full
docker.io/fishros2/ros:melodic-desktop-full
================================4.生成容器======================================
请为你的melodic容器取个名字吧!melodic1
收到名字melodic1
Run CMD Task:[users]
[-]Result:success请手动输入你的用户名>>aurora_borealis
Run CMD Task:[sudo docker run -dit --name=melodic1 -v /home/aurora_borealis:/home/aurora_borealis -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/dri:/dev/dri --device /dev/snd -e DISPLAY=unix$DISPLAY -w /home/aurora_borealis fishros2/ros:melodic-desktop-full]
docker: Error response from daemon: Conflict. The container name "/melodic1" is already in use by container "85d2d1bf520e063bfa1e6ec0175d4894ce2fe0cafb3b2f25b4764bf6ae791f08". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
Run CMD Task:[docker exec -it melodic1 /bin/bash -c "echo -e '
source /opt/ros/melodic/setup.bash' >> ~/.bashrc" ]
Error response from daemon: Container 85d2d1bf520e063bfa1e6ec0175d4894ce2fe0cafb3b2f25b4764bf6ae791f08 is not running
Run CMD Task:[xhost +local:]
sh: 1: xhost: not found
================================5.生成命令======================================
Run CMD Task:[users]
[-]Result:success请手动输入你的用户名>>aurora_borealis
Run CMD Task:[sudo chmod 777 /home/aurora_borealis/.fishros/bin/melodic1]
================================6.生成使用工具======================================
RUN Choose Task:[请输入括号内的数字]
为方便后续使用容器,请选择使用方式,若不知道怎么选,推荐套餐1,若不需要则可以选退出:
[1]:套餐1:VsCode+插件(本地使用推荐)
[2]:套餐2:SSH-Service(远程使用推荐)
[0]:quit
请输入[]内的数字以选择:1
套餐1包含Vscode及其容器插件,开始安装。。
欢迎使用一键安装Vscode,本工具由作者小鱼提供
开始根据系统架构,为你下载对应版本的vscode~
Run CMD Task:[sudo wget http://vscode.cdn.azure.cn/stable/6261075646f055b99068d3688932416f2346dd3b/code_1.73.1-1667967334_amd64.deb -O /tmp/vscode.deb]
--2023-05-31 17:42:54-- http://vscode.cdn.azure.cn/stable/6261075646f055b99068d3688932416f2346dd3b/code_1.73.1-1667967334_amd64.deb
Resolving vscode.cdn.azure.cn (vscode.cdn.azure.cn)... 222.199.191.35
Connecting to vscode.cdn.azure.cn (vscode.cdn.azure.cn)|222.199.191.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 96706580 (92M) [application/octet-stream]
Saving to: ‘/tmp/vscode.deb’/tmp/vscode.deb 100%[=================================================>] 92.23M 9.78MB/s in 9.9s
2023-05-31 17:43:05 (9.34 MB/s) - ‘/tmp/vscode.deb’ saved [96706580/96706580]
下载完成,接下来为你安装Vscode~
Run CMD Task:[sudo dpkg -i /tmp/vscode.deb]
[-]Result:code:1 (1.9-2) .....7334) ...stalled.)Run CMD Task:[rm -rf /tmp/vscode.deb]
[-]Result:success安装完成~
Run CMD Task:[code --install-extension ms-vscode-remote.remote-containers --user-data-dir]
sh: 1: code: not found
===========================后续使用指令=================================
后续可在任意终端输入melodic1来启动/停止/测试/删除容器
==============================文件存储位置===============================
你的主目录已经和容器的对应目录做了映射
==============================问题反馈&&更新讨论=============================
请访问社区的一键安装版块:https://fishros.org.cn/forum/topic/112
欢迎加入机器人学习交流QQ群:438144612(入群口令:一键安装)
鱼香小铺正式开业,最低499可入手一台能建图会导航的移动机器人,淘宝搜店:鱼香ROS 或打开链接查看:https://item.taobao.com/item.htm?id=696573635888
如在使用过程中遇到问题,请打开:https://fishros.org.cn/forum 进行反馈
aurora_borealis@DESKTOP-4KV591G:~$ melodic1
/home/aurora_borealis/.fishros/bin/melodic1: line 1: xhost: command not found
请输入指令控制melodic1: 重启(r) 进入(e) 启动(s) 关闭(c) 删除(d) 测试(t):
t
Error response from daemon: Container 85d2d1bf520e063bfa1e6ec0175d4894ce2fe0cafb3b2f25b4764bf6ae791f08 is not running
查看过melodic1这个容器,他没有ports
093683b8-c77f-41d0-b94f-678dd927a049-image.png请问一下怎么解决,谢谢!
我是在unbuntu18.04的终端运行的:
f168e218-03e5-4fe9-b197-5a28d627ad86-image.png -
-
-
-
大家有没有在ubuntu22上安装autoware.universe后,只有部分例程可以跑通的情况?我编译通过后,只有ad-hoc-simulation里面的planning-simulation能跑通,rosbag-replay-simulation在启动时报的第一个错误是关于lidar_centerPoint的,然后程序就终止运行了。重新编译也不行。
-
大家好,我在网上找了一个ros2的学习例程,https://blog.csdn.net/aibingjin/article/details/124005325?ydreferer=aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2FpYmluZ2ppbi9jYXRlZ29yeV8xMTcyNTExOS5odG1s
上述例程是有一个msg控制小车前后左右运动,一个service控制背景切换(与想问的问题无关),一个action控制小车左转右转直行等。作者在最下面的main中定义了一个 executor = MultiThreadedExecutor(),实现这几个接口的同时运行。(个人理解,不知道对不对。)但是作者用的ros2是foxy版本,所以他使用下面的代码可以正常运行。但是我用humble却跑不起来,下面的代码可以正常接收到msg命令,也可以接收到action命令,但是小车不动。我理解应该是多线程的问题。因为我把多线程去掉,小车可以正常执行msg收到的命令。
请问有没有大神可以帮忙看一下是怎么回事?duckiebot_node.py
#!/usr/bin/env python3 import rclpy from rclpy.node import Node import gym from pyglet.window import key from gym_duckietown.envs import DuckietownEnv import cv2 import numpy as np import time #动作是一段时间内完成的,引入time库使用时间相关函数 from sensor_msgs.msg import Image #发布图像使用Image消息类型 from duckietown_interface.msg import Twist2DStamped #控制消息类型 from duckietown_interface.srv import ChangeMap from cv_bridge import CvBridge #opencv和ros图像数据转换工具 #引入ActionServer库 from rclpy.action import ActionServer #引入新建的动作接口 from duckietown_interface.action import Crossing #引入多线程执行器,将节点支持多线程,否则执行动作时会阻塞主线程 from rclpy.executors import MultiThreadedExecutor class DuckiebotNode(Node): def __init__(self, name): super().__init__(name) self.env = DuckietownEnv(seed=1,map_name="udem1",draw_curve=False,draw_bbox=False,domain_rand=False,frame_skip=1,distortion=False,camera_rand=False,dynamics_rand=False) self.env.reset() #定义图像发布接口 self.pub_img = self.create_publisher(Image,"duckiebot_node/image",10) #修改定时器频率,仿真器默认是30Hz,保持一致,方便计算 self.timer = self.create_timer(1/30, self.timer_callback) #创建图像转换工具 self.bridge = CvBridge() #定义全局动作变量,默认线速度和角速度都是0,车辆停止 self.action = np.array([0.0,0.0]) #订阅控制指令话题 self.sub_action = self.create_subscription(Twist2DStamped, "control_node/action", self.cb_action, 10) self.cm_srv = self.create_service(ChangeMap, 'change_map_name', self.cb_change_map) #定义变量,用来标识动作是否在执行,执行过程中禁用其他车辆控制指令 self.do_action = False #创建动作服务 self.crossing_server = ActionServer(self,Crossing,'crossing_acton',self.execute_callback) def timer_callback(self): #这里不再生成随机动作指令,直接使用全局动作变量 obs, reward, done, info = self.env.step(self.action) #发布图像数据,obs是rgb编码,转化时指定编码,解码时就有据可查 self.pub_img.publish(self.bridge.cv2_to_imgmsg(obs, 'rgb8')) if done: self.env.reset() #修改键盘控制车辆指令回调函数,执行动作期间,禁用车辆控制指令 def cb_action(self, msg): if self.do_action: return v = msg.twist2d.v #线速度 omega = msg.twist2d.omega #角速度 self.action[0] = v self.action[1] = omega def cb_change_map(self, request, response): map_name = request.map_name try: self.env.close() self.env = DuckietownEnv(seed=1,map_name=map_name,draw_curve=False,draw_bbox=False,domain_rand=False,frame_skip=1,distortion=False,camera_rand=False,dynamics_rand=False) self.env.reset() response.result = True except Exception: response.result = False return response #动作服务回调函数,所有动作指令在这里实现 def execute_callback(self, goal_handle): #开始执行动作,利用do_action变量禁用键盘控制指令 self.do_action = True #从动作请求中获取速度speed和方向direction参数 speed = goal_handle.request.speed direction = goal_handle.request.direction #计算计算实际执行过程中的相关参数:实际线速度、角速度、执行时间、前置执行时间 real_speed, omega, need_time, prev_time = self.get_action_args(speed, direction) #创建反馈主题数据 feedback_msg = Crossing.Feedback() #反馈主题反馈动作完成度百分比的倒计数 feedback_msg.countdown = 100.0 #记录当前时间 current_t = time.time() #记录开始时间 start_t = current_t #执行时间结束前,循环执行 while current_t-start_t<need_time: #在前置时间内,需要直行走过0.07米 if current_t-start_t<prev_time: self.action = np.array([real_speed,0.0]) else: #剩余的时间内,按计算出的线速度和角速度行驶 self.action = np.array([real_speed, omega]) #计算剩余时间占总执行时间的百分比 feedback_msg.countdown = (1-(current_t-start_t)/need_time)*100 #通过反馈主题发送给客户端 goal_handle.publish_feedback(feedback_msg) #线程休眠0.1秒,继续循环 time.sleep(0.1) #更新当前时间 current_t = time.time() #动作执行完成后,设置目标完成标识 goal_handle.succeed() #在结果服务中,设置结果响应数据 result = Crossing.Result() result.result = True #清除动作执行期间的数据 self.action = np.array([0.0,0.0]) #启用键盘控制指令 self.do_action = False return result #根据指定的动作参数(速度:speed,方向:direction)计算实际执行过程中的相关参数 def get_action_args(self, speed, direction): #计算真实需要输入的线速度(目前只是根据实际现象得知:实际速度=给定速度*0.7,为什么是0.7需要仔细读一下仿真源码) real_speed = speed/0.7 #预设看到红线时开始执行动作, #小车摄像头前倾20°左右,根据小车高度和摄像头视角等参数, #计算得到红线在摄像头观察图像下边缘时,车辆距离红线约等于7cm #这段距离需要车辆先直行一段时间,这段时间下文定义为前置时间(prev_time) dist = 0.07 #动作期间要转过得角度 angular = 0 if direction=='left': #左转弧线距离0.66米,转角90° dist += 0.66 angular = np.pi/2 elif direction=='right': #右转弧线距离0.26米,转角-90° dist += 0.26 angular = -np.pi/2 else: #直行距离0.585米,转角为0 dist += 0.585 need_time = dist/speed #根据距离计算动作执行时间 prev_time = 0.07/speed #计算前置时间,直行通过0.07米的时间 #计算转弯时角速度,4/9的关系是根据实践大致计算出来的,具体原理需要研读仿真器源码 omega = angular/(need_time-prev_time)/4*9 return real_speed, omega, need_time, prev_time def main(args=None): rclpy.init(args=args) node = DuckiebotNode(name="duckiebot_node") executor = MultiThreadedExecutor() rclpy.spin(node=node,executor=executor) rclpy.shutdown() -
-
入手了fishbot,安装、建图、移动都没有问题,但是只要开始移动或是转动轮子都会使电机开始发出zzz的声音,而且停止移动后声音也不会停止。
已经各种方式尝试搜索该问题原因但是没找到,有大佬遇到过这个问题吗
-
-
Run CMD Task:[ls /opt/ros/melodic/setup.bash]
[-]Result:code:2 -
gazebo.launch.py
import osfrom ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSourcefrom launch_ros.actions import Node
def generate_launch_description():
# Include the robot_state_publisher launch file, provided by our own package. Force sim time to be enabled # !!! MAKE SURE YOU SET THE PACKAGE NAME CORRECTLY !!! package_name='xinsong_description' #<--- CHANGE ME world_file_path = 'worlds/neighborhood.world' pkg_path = os.path.join(get_package_share_directory(package_name)) world_path = os.path.join(pkg_path, world_file_path) # Pose where we want to spawn the robot spawn_x_val = '0.0' spawn_y_val = '0.0' spawn_z_val = '0.0' spawn_yaw_val = '0.0' mbot = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( get_package_share_directory(package_name),'launch','mbot.launch.py' )]), launch_arguments={'use_sim_time': 'true', 'world':world_path}.items() ) # Include the Gazebo launch file, provided by the gazebo_ros package gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]), ) # Run the spawner node from the gazebo_ros package. The entity name doesn't really matter if you only have a single robot. spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', arguments=['-topic', 'robot_description', '-entity', 'mbot', '-x', spawn_x_val, '-y', spawn_y_val, '-z', spawn_z_val, '-Y', spawn_yaw_val], output='screen') # Launch them all! return LaunchDescription([ mbot, gazebo, spawn_entity, ])mbot.launch.py
mport osfrom ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Nodeimport xacro
def generate_launch_description():
# Check if we're told to use sim time use_sim_time = LaunchConfiguration('use_sim_time') # Process the URDF file pkg_path = os.path.join(get_package_share_directory('xinsong_description')) xacro_file = os.path.join(pkg_path,'urdf','robot_gazebo.xacro') robot_description_config = xacro.process_file(xacro_file) # Create a robot_state_publisher node params = {'robot_description': robot_description_config.toxml(), 'use_sim_time': use_sim_time} node_robot_state_publisher = Node( package='robot_state_publisher', executable='robot_state_publisher', output='screen', parameters=[params] ) # Launch! return LaunchDescription([ DeclareLaunchArgument( 'use_sim_time', default_value='false', description='Use sim time if true'), node_robot_state_publisher ])robot_gazebo.xacro
<xacro:include filename="$(find xinsong_description)/urdf/robot_urdf.xacro" /> <xacro:robot_urdf/>
<?xml version="1.0"?>
<robot name="xinsong" xmlns:xacro="http://www.ros.org/wiki/xacro"></robot>
robot_urdf.xacro
<?xml version="1.0"?>
<robot name="xinsong" xmlns:xacro="http://www.ros.org/wiki/xacro"><link name="world"/>
<joint name="world_joint" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0" />
<parent link="world" />
<child link="base_link" />
</joint>
<link name="base_link">
<inertial>
<origin xyz="-0.024765 6.348E-06 0.099216" rpy="0 0 0" />
<mass value="76.774" />
<inertia ixx="0.50168" ixy="0.00037392" ixz="0.0021764" iyy="0.72802" iyz="-0.00016973" izz="0.71847" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/base_link.STL" />
</geometry>
<material name="White">
<color rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/base_link.STL" />
</geometry>
</collision>
</link>
<gazebo reference="base_link">
<material>Gazebo/White</material>
</gazebo>
<link name="link1">
<inertial>
<origin xyz="0.0098083 -0.0051235 0.089518" rpy="0 0 0" />
<mass value="38.103" />
<inertia ixx="0.44523" ixy="0.0044732" ixz="-0.033323" iyy="0.27924" iyz="0.018167" izz="0.36388" />
</inertial>
<visual>
<origin xyz="0 0 0"rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link1.STL" />
</geometry>
<material name="Orange">
<color rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link1.STL" />
</geometry>
</collision>
</link>
<gazebo reference="link1">
<material>Gazebo/Orange</material>
</gazebo>
<joint name="joint1" type="revolute">
<origin xyz="0 0 0.2025" rpy="0 0 0" />
<parent link="base_link" />
<child link="link1" />
<axis xyz="0 0 1" />
<limit lower="-2.97" upper="2.97" effort="0" velocity="0" />
</joint>
<link name="link2">
<inertial>
<origin xyz="0.18304 0.014347 -0.00097308" rpy="0 0 0" />
<mass value="72.229" />
<inertia ixx="0.20052" ixy="-0.032557" ixz="0.10728" iyy="1.1155" iyz="0.00038791" izz="1.1183" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link2.STL" />
</geometry>
<material name="White">
<color rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link2.STL" />
</geometry>
</collision>
</link>
<gazebo reference="link2">
<material>Gazebo/White</material>
</gazebo><joint name="joint2" type="revolute">
<origin xyz="0.03 0 0.1695" rpy="1.5708 -1.5708 0" />
<parent link="link1" />
<child link="link2" />
<axis xyz="0 0 1" />
<limit lower="-2.27" upper="1.68" effort="0" velocity="0" />
</joint>
<link name="link3">
<inertial>
<origin xyz="0.012834 -0.0021231 -0.00048685" rpy="0 0 0" />
<mass value="24.435" />
<inertia ixx="0.09474" ixy="0.0090989" ixz="-0.00012532" iyy="0.075827" iyz="-0.00013379" izz="0.10528" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link3.STL" />
</geometry>
<material name="Orange">
<color rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link3.STL" />
</geometry>
</collision>
</link>
<gazebo reference="link3">
<material>Gazebo/Orange</material>
</gazebo>
<joint name="joint3" type="revolute">
<origin xyz="0.44 0 0" rpy="0 0 0" />
<parent link="link2" />
<child link="link3" />
<axis xyz="0 0 -1" />
<limit lower="-3.40" upper="1.13" effort="0" velocity="0" />
</joint>
<link name="link4">
<inertial>
<origin xyz="-2.153E-05 -0.00021067 0.14816" rpy="0 0 0" />
<mass value="27.562" />
<inertia ixx="0.26232" ixy="-4.732E-05" ixz="6.7555E-05" iyy="0.25363" iyz="0.00095559" izz="0.05683" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link4.STL" />
</geometry>
<material name="White">
<color rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link4.STL" />
</geometry>
</collision>
</link>
<gazebo reference="link4">
<material>Gazebo/White</material>
</gazebo>
<joint name="joint4" type="revolute">
<origin xyz="0.034993 -0.1085 0" rpy="1.5708 0 0" />
<parent link="link3" />
<child link="link4" />
<axis xyz="0 0 -1" />
<limit lower="-2.97" upper="2.97" effort="24" velocity="0" />
</joint>
<link name="link5">
<inertial>
<origin xyz="-4.9222E-05 -0.015999 0.00029144" rpy="0 0 0" />
<mass value="3.5237" />
<inertia ixx="0.0031941" ixy="6.9593E-06" ixz="-3.7588E-06" iyy="0.0027594" iyz="5.1079E-05" izz="0.003521" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link5.STL" />
</geometry>
<material name="Orange">
<color rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link5.STL" />
</geometry>
</collision>
</link>
<gazebo reference="link5">
<material>Gazebo/Orange</material>
</gazebo>
<joint name="joint5" type="revolute">
<origin xyz="0 0 0.3265" rpy="-1.5708 0 0" />
<parent link="link4" />
<child link="link5" />
<axis xyz="0 0 -1" />
<limit lower="-2.09" upper="2.09" effort="15.2" velocity="0" />
</joint>
<link name="link6">
<inertial>
<origin xyz="2.5944E-05 1.4097E-07 0.006039" rpy="0 0 0" />
<mass value="0.18969" />
<inertia ixx="4.6886E-05" ixy="6.8108E-10" ixz="-9.5285E-08" iyy="4.6314E-05" iyz="1.2973E-10" izz="8.835E-05" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link6.STL" />
</geometry>
<material name="Orange">
<color rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://xinsong_description/meshes/visual/link6.STL" />
</geometry>
</collision>
</link>
<gazebo reference="link6">
<material>Gazebo/Orange</material>
</gazebo>
<joint name="joint6" type="revolute">
<origin xyz="0 -0.0684 0" rpy="1.5708 0 0" />
<parent link="link5" />
<child link="link6" />
<axis xyz="0 0 -1" />
<limit lower="-6.28" upper="6.28" effort="9.7" velocity="0" />
</joint><!-- Transmission is important to link the joints and the controller -->
<xacro:macro name="transmission_block" params="tran_name joint_name motor_name">
<transmission name="${tran_name}">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${joint_name}">
<hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
</joint>
<actuator name="$motor_name">
<hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
</xacro:macro>
<xacro:transmission_block tran_name="tran1" joint_name="joint1" motor_name="motor1"/>
<xacro:transmission_block tran_name="tran2" joint_name="joint2" motor_name="motor2"/>
<xacro:transmission_block tran_name="tran3" joint_name="joint3" motor_name="motor3"/>
<xacro:transmission_block tran_name="tran4" joint_name="joint4" motor_name="motor4"/>
<xacro:transmission_block tran_name="tran5" joint_name="joint5" motor_name="motor5"/>
<xacro:transmission_block tran_name="tran6" joint_name="joint6" motor_name="motor6"/><gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<update_rate>30</update_rate>
<odometry_source>1</odometry_source>
</plugin>
</gazebo>
</robot>
运行后显示
linux@linux-desktop:~/ros2_demo$ source install/setup.sh
linux@linux-desktop:~/ros2_demo$ ros2 launch xinsong_description gazebo.launch.py
[INFO] [launch]: All log files can be found below /home/linux/.ros/log/2023-05-27-21-33-18-647373-linux-desktop-25791
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): not well-formed (invalid token): line 42, column 25
linux@linux-desktop:~/ros2_demo$
想问问是哪里出现问题了 -
大家好,我在ubuntu22.04上安装了humble和源码安装了autoware.universe,colcon build通过了。然后我运行官方的两个例子,Planning simulation基本上正常,但是Rosbag replay simulation这个例子过不去。提示的第一个错误是
[ERROR] [launch]: Caught exception in launch (see debug for traceback): package 'lidar_centerpoint' found at '/home/ye/autoware/install/lidar_centerpoint', but libexec directory '/home/ye/autoware/install/lidar_centerpoint/lib/lidar_centerpoint' does not exist。大家有知道是怎么回事的么?
重要提示
社区建设靠大家,欢迎参与社区建设赞助计划
提问前必看的发帖注意事项—— 提问的智慧
社区使用指南—如何添加标签修改密码