Skip to content

mavros mav param load failing due to wrong service path #2051

@TannerGilbert

Description

@TannerGilbert

When running ros2 run mavros mav param load -qgc <path-to-file>/px4_external_odometry_parameters.params on ROS 2 Humble I get mavros.base.ServiceWaitTimeout: mavros/get_parameters. I suspect this is due to Mavros now being split into multiple different nodes and no mavros/get_parameters existing anymore.

Full error log:

[ERROR] [1752684107.694969297] [mavpy_2esn]: wait for service time out: {topic}
Traceback (most recent call last):
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/mavros/cmd/__init__.py", line 35, in __getattr__
    return object.__getattribute__(self, key)
AttributeError: 'CliClient' object has no attribute 'uas_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/humble/lib/mavros/mav", line 14, in <module>
    cli()
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/gilbert/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/mavros/cmd/param.py", line 88, in load
    param_file = get_param_file_io(client, file_format, file_)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/mavros/cmd/param.py", line 76, in get_param_file_io
    pf.tgt_system = client.uas_settings.target_system_id
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/mavros/cmd/__init__.py", line 37, in __getattr__
    return getattr(self.cli, key)
  File "/usr/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/mavros/base.py", line 116, in uas_settings
    pd = call_get_parameters(node=self, node_name=self.mavros_ns, names=names)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/mavros/utils.py", line 75, in call_get_parameters
    wait_for_service(client, lg)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/mavros/base.py", line 55, in wait_for_service
    raise ServiceWaitTimeout(topic)
mavros.base.ServiceWaitTimeout: mavros/get_parameters
[ros2run]: Process exited with failure 1

Potential fix

I managed to fix this by adding /mavros_node to the clients in the utils.py file.

+ client = node.create_client(GetParameters, f"{node_name}/mavros_node/get_parameters")
- client = node.create_client(GetParameters, f"{node_name}/get_parameters")

If was unsure of what service would be the correct one as /mavros_node, /mavros and /params all seem to fix the issue for the mav param load call. If the above described fix is the desired solution I can create a PR for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions