You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to add the remap args for tf to the ros2 package. We want to test this software in a multi-robot system, but for that we need to remap the tf topics e.g.
from launch import LaunchDescription
from launch.substitutions import TextSubstitution
from launch.substitutions import LaunchConfiguration
from launch.conditions import IfCondition
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.actions import SetEnvironmentVariable
from ament_index_python import get_package_share_directory
import os
def generate_launch_description():
nsp = os.environ.get('ROBOT_NS', #'husky_0986')
rmp = [
('/path', 'gps'),
('/tf', 'tf'),
('/tf_static', 'tf_static'),
]
# lidar_topic = '/'+nsp+'/livox/lidar'
lidar_topic = '/livox/lidar'
myDir = get_package_share_directory("mola_lidar_odometry")
# Mandatory
lidar_topic_name_arg = DeclareLaunchArgument(
"lidar_topic_name", default_value=lidar_topic, description="Topic name to listen for PointCloud2 input from the LiDAR (for example '/ouster/points')")
topic_env_var = SetEnvironmentVariable(
name='MOLA_LIDAR_TOPIC', value=LaunchConfiguration('lidar_topic_name'))
# ~~~~~~~~~~~~
ignore_lidar_pose_from_tf_arg = DeclareLaunchArgument(
"ignore_lidar_pose_from_tf", default_value="True", description="If true, the LiDAR pose will be assumed to be at the origin (base_link). Set to false (default) if you want to read the actual sensor pose from /tf")
fixed_sensorpose_env_var = SetEnvironmentVariable(
name='MOLA_USE_FIXED_LIDAR_POSE', value=LaunchConfiguration('ignore_lidar_pose_from_tf'))
# ~~~~~~~~~~~~
gnss_topic_name_arg = DeclareLaunchArgument(
"gnss_topic_name", default_value="/gps", description="Topic name to listen for NavSatFix input from a GNSS (for example '/gps')")
gps_topic_env_var = SetEnvironmentVariable(
name='MOLA_GNSS_TOPIC', value=LaunchConfiguration('gnss_topic_name'))
# ~~~~~~~~~~~~
use_rviz = LaunchConfiguration('use_rviz')
use_rviz_arg = DeclareLaunchArgument(
"use_rviz", default_value="True", description="Whether to launch RViz2 with default lidar-odometry.rviz configuration")
# -------------------# Node# -------------------
mola_cli_node = Node(
namespace=nsp,
remappings=rmp,
package='mola_launcher',
executable='mola-cli',
output='screen',
arguments=[
os.path.join(myDir, 'mola-cli-launchs', 'lidar_odometry_ros2.yaml')],
)
rviz2_node = Node(
condition=IfCondition(use_rviz),
# namespace=nsp,# remappings=rmp,
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=[
'-d', [os.path.join(myDir, 'rviz2', 'lidar-odometry.rviz')]]
)
ld =LaunchDescription()
ld.add_action(lidar_topic_name_arg)
ld.add_action(topic_env_var)
ld.add_action(ignore_lidar_pose_from_tf_arg)
ld.add_action(fixed_sensorpose_env_var)
ld.add_action(gnss_topic_name_arg)
ld.add_action(gps_topic_env_var)
ld.add_action(use_rviz_arg)
# ld.add_action(rviz2_node)
ld.add_action(mola_cli_node)
return ld
The text was updated successfully, but these errors were encountered:
Feedback would be appreciated. It's already tested on simulation, but we can't test yet on our Husky since it's in the middle of upgrading it to ROS 2 (!).
PS: It requires doing "git pull" and rebuilding two repos: MOLAorg/{mola,mola_lidar_odometry}
Dear Mola Team,
Would it be possible to add the remap args for tf to the ros2 package. We want to test this software in a multi-robot system, but for that we need to remap the tf topics e.g.
The text was updated successfully, but these errors were encountered: