Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

yunke120/ros2-foxy-study

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS2 Foxy Study

来源:赵虚左老师的ROS2理论与实践

实践平台

  • Jetson Xavier Nx
  • JetPack 5.0.2 (Ubuntu 20.04) 参考
  • Ros2 (foxy)

说明

  1. ws01_plumbing : 通信机制与实践
  2. ws02_tools : ROS2常用工具使用

VSCode 代码片段

python代码片段

{
	"ros2 node python": {
		"prefix": "ros2_node_python",
		"body": [
		"import rclpy",
		"from rclpy.node import Node",
		"",
		"",
		"class MyNode(Node):",
		"    def __init__(self):",
		"        super().__init__(\"MyNode_py\")",
		"",
		"",
		"def main():",
		"    rclpy.init()",
		"    rclpy.spin(MyNode())",
		"    rclpy.shutdown()",
		"",
		"",
		"if __name__ == '__main__':",
		"    main()",
		],
		"description": "ros2 node"
	},
	"ros2 launch py": {
		"prefix": "ros2_launch_py",
		"body": [
		"from launch import LaunchDescription",
		"from launch_ros.actions import Node",
		"# 封装终端指令相关类",
		"# from launch.actions import ExecuteProcess",
		"# from launch.substitutions import FindExecutable",
		"# 参数声明与获取",
		"# from launch.actions import DeclareLaunchArgument",
		"# from launch.substitutions import LaunchConfiguration",
		"# 文件包含相关",
		"# from launch.actions import IncludeLaunchDescription",
		"# from launch.launch_description_sources import PythonLaunchDescriptionSource",
		"# 分组相关",
		"# from launch_ros.actions import PushRosNamespace",
		"# from launch.actions import GroupAction",
		"# 事件相关",
		"# from launch.event_handlers import OnProcessStart, OnProcessExit",
		"# from launch.actions import ExecuteProcess, RegisterEventHandler, LogInfo",
		"# 获取功能包下share目录路径",
		"# from ament_index_python.packages import get_package_share_directory",
		"",
		"def generate_launch_description():",
		"",
		"    return LaunchDescription([])",
		],
		"description": "ros2 launch py"
	}
}

cpp代码片段

{
	"ros2 node cpp": {
		"prefix": "ros2_node_cpp",
		"body": [
			"#include \"rclcpp/rclcpp.hpp\"",
			"",
			"",
			"class MyNode: public rclcpp::Node{",
			"public:",
			"    MyNode():Node(\"MyNode_cpp\"){",
			"       ",	
			"    }",
			"",
			"};",
			"",
			"",
			"int main(int argc, char ** argv)",
			"{",
			"    rclcpp::init(argc, argv);",
			"    rclcpp::spin(std::make_shared<MyNode>());",
			"    rclcpp::shutdown();",
			"    return 0;",
			"}",
		],
		"description": "ros2 node"
	}
}

URDF

工具

  • check_urdf [urdf文件]: 检查urdf文件语法
  • urdf_to_graphiz [urdf文件]: 生成urdf树形PDF

学习资源

  1. ROS2 Documentation

Releases

No releases published

Packages

No packages published