Importing custom messages from other packages in Python
Hi all, I've been on this for hours now and I can't figure it out. It seems as if not this forum or the tutorials have a solution for this simple question.
I have downloaded the Vesc stack here, without the vesc_ackerman
package.
It all builds nicely with the addition of the serial library, and even connects to the device and publishes topics stated in vesc_msgs
. You can rostopic echo
them, you can rosmsg list
them (VescState
and VescStateStamped
).
Now, what I am trying to do is to use these messages in another package, so that I can manipulate it.
I have a standard python node code, but it starts with: #import rospy
, then #import VescState.msg
(or from VescState import XXX
) , and continues on (If any1 can point me on how to paste the code here without having only the first line as code format and everything else outside, plus hash-tags making the font huge, i'de love that...). I could go on but it doesnt really matter, because all I get when I try to run the code is:
Traceback (most recent call last):
File "/home/tim/catkin_ws/src/vesc_comm/src/vesc_comm.py", line 5, in <module>
from VescState.msg import *
ImportError: No module named VescState.msg
I have tried every conceivable way of doing this. i have tried to rename the message files, adding them as native messages to my package, including all the package.xml
and cmakelists.txt
additions just to make a sanity check. tried catkin_make install
. none of it worked.
I actually do not want to make these messages native anyway. what I do want is to get my vesc_comm.py
script to recognize the VescState.msg
file from the other package (again - the messages work with the vesc_driver
node and are listed in rosmsg
!).
Why can I use every single message offered by ROS (std
, geometry
, pointcloud2
...) but get the error stated above when I try and use a custom message?? my ROS is just not recognizing it. what am I doing wrong?
Thanks in advance, Steve
copy-paste code, select lines, press
ctrl+k
or click the Preformatted Code button (the one with101010
on it).Thank you! i was clicking the icon first and then tried to paste code instead of "enter code here". wasnt working.