[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F39MD1TG5YMMDQQATASJV7":3,"skill-same:01M6F39MD1TG5YMMDQQATASJV7":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":26,"publishedAt":47,"linkOnly":48,"markdownContent":49,"markdownBody":50,"frontMatter":51,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":57,"ownerHtmlUrl":58,"ownerBlogUrl":6,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M6F39MD1TG5YMMDQQATASJV7","ros1-development",null,"Best practices, design patterns, and common pitfalls for ROS1 (Robot Operating System 1) development. Use this skill when building ROS1 nodes, packages, launch files, or debugging ROS1 systems. Trigger whenever the user mentions ROS1, catkin, rospy, roscpp, roslaunch, roscore, rostopic, tf, actionlib, message types, services, or any ROS1-era robotics middleware. Also trigger for migrating ROS1 code to ROS2, maintaining legacy ROS1 systems, or building ROS1-ROS2 bridges. Covers catkin workspaces, nodelets, dynamic reconfigure, pluginlib, and the full ROS1 ecosystem.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Farpitg1304\u002Frobotics-agent-skills\u002Fros1\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"ros1 development","development","patterns","ecosystem","common pitfalls","types","middleware","ROS2","operating","full","message","design","files","workspaces","design patterns","robotics","common","code","packages","debugging","2026-11-10 10:12:30",false,"---\nname: ros1-development\ndescription: >\n  Best practices, design patterns, and common pitfalls for ROS1 (Robot Operating System 1) development.\n  Use this skill when building ROS1 nodes, packages, launch files, or debugging ROS1 systems. Trigger\n  whenever the user mentions ROS1, catkin, rospy, roscpp, roslaunch, roscore, rostopic, tf, actionlib,\n  message types, services, or any ROS1-era robotics middleware. Also trigger for migrating ROS1 code\n  to ROS2, maintaining legacy ROS1 systems, or building ROS1-ROS2 bridges. Covers catkin workspaces,\n  nodelets, dynamic reconfigure, pluginlib, and the full ROS1 ecosystem.\n---\n\n# ROS1 Development Skill\n\n## When to Use This Skill\n- Building or maintaining ROS1 packages and nodes\n- Writing launch files, message types, or services\n- Debugging ROS1 communication (topics, services, actions)\n- Configuring catkin workspaces and build systems\n- Working with tf\u002Ftf2 transforms, URDF, or robot models\n- Using actionlib for long-running tasks\n- Optimizing nodelets for zero-copy transport\n- Planning ROS1 → ROS2 migration\n\n## Core Architecture Principles\n\n### 1. Node Design\n\n**Single Responsibility Nodes**: Each node should do ONE thing well. Resist the temptation to build monolithic \"do-everything\" nodes.\n\n```python\n# BAD: Monolithic node\nclass RobotNode:\n    def __init__(self):\n        self.sub_camera = rospy.Subscriber('\u002Fcamera\u002Fimage', Image, self.camera_cb)\n        self.sub_lidar = rospy.Subscriber('\u002Flidar\u002Fpoints', PointCloud2, self.lidar_cb)\n        self.pub_cmd = rospy.Publisher('\u002Fcmd_vel', Twist, queue_size=10)\n        self.pub_map = rospy.Publisher('\u002Fmap', OccupancyGrid, queue_size=1)\n        # This node does perception, planning, AND control\n\n# GOOD: Decomposed nodes\nclass PerceptionNode:    # Fuses sensor data → publishes \u002Fobstacles\nclass PlannerNode:       # Subscribes \u002Fobstacles → publishes \u002Fpath\nclass ControllerNode:    # Subscribes \u002Fpath → publishes \u002Fcmd_vel\n```\n\n**Node Initialization Pattern**:\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python\nimport rospy\nfrom std_msgs.msg import String\n\nclass MyNode:\n    def __init__(self):\n        rospy.init_node('my_node', anonymous=False)\n\n        # 1. Load parameters FIRST\n        self.rate = rospy.get_param('~rate', 10.0)\n        self.frame_id = rospy.get_param('~frame_id', 'base_link')\n\n        # 2. Set up publishers BEFORE subscribers\n        #    (prevents callbacks firing before publisher is ready)\n        self.pub = rospy.Publisher('~output', String, queue_size=10)\n\n        # 3. Set up subscribers LAST\n        self.sub = rospy.Subscriber('~input', String, self.callback)\n\n        rospy.loginfo(f\"[{rospy.get_name()}] Initialized with rate={self.rate}\")\n\n    def callback(self, msg):\n        # Process and republish\n        result = String(data=msg.data.upper())\n        self.pub.publish(result)\n\n    def run(self):\n        rate = rospy.Rate(self.rate)\n        while not rospy.is_shutdown():\n            # Periodic work here\n            rate.sleep()\n\nif __name__ == '__main__':\n    try:\n        node = MyNode()\n        node.run()\n    except rospy.ROSInterruptException:\n        pass\n```\n\n### 2. Topic Design\n\n**Naming Conventions**:\n```\n\u002Frobot_name\u002Fsensor_type\u002Fdata_type\n\n# Examples:\n\u002Fur5\u002Fjoint_states              # Robot joint states\n\u002Frealsense\u002Fcolor\u002Fimage_raw     # Camera color image\n\u002Frealsense\u002Fdepth\u002Fpoints        # Depth point cloud\n\u002Fmobile_base\u002Fcmd_vel           # Velocity commands\n\u002Fgripper\u002Fcommand               # Gripper commands\n```\n\n**Queue Sizes Matter**:\n```python\n# For sensor data (high frequency, OK to drop old messages):\nrospy.Subscriber('\u002Fcamera\u002Fimage', Image, self.cb, queue_size=1)\n\n# For commands (don't want to miss any):\nrospy.Publisher('\u002Fcmd_vel', Twist, queue_size=10)\n\n# For large data (point clouds, images) - use small queues to prevent memory bloat:\nrospy.Subscriber('\u002Flidar\u002Fpoints', PointCloud2, self.cb, queue_size=1)\n\n# NEVER use queue_size=0 (infinite) for high-frequency topics\n# This WILL cause memory leaks under load\n```\n\n**Latched Topics** for data that changes infrequently:\n```python\n# Robot description, static maps, calibration data\npub = rospy.Publisher('\u002Frobot_description', String, queue_size=1, latch=True)\n```\n\n### 3. Launch File Best Practices\n\n```xml\n\u003Claunch>\n  \u003C!-- ALWAYS use args for configurability -->\n  \u003Carg name=\"robot_name\" default=\"ur5\"\u002F>\n  \u003Carg name=\"sim\" default=\"false\"\u002F>\n  \u003Carg name=\"debug\" default=\"false\"\u002F>\n\n  \u003C!-- Group by subsystem with namespaces -->\n  \u003Cgroup ns=\"$(arg robot_name)\">\n\n    \u003C!-- Conditional loading based on sim vs real -->\n    \u003Cgroup if=\"$(arg sim)\">\n      \u003Cinclude file=\"$(find my_pkg)\u002Flaunch\u002Fsim_drivers.launch\"\u002F>\n    \u003C\u002Fgroup>\n    \u003Cgroup unless=\"$(arg sim)\">\n      \u003Cinclude file=\"$(find my_pkg)\u002Flaunch\u002Freal_drivers.launch\"\u002F>\n    \u003C\u002Fgroup>\n\n    \u003C!-- Node with proper remapping -->\n    \u003Cnode pkg=\"my_pkg\" type=\"perception_node.py\" name=\"perception\"\n          output=\"screen\" respawn=\"true\" respawn_delay=\"5\">\n      \u003Cparam name=\"rate\" value=\"30.0\"\u002F>\n      \u003Cparam name=\"frame_id\" value=\"$(arg robot_name)_base_link\"\u002F>\n      \u003Cremap from=\"~input_image\" to=\"\u002F$(arg robot_name)\u002Fcamera\u002Fimage_raw\"\u002F>\n      \u003Cremap from=\"~output_detections\" to=\"detections\"\u002F>\n      \u003C!-- Load a YAML param file -->\n      \u003Crosparam file=\"$(find my_pkg)\u002Fconfig\u002Fperception.yaml\" command=\"load\"\u002F>\n    \u003C\u002Fnode>\n\n  \u003C\u002Fgroup>\n\n  \u003C!-- Debug tools (conditionally loaded) -->\n  \u003Cgroup if=\"$(arg debug)\">\n    \u003Cnode pkg=\"rviz\" type=\"rviz\" name=\"rviz\"\n          args=\"-d $(find my_pkg)\u002Frviz\u002Fdebug.rviz\"\u002F>\n    \u003Cnode pkg=\"rqt_graph\" type=\"rqt_graph\" name=\"rqt_graph\"\u002F>\n  \u003C\u002Fgroup>\n\u003C\u002Flaunch>\n```\n\n### 4. TF Transform Tree\n\n**Rules**:\n- Every frame has EXACTLY one parent (tree, not graph)\n- Static transforms use `static_transform_publisher`\n- Dynamic transforms publish at consistent rates\n- ALWAYS set timestamps correctly\n\n```python\nimport tf2_ros\n\n# Publishing transforms\nbr = tf2_ros.TransformBroadcaster()\nt = TransformStamped()\nt.header.stamp = rospy.Time.now()  # CRITICAL: Use current time\nt.header.frame_id = \"odom\"\nt.child_frame_id = \"base_link\"\nt.transform.translation.x = x\nt.transform.translation.y = y\nt.transform.rotation = quaternion_from_euler(0, 0, theta)\nbr.sendTransform(t)\n\n# Listening for transforms (with timeout and exception handling)\ntf_buffer = tf2_ros.Buffer()\nlistener = tf2_ros.TransformListener(tf_buffer)\n\ntry:\n    trans = tf_buffer.lookup_transform(\n        'map', 'base_link',\n        rospy.Time(0),          # Get latest available\n        rospy.Duration(1.0)     # Wait up to 1 second\n    )\nexcept (tf2_ros.LookupException,\n        tf2_ros.ConnectivityException,\n        tf2_ros.ExtrapolationException) as e:\n    rospy.logwarn(f\"TF lookup failed: {e}\")\n```\n\n### 5. Actionlib for Long-Running Tasks\n\n```python\nimport actionlib\nfrom my_msgs.msg import PickPlaceAction, PickPlaceGoal, PickPlaceResult\n\n# Server\nclass PickPlaceServer:\n    def __init__(self):\n        self.server = actionlib.SimpleActionServer(\n            'pick_place',\n            PickPlaceAction,\n            execute_cb=self.execute,\n            auto_start=False  # ALWAYS set auto_start=False\n        )\n        self.server.start()\n\n    def execute(self, goal):\n        feedback = PickPlaceFeedback()\n\n        # Check for preemption INSIDE your loop\n        for step in self.plan_steps(goal):\n            if self.server.is_preempt_requested():\n                self.server.set_preempted()\n                return\n            self.execute_step(step)\n            feedback.progress = step.progress\n            self.server.publish_feedback(feedback)\n\n        result = PickPlaceResult(success=True)\n        self.server.set_succeeded(result)\n```\n\n## Common Pitfalls & Failure Modes\n\n### Time Synchronization\n```python\n# BAD: Comparing timestamps from different clocks\nif camera_msg.header.stamp == lidar_msg.header.stamp:  # Almost never true\n\n# GOOD: Use message_filters for approximate time sync\nimport message_filters\nsub_cam = message_filters.Subscriber('\u002Fcamera\u002Fimage', Image)\nsub_lidar = message_filters.Subscriber('\u002Flidar\u002Fpoints', PointCloud2)\nsync = message_filters.ApproximateTimeSynchronizer(\n    [sub_cam, sub_lidar], queue_size=10, slop=0.05  # 50ms tolerance\n)\nsync.registerCallback(self.synced_callback)\n```\n\n### Callback Threading\n```python\n# ROS1 uses a single-threaded spinner by default.\n# Long-running callbacks BLOCK all other callbacks.\n\n# BAD:\ndef callback(self, msg):\n    result = self.expensive_computation(msg)  # Blocks for 2 seconds!\n    self.pub.publish(result)\n\n# GOOD: Use a MultiThreadedSpinner or process in a separate thread\nrospy.init_node('my_node')\n# ... setup ...\nspinner = rospy.MultiThreadedSpinner(num_threads=4)\nspinner.spin()\n\n# Or use a processing thread:\nimport threading, queue\nclass MyNode:\n    def __init__(self):\n        self.work_queue = queue.Queue(maxsize=1)\n        self.worker = threading.Thread(target=self._process_loop, daemon=True)\n        self.worker.start()\n\n    def callback(self, msg):\n        try:\n            self.work_queue.put_nowait(msg)  # Non-blocking\n        except queue.Full:\n            pass  # Drop old data\n\n    def _process_loop(self):\n        while not rospy.is_shutdown():\n            msg = self.work_queue.get()\n            result = self.expensive_computation(msg)\n            self.pub.publish(result)\n```\n\n### Parameter Server Anti-Patterns\n```python\n# BAD: Hardcoded values\nself.threshold = 0.5\n\n# BAD: Global params without namespace\nself.threshold = rospy.get_param('threshold', 0.5)  # Collides across nodes\n\n# GOOD: Private params with defaults\nself.threshold = rospy.get_param('~threshold', 0.5)\n\n# GOOD: Dynamic reconfigure for runtime tuning\nfrom dynamic_reconfigure.server import Server\nfrom my_pkg.cfg import MyNodeConfig\nself.dyn_server = Server(MyNodeConfig, self.dyn_callback)\n```\n\n## Nodelets for Zero-Copy Transport\n\nWhen nodes exchange large data (images, point clouds) within the same process, nodelets eliminate serialization overhead:\n\n```cpp\n\u002F\u002F my_nodelet.h\n#include \u003Cnodelet\u002Fnodelet.h>\n#include \u003Cpluginlib\u002Fclass_list_macros.h>\n\nclass MyNodelet : public nodelet::Nodelet {\n  virtual void onInit() {\n    ros::NodeHandle& nh = getNodeHandle();\n    ros::NodeHandle& pnh = getPrivateNodeHandle();\n    \u002F\u002F Use shared_ptr for zero-copy: pass pointers, not copies\n    pub_ = nh.advertise\u003Csensor_msgs::Image>(\"output\", 1);\n    sub_ = nh.subscribe(\"input\", 1, &MyNodelet::callback, this);\n  }\n};\nPLUGINLIB_EXPORT_CLASS(MyNodelet, nodelet::Nodelet)\n```\n\n## Package Structure\n\n```\nmy_robot_pkg\u002F\n├── CMakeLists.txt\n├── package.xml\n├── setup.py                    # For Python packages\n├── config\u002F\n│   ├── robot_params.yaml       # Default parameters\n│   └── dynamic_reconfigure\u002F    # .cfg files\n├── launch\u002F\n│   ├── robot.launch            # Top-level launcher\n│   ├── drivers.launch          # Hardware drivers\n│   └── perception.launch       # Perception pipeline\n├── msg\u002F                        # Custom message definitions\n│   └── Detection.msg\n├── srv\u002F                        # Service definitions\n│   └── GetPose.srv\n├── action\u002F                     # Action definitions\n│   └── PickPlace.action\n├── src\u002F                        # C++ source\n│   └── my_node.cpp\n├── scripts\u002F                    # Python nodes (executable)\n│   └── perception_node.py\n├── include\u002Fmy_robot_pkg\u002F       # C++ headers\n│   └── my_node.h\n├── rviz\u002F                       # RViz configs\n│   └── debug.rviz\n├── urdf\u002F                       # Robot model\n│   └── robot.urdf.xacro\n└── test\u002F                       # Unit and integration tests\n    ├── test_perception.py\n    └── test_perception.test    # rostest launch file\n```\n\n## Debugging Toolkit\n\n```bash\n# Essential diagnostic commands\nrostopic list                     # See all active topics\nrostopic hz \u002Fcamera\u002Fimage_raw     # Check publish rate\nrostopic bw \u002Flidar\u002Fpoints         # Check bandwidth\nrostopic echo \u002Fjoint_states -n 1  # Inspect one message\n\nrosnode list                      # Active nodes\nrosnode info \u002Fperception          # Connections and subscriptions\n\nroswtf                            # Automated diagnostics\n\nrqt_graph                         # Visual node\u002Ftopic graph\nrqt_console                       # Log viewer with filtering\n\n# TF debugging\nrosrun tf tf_monitor              # Monitor TF tree health\nrosrun tf view_frames             # Generate TF tree PDF\nrosrun tf tf_echo map base_link   # Print transform continuously\n\n# Bag file operations\nrosbag record -a                  # Record everything (careful with disk!)\nrosbag record \u002Fcamera\u002Fimage \u002Ftf   # Record specific topics\nrosbag info recording.bag         # Inspect bag contents\nrosbag play recording.bag --clock # Playback with simulated time\n```\n\n## ROS1 → ROS2 Migration Checklist\n\nWhen planning a migration, note these key differences:\n- `rospy` → `rclpy`, `roscpp` → `rclcpp`\n- `catkin_make` → `colcon build`\n- `roslaunch` XML → ROS2 Python launch files\n- Global parameter server → Per-node parameters\n- `rospy.Rate` → `node.create_timer()`\n- Single `roscore` → DDS discovery (no central master)\n- `message_filters` works in both, but API differs\n- Custom messages: same `.msg` format, different build system\n- Nodelets → ROS2 Components (intra-process communication)\n- `dynamic_reconfigure` → ROS2 parameters with callbacks\n\nStart migration from leaf nodes (sensors, actuators) and work inward.\nUse the `ros1_bridge` package to run both stacks simultaneously during transition.\n\n","# ROS1 Development Skill\n\n## When to Use This Skill\n- Building or maintaining ROS1 packages and nodes\n- Writing launch files, message types, or services\n- Debugging ROS1 communication (topics, services, actions)\n- Configuring catkin workspaces and build systems\n- Working with tf\u002Ftf2 transforms, URDF, or robot models\n- Using actionlib for long-running tasks\n- Optimizing nodelets for zero-copy transport\n- Planning ROS1 → ROS2 migration\n\n## Core Architecture Principles\n\n### 1. Node Design\n\n**Single Responsibility Nodes**: Each node should do ONE thing well. Resist the temptation to build monolithic \"do-everything\" nodes.\n\n```python\n# BAD: Monolithic node\nclass RobotNode:\n    def __init__(self):\n        self.sub_camera = rospy.Subscriber('\u002Fcamera\u002Fimage', Image, self.camera_cb)\n        self.sub_lidar = rospy.Subscriber('\u002Flidar\u002Fpoints', PointCloud2, self.lidar_cb)\n        self.pub_cmd = rospy.Publisher('\u002Fcmd_vel', Twist, queue_size=10)\n        self.pub_map = rospy.Publisher('\u002Fmap', OccupancyGrid, queue_size=1)\n        # This node does perception, planning, AND control\n\n# GOOD: Decomposed nodes\nclass PerceptionNode:    # Fuses sensor data → publishes \u002Fobstacles\nclass PlannerNode:       # Subscribes \u002Fobstacles → publishes \u002Fpath\nclass ControllerNode:    # Subscribes \u002Fpath → publishes \u002Fcmd_vel\n```\n\n**Node Initialization Pattern**:\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python\nimport rospy\nfrom std_msgs.msg import String\n\nclass MyNode:\n    def __init__(self):\n        rospy.init_node('my_node', anonymous=False)\n\n        # 1. Load parameters FIRST\n        self.rate = rospy.get_param('~rate', 10.0)\n        self.frame_id = rospy.get_param('~frame_id', 'base_link')\n\n        # 2. Set up publishers BEFORE subscribers\n        #    (prevents callbacks firing before publisher is ready)\n        self.pub = rospy.Publisher('~output', String, queue_size=10)\n\n        # 3. Set up subscribers LAST\n        self.sub = rospy.Subscriber('~input', String, self.callback)\n\n        rospy.loginfo(f\"[{rospy.get_name()}] Initialized with rate={self.rate}\")\n\n    def callback(self, msg):\n        # Process and republish\n        result = String(data=msg.data.upper())\n        self.pub.publish(result)\n\n    def run(self):\n        rate = rospy.Rate(self.rate)\n        while not rospy.is_shutdown():\n            # Periodic work here\n            rate.sleep()\n\nif __name__ == '__main__':\n    try:\n        node = MyNode()\n        node.run()\n    except rospy.ROSInterruptException:\n        pass\n```\n\n### 2. Topic Design\n\n**Naming Conventions**:\n```\n\u002Frobot_name\u002Fsensor_type\u002Fdata_type\n\n# Examples:\n\u002Fur5\u002Fjoint_states              # Robot joint states\n\u002Frealsense\u002Fcolor\u002Fimage_raw     # Camera color image\n\u002Frealsense\u002Fdepth\u002Fpoints        # Depth point cloud\n\u002Fmobile_base\u002Fcmd_vel           # Velocity commands\n\u002Fgripper\u002Fcommand               # Gripper commands\n```\n\n**Queue Sizes Matter**:\n```python\n# For sensor data (high frequency, OK to drop old messages):\nrospy.Subscriber('\u002Fcamera\u002Fimage', Image, self.cb, queue_size=1)\n\n# For commands (don't want to miss any):\nrospy.Publisher('\u002Fcmd_vel', Twist, queue_size=10)\n\n# For large data (point clouds, images) - use small queues to prevent memory bloat:\nrospy.Subscriber('\u002Flidar\u002Fpoints', PointCloud2, self.cb, queue_size=1)\n\n# NEVER use queue_size=0 (infinite) for high-frequency topics\n# This WILL cause memory leaks under load\n```\n\n**Latched Topics** for data that changes infrequently:\n```python\n# Robot description, static maps, calibration data\npub = rospy.Publisher('\u002Frobot_description', String, queue_size=1, latch=True)\n```\n\n### 3. Launch File Best Practices\n\n```xml\n\u003Claunch>\n  \u003C!-- ALWAYS use args for configurability -->\n  \u003Carg name=\"robot_name\" default=\"ur5\"\u002F>\n  \u003Carg name=\"sim\" default=\"false\"\u002F>\n  \u003Carg name=\"debug\" default=\"false\"\u002F>\n\n  \u003C!-- Group by subsystem with namespaces -->\n  \u003Cgroup ns=\"$(arg robot_name)\">\n\n    \u003C!-- Conditional loading based on sim vs real -->\n    \u003Cgroup if=\"$(arg sim)\">\n      \u003Cinclude file=\"$(find my_pkg)\u002Flaunch\u002Fsim_drivers.launch\"\u002F>\n    \u003C\u002Fgroup>\n    \u003Cgroup unless=\"$(arg sim)\">\n      \u003Cinclude file=\"$(find my_pkg)\u002Flaunch\u002Freal_drivers.launch\"\u002F>\n    \u003C\u002Fgroup>\n\n    \u003C!-- Node with proper remapping -->\n    \u003Cnode pkg=\"my_pkg\" type=\"perception_node.py\" name=\"perception\"\n          output=\"screen\" respawn=\"true\" respawn_delay=\"5\">\n      \u003Cparam name=\"rate\" value=\"30.0\"\u002F>\n      \u003Cparam name=\"frame_id\" value=\"$(arg robot_name)_base_link\"\u002F>\n      \u003Cremap from=\"~input_image\" to=\"\u002F$(arg robot_name)\u002Fcamera\u002Fimage_raw\"\u002F>\n      \u003Cremap from=\"~output_detections\" to=\"detections\"\u002F>\n      \u003C!-- Load a YAML param file -->\n      \u003Crosparam file=\"$(find my_pkg)\u002Fconfig\u002Fperception.yaml\" command=\"load\"\u002F>\n    \u003C\u002Fnode>\n\n  \u003C\u002Fgroup>\n\n  \u003C!-- Debug tools (conditionally loaded) -->\n  \u003Cgroup if=\"$(arg debug)\">\n    \u003Cnode pkg=\"rviz\" type=\"rviz\" name=\"rviz\"\n          args=\"-d $(find my_pkg)\u002Frviz\u002Fdebug.rviz\"\u002F>\n    \u003Cnode pkg=\"rqt_graph\" type=\"rqt_graph\" name=\"rqt_graph\"\u002F>\n  \u003C\u002Fgroup>\n\u003C\u002Flaunch>\n```\n\n### 4. TF Transform Tree\n\n**Rules**:\n- Every frame has EXACTLY one parent (tree, not graph)\n- Static transforms use `static_transform_publisher`\n- Dynamic transforms publish at consistent rates\n- ALWAYS set timestamps correctly\n\n```python\nimport tf2_ros\n\n# Publishing transforms\nbr = tf2_ros.TransformBroadcaster()\nt = TransformStamped()\nt.header.stamp = rospy.Time.now()  # CRITICAL: Use current time\nt.header.frame_id = \"odom\"\nt.child_frame_id = \"base_link\"\nt.transform.translation.x = x\nt.transform.translation.y = y\nt.transform.rotation = quaternion_from_euler(0, 0, theta)\nbr.sendTransform(t)\n\n# Listening for transforms (with timeout and exception handling)\ntf_buffer = tf2_ros.Buffer()\nlistener = tf2_ros.TransformListener(tf_buffer)\n\ntry:\n    trans = tf_buffer.lookup_transform(\n        'map', 'base_link',\n        rospy.Time(0),          # Get latest available\n        rospy.Duration(1.0)     # Wait up to 1 second\n    )\nexcept (tf2_ros.LookupException,\n        tf2_ros.ConnectivityException,\n        tf2_ros.ExtrapolationException) as e:\n    rospy.logwarn(f\"TF lookup failed: {e}\")\n```\n\n### 5. Actionlib for Long-Running Tasks\n\n```python\nimport actionlib\nfrom my_msgs.msg import PickPlaceAction, PickPlaceGoal, PickPlaceResult\n\n# Server\nclass PickPlaceServer:\n    def __init__(self):\n        self.server = actionlib.SimpleActionServer(\n            'pick_place',\n            PickPlaceAction,\n            execute_cb=self.execute,\n            auto_start=False  # ALWAYS set auto_start=False\n        )\n        self.server.start()\n\n    def execute(self, goal):\n        feedback = PickPlaceFeedback()\n\n        # Check for preemption INSIDE your loop\n        for step in self.plan_steps(goal):\n            if self.server.is_preempt_requested():\n                self.server.set_preempted()\n                return\n            self.execute_step(step)\n            feedback.progress = step.progress\n            self.server.publish_feedback(feedback)\n\n        result = PickPlaceResult(success=True)\n        self.server.set_succeeded(result)\n```\n\n## Common Pitfalls & Failure Modes\n\n### Time Synchronization\n```python\n# BAD: Comparing timestamps from different clocks\nif camera_msg.header.stamp == lidar_msg.header.stamp:  # Almost never true\n\n# GOOD: Use message_filters for approximate time sync\nimport message_filters\nsub_cam = message_filters.Subscriber('\u002Fcamera\u002Fimage', Image)\nsub_lidar = message_filters.Subscriber('\u002Flidar\u002Fpoints', PointCloud2)\nsync = message_filters.ApproximateTimeSynchronizer(\n    [sub_cam, sub_lidar], queue_size=10, slop=0.05  # 50ms tolerance\n)\nsync.registerCallback(self.synced_callback)\n```\n\n### Callback Threading\n```python\n# ROS1 uses a single-threaded spinner by default.\n# Long-running callbacks BLOCK all other callbacks.\n\n# BAD:\ndef callback(self, msg):\n    result = self.expensive_computation(msg)  # Blocks for 2 seconds!\n    self.pub.publish(result)\n\n# GOOD: Use a MultiThreadedSpinner or process in a separate thread\nrospy.init_node('my_node')\n# ... setup ...\nspinner = rospy.MultiThreadedSpinner(num_threads=4)\nspinner.spin()\n\n# Or use a processing thread:\nimport threading, queue\nclass MyNode:\n    def __init__(self):\n        self.work_queue = queue.Queue(maxsize=1)\n        self.worker = threading.Thread(target=self._process_loop, daemon=True)\n        self.worker.start()\n\n    def callback(self, msg):\n        try:\n            self.work_queue.put_nowait(msg)  # Non-blocking\n        except queue.Full:\n            pass  # Drop old data\n\n    def _process_loop(self):\n        while not rospy.is_shutdown():\n            msg = self.work_queue.get()\n            result = self.expensive_computation(msg)\n            self.pub.publish(result)\n```\n\n### Parameter Server Anti-Patterns\n```python\n# BAD: Hardcoded values\nself.threshold = 0.5\n\n# BAD: Global params without namespace\nself.threshold = rospy.get_param('threshold', 0.5)  # Collides across nodes\n\n# GOOD: Private params with defaults\nself.threshold = rospy.get_param('~threshold', 0.5)\n\n# GOOD: Dynamic reconfigure for runtime tuning\nfrom dynamic_reconfigure.server import Server\nfrom my_pkg.cfg import MyNodeConfig\nself.dyn_server = Server(MyNodeConfig, self.dyn_callback)\n```\n\n## Nodelets for Zero-Copy Transport\n\nWhen nodes exchange large data (images, point clouds) within the same process, nodelets eliminate serialization overhead:\n\n```cpp\n\u002F\u002F my_nodelet.h\n#include \u003Cnodelet\u002Fnodelet.h>\n#include \u003Cpluginlib\u002Fclass_list_macros.h>\n\nclass MyNodelet : public nodelet::Nodelet {\n  virtual void onInit() {\n    ros::NodeHandle& nh = getNodeHandle();\n    ros::NodeHandle& pnh = getPrivateNodeHandle();\n    \u002F\u002F Use shared_ptr for zero-copy: pass pointers, not copies\n    pub_ = nh.advertise\u003Csensor_msgs::Image>(\"output\", 1);\n    sub_ = nh.subscribe(\"input\", 1, &MyNodelet::callback, this);\n  }\n};\nPLUGINLIB_EXPORT_CLASS(MyNodelet, nodelet::Nodelet)\n```\n\n## Package Structure\n\n```\nmy_robot_pkg\u002F\n├── CMakeLists.txt\n├── package.xml\n├── setup.py                    # For Python packages\n├── config\u002F\n│   ├── robot_params.yaml       # Default parameters\n│   └── dynamic_reconfigure\u002F    # .cfg files\n├── launch\u002F\n│   ├── robot.launch            # Top-level launcher\n│   ├── drivers.launch          # Hardware drivers\n│   └── perception.launch       # Perception pipeline\n├── msg\u002F                        # Custom message definitions\n│   └── Detection.msg\n├── srv\u002F                        # Service definitions\n│   └── GetPose.srv\n├── action\u002F                     # Action definitions\n│   └── PickPlace.action\n├── src\u002F                        # C++ source\n│   └── my_node.cpp\n├── scripts\u002F                    # Python nodes (executable)\n│   └── perception_node.py\n├── include\u002Fmy_robot_pkg\u002F       # C++ headers\n│   └── my_node.h\n├── rviz\u002F                       # RViz configs\n│   └── debug.rviz\n├── urdf\u002F                       # Robot model\n│   └── robot.urdf.xacro\n└── test\u002F                       # Unit and integration tests\n    ├── test_perception.py\n    └── test_perception.test    # rostest launch file\n```\n\n## Debugging Toolkit\n\n```bash\n# Essential diagnostic commands\nrostopic list                     # See all active topics\nrostopic hz \u002Fcamera\u002Fimage_raw     # Check publish rate\nrostopic bw \u002Flidar\u002Fpoints         # Check bandwidth\nrostopic echo \u002Fjoint_states -n 1  # Inspect one message\n\nrosnode list                      # Active nodes\nrosnode info \u002Fperception          # Connections and subscriptions\n\nroswtf                            # Automated diagnostics\n\nrqt_graph                         # Visual node\u002Ftopic graph\nrqt_console                       # Log viewer with filtering\n\n# TF debugging\nrosrun tf tf_monitor              # Monitor TF tree health\nrosrun tf view_frames             # Generate TF tree PDF\nrosrun tf tf_echo map base_link   # Print transform continuously\n\n# Bag file operations\nrosbag record -a                  # Record everything (careful with disk!)\nrosbag record \u002Fcamera\u002Fimage \u002Ftf   # Record specific topics\nrosbag info recording.bag         # Inspect bag contents\nrosbag play recording.bag --clock # Playback with simulated time\n```\n\n## ROS1 → ROS2 Migration Checklist\n\nWhen planning a migration, note these key differences:\n- `rospy` → `rclpy`, `roscpp` → `rclcpp`\n- `catkin_make` → `colcon build`\n- `roslaunch` XML → ROS2 Python launch files\n- Global parameter server → Per-node parameters\n- `rospy.Rate` → `node.create_timer()`\n- Single `roscore` → DDS discovery (no central master)\n- `message_filters` works in both, but API differs\n- Custom messages: same `.msg` format, different build system\n- Nodelets → ROS2 Components (intra-process communication)\n- `dynamic_reconfigure` → ROS2 parameters with callbacks\n\nStart migration from leaf nodes (sensors, actuators) and work inward.\nUse the `ros1_bridge` package to run both stacks simultaneously during transition.\n\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Farpitg1304\u002Frobotics-agent-skills\u002Fros1",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill ros1-development",{"tool":67,"command":68},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill ros1-development",{"tool":70,"command":71},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill ros1-development","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Farpitg1304\u002Frobotics-agent-skills\u002Fros1\u002FSKILL.md",true,[],[76,86,96,105,111,118],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":82,"publishedAt":47},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[81],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[83,84,85],"model","model hierarchy","model hierarchy skill",{"skillNo":87,"name":88,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":92,"publishedAt":47},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[91],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[93,94,95],"MCP","zoom","zoom mcp",{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":47},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[102,103,104,94],"sdk","zoom apps sdk","apps",{"skillNo":106,"name":107,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":47},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[107],{"skillNo":112,"name":113,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":117,"publishedAt":47},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[116],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[113],{"skillNo":119,"name":120,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":47},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[120]]