@@ -109,6 +109,7 @@ def tearDownClass(cls) -> None:
109109
110110 def setUp (self ) -> None :
111111 # Create a ROS node for tests
112+ self .period = 0.15 # 30Hz
112113 # Latest odom -> base_link
113114 self .x = 0.0
114115 self .y = 0.0
@@ -131,10 +132,9 @@ def command_velocity_callback(self, msg: TwistStamped) -> None:
131132
132133 def timer_callback (self ) -> None :
133134 # Propagate command
134- period = 0.05
135- self .x += cos (self .theta ) * self .command .linear .x * period
136- self .y += sin (self .theta ) * self .command .linear .x * period
137- self .theta += self .command .angular .z * period
135+ self .x += cos (self .theta ) * self .command .linear .x * self .period
136+ self .y += sin (self .theta ) * self .command .linear .x * self .period
137+ self .theta += self .command .angular .z * self .period
138138 self .node .get_logger ().info (f'Pose: { self .x :f} { self .y :f} { self .theta :f} ' )
139139 # Need to publish updated TF
140140 self .publish ()
@@ -173,8 +173,8 @@ def nav_execute_callback(
173173 NavigateToPose .Result , NavigateToPose .Feedback ]
174174 ) -> NavigateToPose .Result :
175175 goal = goal_handle .request
176- self .x = goal .pose .pose .position .x - 0.05
177- self .y = goal .pose .pose .position .y + 0.05
176+ self .x = goal .pose .pose .position .x - self . period
177+ self .y = goal .pose .pose .position .y + self . period
178178 self .theta = 2.0 * acos (goal .pose .pose .orientation .w )
179179 self .node .get_logger ().info (f'Navigating to { self .x :f} { self .y :f} { self .theta :f} ' )
180180 goal_handle .succeed ()
@@ -190,7 +190,7 @@ def test_docking_server(self) -> None:
190190 self .tf_broadcaster = TransformBroadcaster (self .node )
191191
192192 # Create a timer to run "control loop" at 20hz
193- self .timer = self .node .create_timer (0.05 , self .timer_callback )
193+ self .timer = self .node .create_timer (0.033 , self .timer_callback )
194194
195195 # Create action client
196196 self .dock_action_client = ActionClient (self .node , DockRobot , 'dock_robot' )
0 commit comments