Filling the Goal of FollowJointTrajectory in Python
Hi everyone,
I'm using Python to create (for my ros_smach) a connection to the ActionServer "control_msgs/FollowJointTrajectory". To call the function SimpleActionState() I have to specify a goal. I hard-coded this goal1 and tried to pass it through the function call.
# Define the goal for the ActionServer
goal1=FollowJointTrajectoryGoal() #create an empty goal
goal1.trajectory.points[0].positions = [296.82, 294.143, 523.638, -46.3056, 71.3728, -137.832] #define the point position of the goal(hard-coded) !!!This line gives an error saying "IndexError: list index out of range"!!!
# Add a state to the container
smach.StateMachine.add('PTP1',
smach_ros.SimpleActionState('SiliaAction_TrajServer',
FollowJointTrajectoryAction,
goal = goal1
),
transitions={'succeeded':'NextState'})
The problem is this created goal1 does not have an entry called "positions" under goal1.trajectory.points. To be more precise, goal1.trajectory.points is an empty array, which looks like this if I print it out:
trajectory:
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
joint_names: []
points: [] # here it is
path_tolerance: []
goal_tolerance: []
goal_time_tolerance:
secs: 0
nsecs: 0
Is there any method to fill in this goal and pass it on, for example by the time when calling the constructor FollowJointTrajectoryGoal() and fill my desired positions here?
Thank you for your answers!