@@ -21,6 +21,7 @@ const timeUtils = require('../utils/time_utils.js');
2121const msgUtils = require ( '../utils/message_utils.js' ) ;
2222const EventEmitter = require ( 'events' ) ;
2323let GoalID = null ;
24+ let Header = null ;
2425
2526class ActionClient extends EventEmitter {
2627 constructor ( options ) {
@@ -30,6 +31,10 @@ class ActionClient extends EventEmitter {
3031 GoalID = msgUtils . requireMsgPackage ( 'actionlib_msgs' ) . msg . GoalID ;
3132 }
3233
34+ if ( Header === null ) {
35+ Header = msgUtils . requireMsgPackage ( 'std_msgs' ) . msg . Header ;
36+ }
37+
3338 this . _actionType = options . type ;
3439
3540 this . _actionServer = options . actionServer ;
@@ -103,17 +108,17 @@ class ActionClient extends EventEmitter {
103108
104109 sendGoal ( goal ) {
105110 if ( ! goal . goal_id ) {
106- goal . goal_id = {
107- stamp : timeUtils . now ( ) ,
108- id : this . generateGoalId ( )
109- } ;
111+ goal . goal_id = new GoalID ( {
112+ stamp : timeUtils . now ( ) ,
113+ id : this . generateGoalId ( )
114+ } ) ;
110115 }
111116 if ( ! goal . header ) {
112- goal . header = {
113- seq : this . _goalSeqNum ++ ,
114- stamp : goal . goal_id . stamp ,
115- frame_id : 'auto-generated'
116- } ;
117+ goal . header = new Header ( {
118+ seq : this . _goalSeqNum ++ ,
119+ stamp : goal . goal_id . stamp ,
120+ frame_id : 'auto-generated'
121+ } ) ;
117122 }
118123 const goalId = goal . goal_id . id ;
119124 this . _goals [ goalId ] = goal ;
0 commit comments