forked from Farraj007/pid_controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First working version (really suboptimal)
- Loading branch information
Showing
2 changed files
with
56 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,50 @@ | ||
from launch import LaunchDescription,actions | ||
import os | ||
from launch import LaunchDescription | ||
from launch.actions import LogInfo | ||
from launch_ros.actions import Node | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from launch_ros.substitutions import FindPackageShare | ||
from launch.actions import IncludeLaunchDescription | ||
|
||
def generate_launch_description(): | ||
return LaunchDescription([ | ||
Node( | ||
package='megoldas_sim24', | ||
executable='simple_pursuit.py', | ||
output='screen', | ||
parameters=[ | ||
{ | ||
'kozepiskola_neve': "Nem definialt kozepiskola", | ||
'kozepiskola_azonosito': "A00", | ||
'angle_range': 360, | ||
'velocity': 1.00, | ||
'car_length': 0.445, | ||
'wheelbase': 0.3187, | ||
'map_frame': 'odom_combined', | ||
'laser_frame': 'laser', | ||
} | ||
] | ||
simple_pursuit = Node( | ||
package='megoldas_sim24', | ||
executable='simple_pursuit.py', | ||
output='screen', | ||
parameters=[ | ||
{ | ||
'kozepiskola_neve': "Nem definialt kozepiskola", | ||
'kozepiskola_azonosito': "A00", | ||
'angle_range': 360, | ||
'velocity': 1.00, | ||
'car_length': 0.445, | ||
'wheelbase': 0.3187, | ||
'map_frame': 'odom_combined', ## not uses yet | ||
'laser_frame': 'laser', | ||
'base_frame': 'base_link', | ||
} | ||
] | ||
) | ||
|
||
), | ||
|
||
# actions.ExecuteProcess( | ||
# cmd=['ros2', 'service', 'call', '/gazebo/reset_simulation', 'std_srvs/srv/Empty', '{}'], | ||
# output='screen' | ||
# ) | ||
# Node( | ||
# package='ros2_service', | ||
# executable='ros2 service', | ||
# name='rosservice', | ||
# arguments=['call', '/gazebo/reset_simulation'] | ||
# ) | ||
]) | ||
# Get the path to the included launch file | ||
package_share = FindPackageShare("megoldas_sim24").find("megoldas_sim24") | ||
# print("----" + package_share) | ||
launch_file_path = os.path.join(package_share, 'string_rviz_overlay.launch.py') | ||
|
||
str_overlay = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource([ | ||
FindPackageShare("megoldas_sim24"), '/string_rviz_overlay.launch.py']) | ||
) | ||
|
||
# Check if the file exists # TODO: this is not the best way to check, the launch may exist, but not working is still an issue | ||
if os.path.exists(launch_file_path): | ||
return LaunchDescription([ | ||
simple_pursuit, | ||
str_overlay | ||
]) | ||
else: | ||
# Log or handle the case where the file does not exist | ||
return LaunchDescription([ | ||
simple_pursuit, | ||
LogInfo(msg="Error: string_rviz_overlay.launch.py not found") # Log a message instead of crashing | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters