Ask Your Question
0

a std_msgs/ColorRGBA message

asked 2013-01-28 02:46:25 -0600

anycast gravatar image

updated 2013-01-28 06:00:48 -0600

hello everyone

i am just a beginner with ROS system. i am trying to writing a publisher node, which send a colorRGBA message to the subscriber about the topic "visualization_kit".

but it's unable to display the color,here are my codes

int main(int argc, char **argv)
{

  ros::init(argc, argv, "talker");

  ros::NodeHandle n;

  ros::Publisher chatter_pub = n.advertise<std_msgs::ColorRGBA>("chatter", 1000);

  while(ros::ok())
  {
    std_msgs::ColorRGBA color;

    color.r = 255;
    color.g = 0;
    color.b = 0;
    color.a = 1;

    //draw.colors.push_back(color)

    ROS_INFO("%s","visualisation_kit");

    chatter_pub.publish(color);

    ros::spinOnce();
  }

  return 0;
}

thanks for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-01-28 06:05:55 -0600

In your code, you are advertising the messages on the topic "chatter". From your description, it appears you want to publish on the topic "visualisation_kit":

ros::Publisher chatter_pub = n.advertise<std_msgs::ColorRGBA>("visualisation_kit", 1000);

A good tool to debug the input and output topics of your nodes is rosnode. In your case, for example, type this in a console window after executing your "talker" node:

rosnode info talker
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-01-28 02:46:25 -0600

Seen: 1,608 times

Last updated: Jan 28 '13