Why do I get unresolved reference while trying to import joint_state_listener.srv for my custom control plugin using python interpreter ?

asked 2019-06-22 14:16:34 -0500

microbot gravatar image

updated 2023-06-18 09:49:42 -0500

lucasw gravatar image

I have been trying to develop a custom control plugin as a part of my academic project. I am quite new to ROS. I am writing the plugin in python interpreter using Pycharm IDE. While trying to import joint_state_listener, I have been having unresolved reference. The syntax I am using exactly is

from joint_states_listener.srv import *

I have been having the same error while importing osrf_msgs.msg and the syntax for it as follows,

from osrf_msgs.msg import JointCommand

can anyone please help me point out where I am doing wrong ? Thanks in advance

edit:

the sample code where I am trying to import joint_states-listener is

    import roslib
    roslib.load_manifest('joint_states_listener')
   from joint_states_listener.srv import *
   from joint_States_listener.srv import ReturnJointStates

   def return_joint_states(self, req):
    joints_found = []
    positions = []
    velocities = []
    efforts = []
    for joint_name in req.name:
        (found, position, velocity, effort)=self.return_joint_state(joint_name)
        joints_found.append(found)
        positions.append(position)
        velocities.append(velocity)
        efforts.append(effort)
    return ReturnJointStatesResponse(joints_found, positions, velocities, efforts)

Here is the error ,

Traceback (most recent call last):
File "/home/microbot/catkin_ws/src/spider/spider_control/control.py", line 16, in <module>
from joint_states_listener.srv import *
ModuleNotFoundError: No module named 'joint_states_listener'
edit retag flag offensive close merge delete

Comments

Could you please update your question with a copy and paste of the error and your code

jayess gravatar image jayess  ( 2019-06-22 18:30:38 -0500 )edit

from osrf_msgs.msg import JointCommands from joint_states_listener.srv import *

These are the import statements I used. I haven't run the code. although I have been using pycharm IDE and after the pycharm's code inspection, it has underlined these two lines with red and the error displayed as follows: unresolved reference in osrf_msgs.msg, unresolved reference in JointCommands unresolved reference in joint_states_listener.srv

Because of this I was unable to call ReturnJointStatesResponse() function. Kindly please point me into what's causing this error. I am using ROS-kinetic in xenial and python 2.7 interpreter

microbot gravatar image microbot  ( 2019-06-24 10:33:36 -0500 )edit