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

asked 2019-01-22 18:54:05 -0500

BrettHemes gravatar image

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

edit retag flag offensive close merge delete

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?

gvdhoorn gravatar imagegvdhoorn ( 2019-01-23 02:34:33 -0500 )edit

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.

gvdhoorn gravatar imagegvdhoorn ( 2019-01-23 02:35:14 -0500 )edit

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.

BrettHemes gravatar imageBrettHemes ( 2019-01-23 12:27:10 -0500 )edit

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.

BrettHemes gravatar imageBrettHemes ( 2019-01-23 12:28:48 -0500 )edit

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...

BrettHemes gravatar imageBrettHemes ( 2019-01-23 12:29:38 -0500 )edit

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.

gvdhoorn gravatar imagegvdhoorn ( 2019-01-23 14:44:41 -0500 )edit

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

BrettHemes gravatar imageBrettHemes ( 2019-01-23 16:29:47 -0500 )edit

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 ..

gvdhoorn gravatar imagegvdhoorn ( 2019-01-24 03:02:12 -0500 )edit