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

How to change the topic_name string to PROGMEM in rosserial_arduino?

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

mh.phoenix gravatar image

Hello,

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
{
public:
  Publisher( const char * topic_name, Msg * msg, int    endpoint=rosserial_msgs::TopicInfo::ID_PUBLISHER) :
    topic_(topic_name), 
    msg_(msg),
    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_;

private:
  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
0

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:

https://github.com/strothmw/rosserial

For usage see this example:

https://github.com/strothmw/rosserial...

edit flag offensive delete link more

Question Tools

Stats

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

Seen: 212 times

Last updated: Aug 25 '15