Ask Your Question
0

How to know from where to import and the message type?

asked 2016-11-28 20:53:55 -0600

kapoor_amita gravatar image

I am new to ROS, wanted to experiment with publishing and subscribing. The basic codes available are easy to run. Now let us say I have downloaded a package, My_Pkg, in its msg folder there is a file my_msg.msg where they have defined a message by name MSG.

My question is how do i publish or subscribe for this message: The simple statement : pub=rospy.Publisher('topic_name', MSG) Results in error that MSG is not defined. If I import: from My_Pkg.MSG import MSG Still error no module named Console.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-11-28 21:00:35 -0600

kapoor_amita gravatar image

Solved it: First Run rosmsg list, it will list all the messages, choose the one you were looking for so in above case it is simply: from my_pkg.msg import MSG and it works

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

1 follower

Stats

Asked: 2016-11-28 20:53:55 -0600

Seen: 23 times

Last updated: Nov 28 '16