小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
转战ros2 humble版本机器人底盘开发记录
-
foxy版本是20年ros2版本,官方快不维护了,所以转到humble版本,以前的都要推倒重来了。
顺便把每一步记录一下,方便自己以后查询,也给后来者有个参考。
做好车,开始出发win10 安装utuntu20.04虚拟机大概一个小时,安装方法参考鱼总教程。
一键安装,解决所有烦恼 终端输入命令:
wget http://fishros.com/install -O fishros && . fishros
humble安装成功,用的鱼总的一键安装,大概需要十几分钟。经典话题,你说我听运行成功,说明安装humble一切正常。
一键安装vscode
安装python c++ xml 插件
安装最重要的一个ssh插件Remote SSH,用于远程登陆主机,远程编写程序,vscode这个远程连接服务器比终端ssh远程登陆好用的不是一点点 -
插眼,正在学习中,后续有动手动额打算。先看你踩坑,感谢先人
-
机器人urdf模型目录结构:
jtbot_base.urdf
<?xml version="1.0"?> <robot name="jtbot"> <!-- base link --> <link name="base_link"> <visual> <origin xyz="0 0 0.0" rpy="0 0 0"/> <geometry> <box size="0.46 0.46 0.11"/> </geometry> <material name="blue"> <color rgba="0.1 0.1 1.0 0.8" /> </material> </visual> </link> <!-- laser link --> <link name="laser"> <visual> <origin xyz="0 0 0" rpy="0 3.14159 0"/> <geometry> <cylinder length="0.04" radius="0.04"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.8" /> </material> </visual> </link> <!-- laser joint --> <joint name="laser_joint" type="fixed"> <parent link="base_link" /> <child link="laser" /> <origin xyz="0.16 0 0.115" /> </joint> <link name="imu_link"> <visual> <origin xyz="0 0 0.0" rpy="0 0 0"/> <geometry> <box size="0.02 0.02 0.02"/> </geometry> </visual> </link> <!-- imu joint --> <joint name="imu_joint" type="fixed"> <parent link="base_link" /> <child link="imu_link" /> <origin xyz="0 0 0.02" /> </joint> <link name="right_wheel_link"> <visual> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <cylinder length="0.06" radius="0.077"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </visual> </link> <joint name="right_wheel_joint" type="continuous"> <parent link="base_link" /> <child link="right_wheel_link" /> <origin xyz="0.143 -0.28 -0.055" /> <axis xyz="0 1 0" /> </joint> <link name="left_wheel_link"> <visual> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <cylinder length="0.06" radius="0.077"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </visual> </link> <joint name="left_wheel_joint" type="continuous"> <parent link="base_link" /> <child link="left_wheel_link" /> <origin xyz="0.143 0.28 -0.055" /> <axis xyz="0 1 0" /> </joint> <link name="caster_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <sphere radius="0.074"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </visual> </link> <joint name="caster_joint" type="fixed"> <parent link="base_link" /> <child link="caster_link" /> <origin xyz="-0.15 0.0 -0.107" /> </joint> <!-- Robot Footprint --> <link name="base_footprint"/> <joint name="base_joint" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <origin xyz="0.0 0.0 0.076" rpy="0 0 0"/> </joint> </robot>
display_rviz2.launch.py
import os from launch import LaunchDescription from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare def generate_launch_description(): package_name = 'jtbot_description' urdf_name = "jtbot_base.urdf" ld = LaunchDescription() pkg_share = FindPackageShare(package=package_name).find(package_name) urdf_model_path = os.path.join(pkg_share, f'urdf/{urdf_name}') robot_state_publisher_node = Node( package='robot_state_publisher', executable='robot_state_publisher', arguments=[urdf_model_path] ) joint_state_publisher_node = Node( package='joint_state_publisher_gui', executable='joint_state_publisher_gui', name='joint_state_publisher_gui', arguments=[urdf_model_path] ) rviz2_node = Node( package='rviz2', executable='rviz2', name='rviz2', output='screen', ) ld.add_action(robot_state_publisher_node) ld.add_action(joint_state_publisher_node) ld.add_action(rviz2_node) return ld
from setuptools import setup from glob import glob import os package_name = 'jtbot_description' setup( name=package_name, version='0.0.0', packages=[package_name], data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), (os.path.join('share', package_name, 'launch'), glob('launch/*.launch.py')), (os.path.join('share', package_name, 'urdf'), glob('urdf/**')), ], install_requires=['setuptools'], zip_safe=True, maintainer='root', maintainer_email='330406269@qq.com', description='TODO: Package description', license='TODO: License declaration', tests_require=['pytest'], entry_points={ 'console_scripts': [ ], }, )
编译
colcon build
Starting >>> jtbot_description
--- stderr: jtbot_description
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(Finished <<< jtbot_description [2.00s]
Summary: 1 package finished [2.28s]
1 package had stderr output: jtbot_description显示编译没有通过,但是模型能正常加载出来,这是哪里不对呢?
为什么编译没有通过,但是模型加载正常,懂得给指点一下哪里设置的不对?
-
@毛哥成山轮胎机油保养 这个显示是编译通过了其实,另外一个小bug见这里
@小鱼 在 [常见问题]Colcon编译 Setuptools DeprecationWarning: setup.py install is deprecated. 中说:
该问题是使用Colcon编译Python功能包出现的。
--- stderr: example_parameters_rclpy
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(解决方案如下:
sudo pip install setuptools==58.2.0 --upgrade -
@小鱼 还真是管用,编译通过了