ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to change the topic_name string to PROGMEM in rosserial_arduino?

asked 2015-08-24 14:14:26 -0500

mh.phoenix gravatar image


I'm trying to save SRAM on my Arduino pro mini by going through some libraries. I've noticed that to use my Arduino as a ROS node the library stores the topic name and message type as constants.

class Publisher
  Publisher( const char * topic_name, Msg * msg, int    endpoint=rosserial_msgs::TopicInfo::ID_PUBLISHER) :
    endpoint_(endpoint) {};

  int publish( const Msg * msg ) { return nh_->publish(id_, msg); };
  int getEndpointType(){ return endpoint_; }

  const char * topic_;
  Msg *msg_;
  // id_ and no_ are set by NodeHandle when we advertise 
  int id_;
  NodeHandleBase_* nh_;

  int endpoint_;

How can I store the constants to PROGMEM? As these are pointers, I am confused. Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-25 03:47:29 -0500

Wolf gravatar image

The current state of rosserial does not support PROGMEM usage. However, I implemented a rosserial version that supports PROGMEM usage. You can check it out from my fork of the rosserial repo on github:

For usage see this example:

edit flag offensive delete link more

Question Tools


Asked: 2015-08-24 14:14:26 -0500

Seen: 212 times

Last updated: Aug 25 '15