I’m trying to import the FollowJointTrajectory action message to use in an action server. I have the following line in my Python script, but on running it, I get the error that the control_msgs.action module cannot be found. from control_msgs.action import FollowJointTrajectory
Some things I have looked into: ros2 interface list | grep Follow: locate control_msgs | grep galactic | grep FollowJointTrajectory shows no .h or .py files:
Hi @rzegers , thanks for your response. Below is the result you requested. It can’t find the module.
Here are some more things that might be useful in this investigation.
Output of which python3:
Output of echo $PYTHONPATH is as follows. base_ws is my ros2 workspace.
Result of importing rclpy which imports fine:
Result of locate control_msgs | grep galactic | grep follow is as follows. I notice a py file there. However, it is _follow_joint_trajectory.py instead of FollowJointTrajectory.py. I’ve tried importing this too but, of course, I get stuck on the control_msgs.action module not being found.
@rzegers, on further investigation, I noticed as I jumped to definition from the control_msgs.action import line, it was taking me to a noetic directory. This mix-up is also evident in the PYTHONPATH variable. Removing the noetic and ROS1 paths from PYTHONPATH, resolved this issue. However, I’ve run into another related problem now. I get the following runtime error regarding the action server initialization when using the FollowJointTrajectory action. However, if I replace FollowJointTrajectory with Fibonacci then, initialization works, i.e. I see the “After initializing arm action server” message printed. Do you have any insights about this?
Hi @cjans121, I am glad that you got your issue solved. I have to admit that I wouldn’t have thought that you had two ROS versions installed on your system.
From the error message that you posted this part here caught my attention:
AttributeError: type object 'type' has no attribute '_TYPE_SUPPORT' This might be a ROS 1 message type but it should be a ROS 2 message type. Make sure ...
As you see that message is cut on the screenshot I think the key part is missing as this is how that message normally continues:
Make sure to source your ROS 2 workspace after your ROS 1 workspace.
Any chance you could work on a system that only has one version of ROS2 installed? Things can really get messed up, and that way, you could rule out any errors caused by this. Personally, I haven’t worked on systems that have two versions installed, so it’s outside my area of expertise at the moment and I can’t really help you much there. However, if you encounter any issues on a pure ROS2 system, I’d be happy to help you troubleshoot.
Hi @rzegers , unfortunately, I need both ROS and ROS2 in my system at the moment. I appreciate your support so far. I’ll post an update here if I figure anything out.