ROS2机器人案例学习linorobot2机器人模型

举报
zhangrelay 发表于 2022/05/08 01:02:13 2022/05/08
【摘要】 ROS2之G/F版本支持较多的机器人为turtlebot3和即将发布的turtlebot4: turtlebot4+树莓派4+ros2专属机器人 2022 ros@ros:~$ sudo apt install ros-noetic- Display all 2587 possibilities? (y or n) ros@ros:...

ROS2之G/F版本支持较多的机器人为turtlebot3和即将发布的turtlebot4:

turtlebot4+树莓派4+ros2专属机器人 2022

ros@ros:~$ sudo apt install ros-noetic-
Display all 2587 possibilities? (y or n)
ros@ros:~$ sudo apt install ros-galactic-
Display all 1323 possibilities? (y or n)
ros@ros:~$ sudo apt install ros-foxy-
Display all 1517 possibilities? (y or n) 


如果学习导航包,并且想自己从零起步搞定一款机器人,可以参考:

linorobot2,如下引用

 


编译完成即可学习机器人模型/SLAM/导航等。

export LINOROBOT2_BASE=2wd

ros2 launch linorobot2_description description.launch.py

ros2 launch linorobot2_viz robot_model.launch.py


export LINOROBOT2_BASE=mecanum

ros2 launch linorobot2_description description.launch.py

ros2 launch linorobot2_viz robot_model.launch.py


Gazebo:

ros2 launch linorobot2_gazebo gazebo.launch.py 

 


这部分没什么代码就是一个启动配置。引用自源码:


  
  1. # Copyright (c) 2021 Juan Miguel Jimeno
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http:#www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import os
  15. from launch import LaunchDescription
  16. from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription
  17. from launch.substitutions import LaunchConfiguration, Command, PathJoinSubstitution
  18. from launch.launch_description_sources import PythonLaunchDescriptionSource
  19. from launch_ros.actions import Node
  20. from launch_ros.substitutions import FindPackageShare
  21. def generate_launch_description():
  22. use_sim_time = True
  23. joy_launch_path = PathJoinSubstitution(
  24. [FindPackageShare('linorobot2_bringup'), 'launch', 'joy_teleop.launch.py']
  25. )
  26. ekf_config_path = PathJoinSubstitution(
  27. [FindPackageShare("linorobot2_base"), "config", "ekf.yaml"]
  28. )
  29. world_path = PathJoinSubstitution(
  30. [FindPackageShare("linorobot2_gazebo"), "worlds", "playground.world"]
  31. )
  32. description_launch_path = PathJoinSubstitution(
  33. [FindPackageShare('linorobot2_description'), 'launch', 'description.launch.py']
  34. )
  35. return LaunchDescription([
  36. ExecuteProcess(
  37. cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so', '-s', 'libgazebo_ros_init.so', world_path],
  38. output='screen'
  39. ),
  40. Node(
  41. package='gazebo_ros',
  42. executable='spawn_entity.py',
  43. name='urdf_spawner',
  44. output='screen',
  45. arguments=["-topic", "robot_description", "-entity", "linorobot2"]
  46. ),
  47. Node(
  48. package='linorobot2_gazebo',
  49. executable='command_timeout.py',
  50. name='command_timeout'
  51. ),
  52. Node(
  53. package='robot_localization',
  54. executable='ekf_node',
  55. name='ekf_filter_node',
  56. output='screen',
  57. parameters=[
  58. {'use_sim_time': use_sim_time},
  59. ekf_config_path
  60. ],
  61. remappings=[("odometry/filtered", "odom")]
  62. ),
  63. IncludeLaunchDescription(
  64. PythonLaunchDescriptionSource(description_launch_path),
  65. launch_arguments={
  66. 'use_sim_time': str(use_sim_time),
  67. 'publish_joints': 'false',
  68. }.items()
  69. ),
  70. IncludeLaunchDescription(
  71. PythonLaunchDescriptionSource(joy_launch_path),
  72. )
  73. ])
  74. #sources:
  75. #https://navigation.ros.org/setup_guides/index.html#
  76. #https://answers.ros.org/question/374976/ros2-launch-gazebolaunchpy-from-my-own-launch-file/
  77. #https://github.com/ros2/rclcpp/issues/940

 


 

 

文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。

原文链接:zhangrelay.blog.csdn.net/article/details/124620482

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。