Launching robot_localization with Python api

asked 2017-07-17 14:56:40 -0500

shree gravatar image

I am using python to launch ROS nodes. I can launch the ekf_localization_node, but cannot seem to pass odom data to the node. In all the examples I have found, the parameters such as odom0, sensor_timeout etc. are set in the launch file within the node namespace. How do you do that in Python ? I am currently using the following script:

def load_params_from_yaml(yaml_file_path):
    from rosparam import upload_params
    from yaml import load
    f = open(yaml_file_path, 'r')
    yamlfile = load(f)
    f.close()
    upload_params('/ekf_localization_node', yamlfile)

But, my node cannot find the /odom data. I set the namespace to "/ekf_localization_node" - tried setting it " and '/' and neither of them worked. I can echo the rostopic /odom and see the odom data. I have the following YAML file:

frequency: 30
sensor_timeout: 2.0
two_d_mode: true
transform_time_offset: 0.0
transform_timeout: 0.0
print_diagnostics: true
debug: false 
map_frame: map              # Defaults to "map" if unspecified
odom_frame: odom            # Defaults to "odom" if unspecified
base_link_frame: base_link  # Defaults to "base_link" if unspecified
world_frame: odom           # Defaults to the value of odom_frame if unspecified
odom0: /odom
odom0_config: [true,  true,  false,
           false, false, false,
           false, false, false,
           false, false, true,
           false, false, false]
odom0_queue_size: 2
odom0_nodelay: false
odom0_differential: false
odom0_relative: false
edit retag flag offensive close merge delete

Comments

I'm not clear on what you're doing. Are you starting the node, and then setting its parameters? Have you tried ROS tools like rosnode info to see if it's subscribed correctly? It's hard to debug this, given that it's being launched with your custom code.

Tom Moore gravatar image Tom Moore  ( 2017-09-28 05:49:21 -0500 )edit