update: code cleanup and tuning

This commit is contained in:
bjoernellens1 2023-12-07 12:13:16 +01:00 committed by GitHub
parent e063609fd8
commit 676042d333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 117 additions and 381 deletions

View File

@ -105,6 +105,4 @@ def generate_launch_description():
robot_controller_spawner,
joystick_spawner,
teleop_spawner,
#cam_node,
#lidar_node
])

View File

@ -21,70 +21,28 @@ from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import LifecycleNode
from launch_ros.descriptions import ParameterValue
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
def generate_launch_description():
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[
FindPackageShare("cps_loki_description"),
"urdf",
"odrive_diffbot.urdf.xacro"
]
),
]
)
robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)}
robot_controllers = PathJoinSubstitution(
[
FindPackageShare("cps_loki_bringup"),
"config",
"diffbot_controllers.yaml",
]
)
namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
output="both",
)
declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
robot_state_pub_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
)
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "-c", "/controller_manager"],
)
robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["diffbot_base_controller", "-c", "/controller_manager"],
)
joystick_spawner = Node(
package="joy",
executable="joy_node"
)
teleop_spawner = Node(
package="rmp220_teleop",
executable="rmp220_teleop"
)
declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
cam_node = Node(
package="ros2_cam_openCV",
executable="cam_node"
executable="cam_node",
namespace=namespace
)
lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml')
@ -99,12 +57,5 @@ def generate_launch_description():
)
return LaunchDescription([
#control_node,
#robot_state_pub_node,
#joint_state_broadcaster_spawner,
#robot_controller_spawner,
#joystick_spawner,
#teleop_spawner,
cam_node,
#lidar_node
cam_node
])

View File

@ -21,8 +21,24 @@ from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import LifecycleNode
from launch_ros.descriptions import ParameterValue
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
def generate_launch_description():
namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
@ -42,7 +58,7 @@ def generate_launch_description():
[
FindPackageShare("cps_loki_bringup"),
"config",
"diffbot_controllers.yaml",
"controllers.yaml",
]
)

View File

@ -21,93 +21,30 @@ from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import LifecycleNode
from launch_ros.descriptions import ParameterValue
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
def generate_launch_description():
#use_sim_time = LaunchConfiguration('use_sim_time')
use_sim_time = True
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[
FindPackageShare("cps_loki_description"),
"urdf",
"odrive_diffbot.urdf.xacro"
]
),
]
)
robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)}
namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
robot_controllers = PathJoinSubstitution(
[
FindPackageShare("cps_loki_bringup"),
"config",
"diffbot_controllers.yaml",
]
)
declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
output="both",
)
declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
robot_state_pub_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
)
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "-c", "/controller_manager"],
)
robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["diffbot_base_controller", "-c", "/controller_manager"],
)
joystick_spawner = Node(
package="joy",
executable="joy_node"
)
teleop_spawner = Node(
package="rmp220_teleop",
executable="rmp220_teleop",
remappings=[('cmd_vel', 'cmd_vel_joy')],
)
cam_node = Node(
package="ros2_cam_openCV",
executable="cam_node"
)
lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml')
lidar_node = LifecycleNode(
package='lslidar_driver',
executable='lslidar_driver_node',
name='lslidar_driver_node',
output='screen',
emulate_tty=True,
namespace='',
parameters=[lidar_dir],
)
twist_mux_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','twist_mux.yaml')
twist_mux_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','mux.yaml')
twist_mux = Node(
package="twist_mux",
executable="twist_mux",
parameters=[twist_mux_params, {'use_sim_time': False}],
parameters=[twist_mux_params, {'use_sim_time': use_sim_time}],
remappings=[('/cmd_vel_out','/diffbot_base_controller/cmd_vel_unstamped')]
namespace = namespace
)
joy_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','joystick.yaml')
@ -115,7 +52,7 @@ def generate_launch_description():
package='joy',
executable='joy_node',
parameters=[joy_params, {'use_sim_time': use_sim_time}],
#namespace = namespace
namespace = namespace
)
teleop_node = Node(
@ -124,18 +61,10 @@ def generate_launch_description():
name='teleop_node',
parameters=[joy_params, {'use_sim_time': use_sim_time}],
remappings=[('cmd_vel', 'cmd_vel_joy')],
#namespace = namespace
namespace = namespace
)
return LaunchDescription([
#control_node,
#robot_state_pub_node,
#joint_state_broadcaster_spawner,
#robot_controller_spawner,
#joystick_spawner,
#teleop_spawner,
#cam_node,
#lidar_node,
twist_mux,
joy_node,
teleop_node

View File

@ -21,17 +21,32 @@ from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import LifecycleNode
from launch_ros.descriptions import ParameterValue
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
def generate_launch_description():
lidar_dir = os.path.join(get_package_share_directory('cps_loki_bringup'), 'config', 'lsx10.yaml')
namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
lidar_dir = os.path.join(get_package_share_directory('cps_loki_bringup'), 'config', 'lidar.yaml')
lidar_node = LifecycleNode(
package='lslidar_driver',
executable='lslidar_driver_node',
name='lslidar_driver_node',
output='screen',
emulate_tty=True,
namespace='',
namespace=namespace,
parameters=[lidar_dir],
)

View File

@ -22,101 +22,23 @@ from launch_ros.actions import LifecycleNode
from launch_ros.descriptions import ParameterValue
from launch.substitutions import LaunchConfiguration
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
def generate_launch_description():
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[
FindPackageShare("cps_loki_description"),
"urdf",
"odrive_diffbot.urdf.xacro"
]
),
]
)
robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)}
robot_controllers = PathJoinSubstitution(
[
FindPackageShare("cps_loki_bringup"),
"config",
"diffbot_controllers.yaml",
]
)
namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
output="both",
)
declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
robot_state_pub_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
)
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "-c", "/controller_manager"],
)
robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["diffbot_base_controller", "-c", "/controller_manager"],
)
joystick_spawner = Node(
package="joy",
executable="joy_node"
)
teleop_spawner = Node(
package="rmp220_teleop",
executable="rmp220_teleop"
)
cam_node = Node(
package="ros2_cam_openCV",
executable="cam_node"
)
use_sim_time = False
slam_params_file = PathJoinSubstitution(
[
FindPackageShare("cps_loki_bringup"),
"config",
"mapper_params_online_async.yaml"
]
)
mapper_node = Node(
package="slam_toolbox",
executable="async_slam_toolbox_node",
name='slam_toolbox_node',
output='screen',
parameters=[
slam_params_file,
{'use_sim_time': use_sim_time}
],
)
lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml')
lidar_node = LifecycleNode(
package='lslidar_driver',
executable='lslidar_driver_node',
name='lslidar_driver_node',
output='screen',
emulate_tty=True,
namespace='',
parameters=[lidar_dir],
)
declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
robot_localization_node = Node(
package='robot_localization',
@ -130,19 +52,11 @@ def generate_launch_description():
"ekf.yaml"
]
) ,
#{'use_sim_time': LaunchConfiguration('use_sim_time')}
]
{'use_sim_time': LaunchConfiguration('use_sim_time')}
],
namespace=namespace
)
return LaunchDescription([
#control_node,
#robot_state_pub_node,
#joint_state_broadcaster_spawner,
#robot_controller_spawner,
#joystick_spawner,
#teleop_spawner,
#cam_node,
#lidar_node,
#mapper_node,
robot_localization_node
])

