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

TypeError: the 'package' argument is required to perform a relative import for '.odrive_can.srv' #6

Closed
semyonkozlov opened this issue Jan 11, 2024 · 6 comments

Comments

@semyonkozlov
Copy link

ros2 service call /odrive_axis0/request_axis_state /odrive_can/srv/AxisState "{axis_requested_state: 1}"
Traceback (most recent call last):
  File "/opt/ros/iron/bin/ros2", line 33, in <module>
    sys.exit(load_entry_point('ros2cli==0.25.4', 'console_scripts', 'ros2')())
  File "/opt/ros/iron/lib/python3.10/site-packages/ros2cli/cli.py", line 91, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/iron/lib/python3.10/site-packages/ros2service/command/service.py", line 41, in main
    return extension.main(args=args)
  File "/opt/ros/iron/lib/python3.10/site-packages/ros2service/verb/call.py", line 58, in main
    return requester(
  File "/opt/ros/iron/lib/python3.10/site-packages/ros2service/verb/call.py", line 69, in requester
    module = importlib.import_module('.'.join(parts[:-1]))
  File "/usr/lib/python3.10/importlib/__init__.py", line 121, in import_module
    raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for '.odrive_can.srv'

I was able to launch node, so package is built and setup.bash is sourced. ros2 topic echo and other command are also working correctly.

@semyonkozlov
Copy link
Author

# ros2 service list -t
/odrive_axis0/can_node/describe_parameters [rcl_interfaces/srv/DescribeParameters]
/odrive_axis0/can_node/get_parameter_types [rcl_interfaces/srv/GetParameterTypes]
/odrive_axis0/can_node/get_parameters [rcl_interfaces/srv/GetParameters]
/odrive_axis0/can_node/get_type_description [type_description_interfaces/srv/GetTypeDescription]
/odrive_axis0/can_node/list_parameters [rcl_interfaces/srv/ListParameters]
/odrive_axis0/can_node/set_parameters [rcl_interfaces/srv/SetParameters]
/odrive_axis0/can_node/set_parameters_atomically [rcl_interfaces/srv/SetParametersAtomically]
/odrive_axis0/request_axis_state [odrive_can/srv/AxisState]

mb will be useful

@harborhoffer
Copy link

Seeing the same error when trying to make a service call.

@anthonywebb
Copy link

same here, hoping that @samuelsadok can shed some light

@JesseDarr
Copy link

Hey guys, I think I can help. I checked the command you used against my notes:

ros2 service call /odrive_axis0/request_axis_state /odrive_can/srv/AxisState "{axis_requested_state: 1}" <-- yours

ros2 service call /odrive_axis0/request_axis_state odrive_can/srv/AxisState "{axis_requested_state: 1}" <-- my notes

The only difference is the leading "/" on the odrive_can/srv/AxisState. I confirmed that you're command produces the same error on my setup, but it works without the "/"

@harborhoffer
Copy link

Nice find @JesseDarr! The docs need be updated to remove the forward slash.

@samuelsadok
Copy link
Member

Whoops don't know how that slash got in there but I could confirm that the proposed fix works. Thanks for the pointer! I just updated the docs.

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

5 participants