I noticed that in the notebook, it says the message of an action server is divided into three parts: the goal, the result, and the feedback. While on the 4.11 a, the python code only imports feedback, result, and action. When using the $ rosmsg show actionlib_tutorials/FibonacciAction, it contains a goal parameter.
When I check the goal message using the command $ rosmsg show actionlib_tutorials/FibonacciGoal, I have the same message type. Is that means if I already import the FibonacciAction, then I don’t have to include FibonacciGoal or Why in 4.11 a the code doesn’t import the Goal?
checking out the generated messages can help in understanding the structure. To do this go here:
Here you can see that the FibonacciAction message contains the goal, feedback and result. When creating a server like this:
# creates the action server
self._as = actionlib.SimpleActionServer("fibonacci_as", FibonacciAction, self.goal_callback, False)
you have to use the nameAction message, as it contains the whole structure of actionlib, which includes the cancel and status topics, actionlib creates.
Hope that makes it a bit more clear
Is that means once I import the Action, I don’t have to import Goal later?
For example, in exercise4.6
I can also do in this way without importing ActionGoal right?
You have to import everything you are using directly in your code. So if you define
goal = ArdroneGoal()
then you have to import ArdroneGoal. This goes for everything in Python and ROS. The only exception are native Python formats. Some other examples:
from geometry_msgs.msg import Pose
from sensor_msgs.msg import JointState
from numpy import array
robot_pose = Pose()
joint_state = JointState()
arr = array([1,2,3])
When creating the action server, you using the FibonacciAction directly in your code, but not the goal, so you dont have to define it. On the client side however, you are using the goal directly, so you have to import it. Hope that helps