unable to import rospy
I am new to ros and currently doing the wiki tutorials of ros. I am using docker on Mac m1. this is the code that I used on vscode. I did catkin_make
and source devel/setup.bash
and it showed no error.
#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
def talker():
pub = rospy.Publisher('chatter', String, queue_size=10)
rospy.init_node('talker', anonymous=True)
rate = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
hello_str = "hello world %s" % rospy.get_time()
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass
but on vscode it shows
Import "rospy" could not be resolved
the files for rospy and std_masgs.msg are both available on docker image under the folder of python3. any help is appreciated
Asked by mayank sethia on 2023-06-24 00:24:41 UTC
Comments