Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change generated location ros2 #50

Closed

Conversation

Rick-v-E
Copy link
Member

This will change the location of all generated files to $ROS_HOME/virtual_maize_field, which is by default ~/.ros/virtual_maize_field, instead of the install/virtual_maize_field/share/virtual_maize_field/world, install/virtual_maize_field/share/virtual_maize_field/gt, install/virtual_maize_field/share/virtual_maize_field/map and install/virtual_maize_field/share/virtual_maize_field/launch folder.

This is needed when converting this into an official ROS package, otherwise these files will be generated somewhere in /opt/ros/humble/share, which will require sudo to write.

This is however a breaking change, everyone should change their launch file from:

from __future__ import annotations

from os.path import join

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource


def generate_launch_description() -> LaunchDescription:
   spawner_file = join(get_package_share_directory("virtual_maize_field"), "launch", "robot_spawner.launch.py"

    robot_spawner_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([spawner_file]),
        launch_arguments={"robot_name": "<<robot_name>>"}.items(),
    )

    return LaunchDescription([robot_spawner_launch])

to:

from __future__ import annotations

from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource

from virtual_maize_field import get_spawner_launch_file


def generate_launch_description() -> LaunchDescription:
    robot_spawner_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([get_spawner_launch_file()]),
        launch_arguments={"robot_name": "<<robot_name>>"}.items(),
    )

    return LaunchDescription([robot_spawner_launch])

Related: #48

@Rick-v-E Rick-v-E mentioned this pull request May 26, 2023
6 tasks
@Rick-v-E
Copy link
Member Author

Closed because conflict. #56

@Rick-v-E Rick-v-E closed this Jan 18, 2024
@Rick-v-E Rick-v-E deleted the change-generated-location-ros2 branch January 18, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant