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

Localisation not happening #1842

Open
sidhjeya opened this issue Nov 28, 2024 · 0 comments
Open

Localisation not happening #1842

sidhjeya opened this issue Nov 28, 2024 · 0 comments

Comments

@sidhjeya
Copy link

sidhjeya commented Nov 28, 2024

I have been trying to localise the robot using ros cartogrpaher .
below are my configurations

robot.lua

include "map_builder.lua"
include "trajectory_builder.lua"

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "base_link",
  published_frame = "base_footprint",
  odom_frame = "odom",
  provide_odom_frame = true,
  publish_frame_projected_to_2d = false,
  use_pose_extrapolator = true,
  use_odometry = false,
  use_nav_sat = false,
  use_landmarks = false,
  num_laser_scans = 1,
  num_multi_echo_laser_scans = 0,
  num_subdivisions_per_laser_scan = 10,
  num_point_clouds = 0,
  lookup_transform_timeout_sec = 0.2,
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 5e-3,
  trajectory_publish_period_sec = 30e-3,
  rangefinder_sampling_ratio = 1.,
  odometry_sampling_ratio = 1.,
  fixed_frame_pose_sampling_ratio = 1.,
  imu_sampling_ratio = 1.,
  landmarks_sampling_ratio = 1.,
}

MAP_BUILDER.use_trajectory_builder_2d = true
TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 10

return options

sid.lua

include "ROBOT.lua"

TRAJECTORY_BUILDER.pure_localization_trimmer = {
  max_submaps_to_keep = 3,
}
POSE_GRAPH.optimize_every_n_nodes = 20

return options

My launch file to launch cartographer localisation

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, ExecuteProcess
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
import os

def generate_launch_description():
    # Arguments
    load_state_filename = LaunchConfiguration('load_state_filename')
    use_sim_time = LaunchConfiguration('use_sim_time', default='false')

    # Package Share Directory
    pkg_share = FindPackageShare('cartographer_ros').find('cartographer_ros')
    configuration_dir = os.path.join(pkg_share, 'configuration_files')

    # Nodes
    cartographer_node = Node(
        package='cartographer_ros',
        executable='cartographer_node',
        parameters=[{'use_sim_time': use_sim_time}],
        arguments=[
            '-configuration_directory', configuration_dir,
            '-configuration_basename', 'sid_localization.lua',
            '-load_state_filename', load_state_filename
        ],
        # remappings=[
        #         ('/scan', '/scan'),
        #         ('/odom', '/odom'),
        #         ('/imu', '/imu'),
        #     ],
        output='screen',
    )

    occupancy_grid_node = Node(
        package='cartographer_ros',
        executable='cartographer_occupancy_grid_node',
        parameters=[{'use_sim_time': use_sim_time},{'resolution': 0.05}],
        output='screen',
    )

    return LaunchDescription([
        DeclareLaunchArgument('load_state_filename'),
        DeclareLaunchArgument('use_sim_time', default_value='false'),
        cartographer_node,
        occupancy_grid_node,
    ])


RQT_grpah for my robot
carto

tf's of my robot
Uploading git.pdf…

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

No branches or pull requests

1 participant