So i'm watching the following tutorial series :https://www.youtube.com/watch?v=o0difVe6GOw&list=PLAjUtIp46jDcQb-MgFLpGqskm9iB5xfoP&index=7
And in the 7th video(time 2:15) Im trying to import an srv file from a different folder in my service_server_node.py file. in my import in the line tutorials.srv im getting the error Import "tutorials.srv" could not be resolved Pylance
And i have the following code in my service_server_node.py file:
#!/usr/bin/env python
import rospy
from tutorials.srv import multiplier, multiplierResponse
def callback(request):
return multiplierResponse(request.a * request.b)
def multiply():
rospy.init_node("multiplier_service")
service = rospy.Service("multiplier", multiplier, callback)
rospy.spin()
if __name__ == '__main__':
multiply()
I tried searching on the web but none of the things that i found worked. e.g. select interpreter etc
my projects file structure is the following:
tutorials
├── srv
│ └── multiplier.srv
└── scripts
├── publisher_node.py
├── subscriber_node.py
└── service_server_node.py
I'm new to ROS and python so if i can help by providing more information, please tell me.
Looking at your directory structure, you don't actually have a
tutorials.srv
file; instead you havemultiplier.srv
. Because of this the correct import should look like