Skip to content

Commit ef1555e

Browse files
committed
Change test period to reduce test time
Signed-off-by: Alberto Tudela <[email protected]>
1 parent b880da3 commit ef1555e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nav2_docking/opennav_docking/test/test_docking_server.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)