@@ -109,6 +109,7 @@ def tearDownClass(cls) -> None:
109
109
110
110
def setUp (self ) -> None :
111
111
# Create a ROS node for tests
112
+ self .period = 0.15 # 30Hz
112
113
# Latest odom -> base_link
113
114
self .x = 0.0
114
115
self .y = 0.0
@@ -131,10 +132,9 @@ def command_velocity_callback(self, msg: TwistStamped) -> None:
131
132
132
133
def timer_callback (self ) -> None :
133
134
# 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
138
138
self .node .get_logger ().info (f'Pose: { self .x :f} { self .y :f} { self .theta :f} ' )
139
139
# Need to publish updated TF
140
140
self .publish ()
@@ -173,8 +173,8 @@ def nav_execute_callback(
173
173
NavigateToPose .Result , NavigateToPose .Feedback ]
174
174
) -> NavigateToPose .Result :
175
175
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
178
178
self .theta = 2.0 * acos (goal .pose .pose .orientation .w )
179
179
self .node .get_logger ().info (f'Navigating to { self .x :f} { self .y :f} { self .theta :f} ' )
180
180
goal_handle .succeed ()
@@ -190,7 +190,7 @@ def test_docking_server(self) -> None:
190
190
self .tf_broadcaster = TransformBroadcaster (self .node )
191
191
192
192
# 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 )
194
194
195
195
# Create action client
196
196
self .dock_action_client = ActionClient (self .node , DockRobot , 'dock_robot' )
0 commit comments