clearpathrobotics / clearpath_simulator

BSD 3-Clause "New" or "Revised" License
13 stars 10 forks source link

self.prefix_launch_arg not defined in the source build launch/generator.py but present in the pre-built package #43

Closed devvaibhav455 closed 2 months ago

devvaibhav455 commented 2 months ago

Please provide the following information:

To Reproduce Provide the steps to reproduce:

  1. Follow instructions from https://docs.clearpathrobotics.com/docs/ros/tutorials/simulator/overview to run the simulator by building from source.
  2. ros2 launch clearpath_gz simulation.launch.py
  3. Gazebo opens but robot is not present because the platform launch file is not generated
[generate_launch-5] Traceback (most recent call last):
[generate_launch-5]   File "/home/dev/clearpath_ws/install/clearpath_generator_gz/lib/clearpath_generator_gz/generate_launch", line 47, in <module>
[generate_launch-5]     main()
[generate_launch-5]   File "/home/dev/clearpath_ws/install/clearpath_generator_gz/lib/clearpath_generator_gz/generate_launch", line 42, in main
[generate_launch-5]     glg = GzLaunchGenerator(setup_path)
[generate_launch-5]   File "/home/dev/clearpath_ws/install/clearpath_generator_gz/local/lib/python3.10/dist-packages/clearpath_generator_gz/launch/generator.py", line 204, in __init__
[generate_launch-5]     self.prefix_launch_arg,
[generate_launch-5] AttributeError: 'GzLaunchGenerator' object has no attribute 'prefix_launch_arg'
[ERROR] [generate_launch-5]: process has died [pid 51814, exit code 1, cmd '/home/dev/clearpath_ws/install/clearpath_generator_gz/lib/clearpath_generator_gz/generate_launch -s /home/dev/clearpath/ --ros-args -r __node:=generate_launch'].

I think it happens because self.prefix_launch_arg is not defined in the source but is present in the pre-built package. My other laptop uses the apt install, and I learned the difference that way.

This is how it appears in the deb packages

# Prefix launch arg
        self.prefix_launch_arg = LaunchFile.LaunchArg(
            'prefix',
            default_value='/world/warehouse/model/robot/link/base_link/sensor/',
            description='Ignition sensor topic prefix'
        )
        prefix_variable = LaunchFile.Variable('prefix')

self.platform_components dictionary is also different for A200
Platform.A200: [
                self.cmd_vel_node,
                self.odom_base_node,
                self.prefix_launch_arg,
            ],

This is how it is present in the source build. There is no definition for self.prefix_launch_arg and its also missing in the keys

Platform.A200: [
                self.cmd_vel_node,
                self.odom_base_node,
            ],

Other notes FYI, There might be other differences that I didn't check. Robot spawns after adding these lines to the source build.

luis-camero commented 2 months ago

The prefix_launch_arg is no longer utilised and should have been removed, but was missed in the r100 entry.

I have made the fix in PR #45.