# Revision history [back]

### What determines the published message on a topic

I made 2 msg file. In one msg file I have 4 variables and in the other I have an array to that message

Files are as follows. This is car.msg

  int32 id
int32 width
float64 height
float64 speed


The second file which is just an array to the cars is as follows. cardata.msg

  car[] mycars


I am opening a master node in one terminal and then I am launching another node in another terminal then through rostopic echo /topic_name I am publishing data.

I want to know what determines the data published. I have succeeded in publishing data which is like this:

id: 21
width: 1
height: 1.05549145701
speed: 0.385172053253

id: 22
width: 1
height: 1.057
speed: 0.394


and it keeps on going recursively for till id =50. id starts from zero till 50.

I want to publish this data only when my id is an even number so in this case the id=21 will not be published. How can I do that. Which files determine what is being published. msg file generated .h files and other files. I have tried to change the .h files (car.h and cardata.h in my case) to change the output but it does not work. The same message is published. Can you tell me how can I change this?

 2 retagged tfoote 52821 ●101 ●362 ●453 http://www.ros.org/

### What determines the published message on a topic

I made 2 msg file. In one msg file I have 4 variables and in the other I have an array to that message

Files are as follows. This is car.msg

  int32 id
int32 width
float64 height
float64 speed


The second file which is just an array to the cars is as follows. cardata.msg

  car[] mycars


I am opening a master node in one terminal and then I am launching another node in another terminal then through rostopic echo /topic_name I am publishing data.

I want to know what determines the data published. I have succeeded in publishing data which is like this:

id: 21
width: 1
height: 1.05549145701
speed: 0.385172053253

id: 22
width: 1
height: 1.057
speed: 0.394


and it keeps on going recursively for till id =50. id starts from zero till 50.

I want to publish this data only when my id is an even number so in this case the id=21 will not be published. How can I do that. Which files determine what is being published. msg file generated .h files and other files. I have tried to change the .h files (car.h and cardata.h in my case) to change the output but it does not work. The same message is published. Can you tell me how can I change this?

 3 retagged

### What determines the published message on a topic

I made 2 msg file. In one msg file I have 4 variables and in the other I have an array to that message

Files are as follows. This is car.msg

  int32 id
int32 width
float64 height
float64 speed


The second file which is just an array to the cars is as follows. cardata.msg

  car[] mycars


I am opening a master node in one terminal and then I am launching another node in another terminal then through rostopic echo /topic_name I am publishing data.

I want to know what determines the data published. I have succeeded in publishing data which is like this:

id: 21
width: 1
height: 1.05549145701
speed: 0.385172053253

id: 22
width: 1
height: 1.057
speed: 0.394


and it keeps on going recursively for till id =50. id starts from zero till 50.

I want to publish this data only when my id is an even number so in this case the id=21 will not be published. How can I do that. Which files determine what is being published. msg file generated .h files and other files. I have tried to change the .h files (car.h and cardata.h in my case) to change the output but it does not work. The same message is published. Can you tell me how can I change this?

 4 retagged

### What determines the published message on a topic

I made 2 msg file. In one msg file I have 4 variables and in the other I have an array to that message

Files are as follows. This is car.msg

  int32 id
int32 width
float64 height
float64 speed


The second file which is just an array to the cars is as follows. cardata.msg

  car[] mycars


I am opening a master node in one terminal and then I am launching another node in another terminal then through rostopic echo /topic_name I am publishing data.

I want to know what determines the data published. I have succeeded in publishing data which is like this:

id: 21
width: 1
height: 1.05549145701
speed: 0.385172053253

id: 22
width: 1
height: 1.057
speed: 0.394


and it keeps on going recursively for till id =50. id starts from zero till 50.

I want to publish this data only when my id is an even number so in this case the id=21 will not be published. How can I do that. Which files determine what is being published. msg file generated .h files and other files. I have tried to change the .h files (car.h and cardata.h in my case) to change the output but it does not work. The same message is published. Can you tell me how can I change this?

 5 retagged

### What determines the published message on a topic

I made 2 msg file. In one msg file I have 4 variables and in the other I have an array to that message

Files are as follows. This is car.msg

  int32 id
int32 width
float64 height
float64 speed


The second file which is just an array to the cars is as follows. cardata.msg

  car[] mycars


I am opening a master node in one terminal and then I am launching another node in another terminal then through rostopic echo /topic_name I am publishing data.

I want to know what determines the data published. I have succeeded in publishing data which is like this:

id: 21
width: 1
height: 1.05549145701
speed: 0.385172053253

id: 22
width: 1
height: 1.057
speed: 0.394


and it keeps on going recursively for till id =50. id starts from zero till 50.

I want to publish this data only when my id is an even number so in this case the id=21 will not be published. How can I do that. Which files determine what is being published. msg file generated .h files and other files. I have tried to change the .h files (car.h and cardata.h in my case) to change the output but it does not work. The same message is published. Can you tell me how can I change this?

 6 retagged

### What determines the published message on a topic

I made 2 msg file. In one msg file I have 4 variables and in the other I have an array to that message

Files are as follows. This is car.msg

  int32 id
int32 width
float64 height
float64 speed


The second file which is just an array to the cars is as follows. cardata.msg

  car[] mycars


I am opening a master node in one terminal and then I am launching another node in another terminal then through rostopic echo /topic_name I am publishing data.

I want to know what determines the data published. I have succeeded in publishing data which is like this:

id: 21
width: 1
height: 1.05549145701
speed: 0.385172053253

id: 22
width: 1
height: 1.057
speed: 0.394


and it keeps on going recursively for till id =50. id starts from zero till 50.

I want to publish this data only when my id is an even number so in this case the id=21 will not be published. How can I do that. Which files determine what is being published. msg file generated .h files and other files. I have tried to change the .h files (car.h and cardata.h in my case) to change the output but it does not work. The same message is published. Can you tell me how can I change this?