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

ROS2: Cannot set/publish JointState with user-specified values #34

Closed
kschwan opened this issue Sep 21, 2022 · 7 comments
Closed

ROS2: Cannot set/publish JointState with user-specified values #34

kschwan opened this issue Sep 21, 2022 · 7 comments

Comments

@kschwan
Copy link

kschwan commented Sep 21, 2022

Hi,
On Ubuntu 22.04 with ROS2 Humble I'm unable to publish sensor_msgs/msg/JointState with user-specified values. I suppose this might be related to #27, #28.

This is what I'm publishing:
Screenshot from 2022-09-21 14-29-53

And this is what I'm receiving (note that the std_msgs/msg/Bool seems to be working).

$ ros2 topic echo --once /test
header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
name: []
position: []
velocity: []
effort: []
---
$ ros2 topic echo --once /test2
data: true
---

Package version:

$ apt show ros-humble-rqt-publisher 
Package: ros-humble-rqt-publisher
Version: 1.5.0-1jammy.20220909.020605
Priority: optional
Section: misc
Maintainer: Dirk Thomas <[email protected]>
Installed-Size: 109 kB
Depends: python3-catkin-pkg-modules, ros-humble-python-qt-binding (>= 0.2.19), ros-humble-qt-gui-py-common, ros-humble-rqt-gui, ros-humble-rqt-gui-py, ros-humble-rqt-py-common, ros-humble-ros-workspace
Homepage: http://wiki.ros.org/rqt_publisher
Download-Size: 23.8 kB
APT-Manual-Installed: no
APT-Sources: http://packages.ros.org/ros2/ubuntu jammy/main amd64 Packages
Description: rqt_publisher provides a GUI plugin for publishing arbitrary messages with fixed or computed field values.
@kschwan
Copy link
Author

kschwan commented Sep 21, 2022

It turns out I hadn't noticed that I was getting this error from rqt_publisher

[ERROR] [1663763988.089399671] [get_message_class]: Malformed message_type: sequence<string>
Traceback (most recent call last):
  File "/opt/ros/humble/lib/python3.10/site-packages/rqt_publisher/publisher.py", line 161, in change_publisher
    new_text = handler(self._publishers[publisher_id], topic_name, new_value)
  File "/opt/ros/humble/lib/python3.10/site-packages/rqt_publisher/publisher.py", line 244, in _change_publisher_expression
    success, _ = self._evaluate_expression(expression, slot_type)
  File "/opt/ros/humble/lib/python3.10/site-packages/rqt_publisher/publisher.py", line 329, in _evaluate_expression
    if successful_eval and isinstance(value, slot_type):
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

@gbiggs
Copy link
Contributor

gbiggs commented Sep 28, 2022

Could you try Rolling and see if the same bug is present there as well?

@kschwan
Copy link
Author

kschwan commented Sep 29, 2022

Could you try Rolling and see if the same bug is present there as well?

Sure! Thanks for the suggestion.

If I type in a list in the position expression, I get the error shown below. If I type in an array.array (fx array('d', [123])), it works. The sequence<double> type is a bit misleading though.

Publisher._evaluate_expression(): failed to evaluate expression: "[123]" as Python type "<class 'array.array'>

Screenshot from 2022-09-29 09-56-22

@gbiggs
Copy link
Contributor

gbiggs commented Oct 4, 2022

Are you happy with that solution?

@kschwan
Copy link
Author

kschwan commented Oct 5, 2022

Are you happy with that solution?

Yes, I'm fine using rolling and typing in an array.array, thanks! It would be nice if typing in a list would work too though -- that's how it was on ROS1.

@clalancette
Copy link
Contributor

Yes, I'm fine using rolling and typing in an array.array, thanks! It would be nice if typing in a list would work too though -- that's how it was on ROS1.

Yeah, I agree, that would be much nicer. I did some work on this earlier this year, but I never got it completed. Hopefully I can find some time to complete that.

That said, this is similar in spirit to #23. @gbiggs I'm not sure if you want to close #23 (since technically that one works now) and leave this one open, or vice-versa. Either is fine with me.

@gbiggs
Copy link
Contributor

gbiggs commented Oct 5, 2022

I'll close this one, since the other looks like it still has proposed changes that haven't been PR'd.

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

3 participants