View File

@ -22,17 +22,32 @@ from launch_ros.actions import LifecycleNode
from launch_ros.descriptions import ParameterValue
from launch.substitutions import LaunchConfiguration
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
def generate_launch_description():
namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
slam_params_file = PathJoinSubstitution(
[
FindPackageShare("cps_loki_bringup"),
"config",
"mapper_params_online_async.yaml"
"slam.yaml"
]
)
mapper_node = Node(
package="slam_toolbox",
executable="async_slam_toolbox_node",
@ -42,6 +57,7 @@ def generate_launch_description():
slam_params_file,
{'use_sim_time': use_sim_time}
],
namespace=namespace
)
return LaunchDescription([

View File

@ -83,7 +83,7 @@ def generate_launch_description():
declare_params_file_cmd = DeclareLaunchArgument(
'params_file',
default_value=os.path.join(bringup_dir, 'config', 'nav2_params.yaml'),
default_value=os.path.join(bringup_dir, 'config', 'nav2.yaml'),
description='Full path to the ROS2 parameters file to use for all launched nodes')
declare_autostart_cmd = DeclareLaunchArgument(

View File

@ -3,8 +3,24 @@ from launch.substitutions import PathJoinSubstitution
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
def generate_launch_description():
namespace = LaunchConfiguration('namespace')
use_sim_time = LaunchConfiguration('use_sim_time')
declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
return LaunchDescription([
Node(
package="laser_filters",
@ -14,5 +30,6 @@ def generate_launch_description():
get_package_share_directory("cps_loki_bringup"),
"config", "box_filter.yaml",
])],
namespace=namespace
)
])

View File

@ -1,120 +0,0 @@
# Copyright 2022 Factor Robotics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from launch import LaunchDescription
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import LifecycleNode
from launch_ros.descriptions import ParameterValue
def generate_launch_description():
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[
FindPackageShare("cps_loki_description"),
"urdf",
"odrive_diffbot.urdf.xacro"
]
),
]
)
robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)}
robot_controllers = PathJoinSubstitution(
[
FindPackageShare("cps_loki_bringup"),
"config",
"diffbot_controllers.yaml",
]
)
control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
output="both",
)
robot_state_pub_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
)
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "-c", "/controller_manager"],
)
robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["diffbot_base_controller", "-c", "/controller_manager"],
)
joystick_spawner = Node(
package="joy",
executable="joy_node"
)
teleop_spawner = Node(
package="rmp220_teleop",
executable="rmp220_teleop",
remappings=[('/diffbot_base_controller/cmd_vel_unstamped','/cmd_vel_joy')]
)
cam_node = Node(
package="ros2_cam_openCV",
executable="cam_node"
)
lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml')
lidar_node = LifecycleNode(
package='lslidar_driver',
executable='lslidar_driver_node',
name='lslidar_driver_node',
output='screen',
emulate_tty=True,
namespace='',
parameters=[lidar_dir],
)
twist_mux_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','twist_mux.yaml')
twist_mux = Node(
package="twist_mux",
executable="twist_mux",
parameters=[twist_mux_params, {'use_sim_time': False}],
remappings=[('/cmd_vel_out','/diffbot_base_controller/cmd_vel_unstamped')]
)
return LaunchDescription([
#control_node,
#robot_state_pub_node,
#joint_state_broadcaster_spawner,
#robot_controller_spawner,
#joystick_spawner,
#teleop_spawner,
#cam_node,
#lidar_node,
twist_mux
])