Robotics StackExchange | Archived questions

Does anyone have tips/examples getting a rosserial_windows publisher in a class?

I can get things working in main and/or using global functions but can't seem to get things working as a member of a class. I am not sure how to initialize the member variables for NodeHandle and Publisher and not totally who should be calling spin (i.e., the class via some callback or the parent function/class that owns the class with said publisher). This particular stack seems dangerous with respect to assumptions regarding ros APIs (vs their native counterparts).

Thanks, Brett

Asked by BrettHemes on 2019-01-22 19:54:05 UTC

Comments

There shouldn't be too much difference between all the variants you describe.

Can you perhaps show some MWE that doesn't work, and something that does?

Asked by gvdhoorn on 2019-01-23 03:34:33 UTC

This particular stack seems dangerous with respect to assumptions regarding ros APIs (vs their native counterparts).

I'm not sure what you mean by that: rosserial has always been different wrt control flow compared to roscpp.

Asked by gvdhoorn on 2019-01-23 03:35:14 UTC

I have never used it before... Regardless, some design choices seem lacking... lots of c strings and passing by pointers with seemingly shallow copies. Understandable I guess for some of the ports but Windows has much better options.

Asked by BrettHemes on 2019-01-23 13:27:10 UTC

One problem I figured out was that I was getting segfaults as my variables I used to initialize everything went out of scope. Additionally the socket would close if I didn't spin frequently enough.

Asked by BrettHemes on 2019-01-23 13:28:48 UTC

As I was initializing other hardware after ros::NodeHandle::initNode() I would get error messages on the next spin call if I took more than a second or two max... these are all hard things to catch and not obvious or documented...

Asked by BrettHemes on 2019-01-23 13:29:38 UTC

rosserial_windows is an almost direct port of rosserial for the embedded and microcontroller platforms. That's where all the raw pointers, c strings and other "strangeness" comes from.

I guess people either accept it or use rosbridge_suite or the recent Windows 10 port.

Asked by gvdhoorn on 2019-01-23 15:44:41 UTC

Can you comment on any significnat performances between rosserial and rosbridge_suite?

Asked by BrettHemes on 2019-01-23 17:29:47 UTC

Protocols are rather different, so I'm not sure I can.

rosserial is typically used with low-end hw, while rosbridge_suite is typically used for low-bandwidth integration of higher-level applications (ie: UIs, web-apps).

If you can say something about what sort of integration you're ..

Asked by gvdhoorn on 2019-01-24 04:02:12 UTC

.. looking for, perhaps we can suggest some approaches that might work.

Asked by gvdhoorn on 2019-01-24 04:02:30 UTC

Answers