Skip to content

Commit 446c9c6

Browse files
Fix perception.velocity direction bug and perception frequency bug (#14634)
* Fix perception.velocity direction bug The green arrow of obstacle velocity direction doesn't change in the Dreamview because the perception.velocity is not updated in the linear_project_perception function. Here we add a line of code to update the perception.velocity. * fix(tools): modify sleep_time calculation from int to float Modify the default value of period. sleep_time should be float and _s_delta_t should equal to sleep_time fix(tools): change from float(1.0/period) to float(period) squash 8a92f5b fix(tools): change period default value from 10 to 0.1
1 parent 39c3d76 commit 446c9c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/tools/perception/replay_perception.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def linear_project_perception(description, prev_perception):
231231
get_point(trace[i - 1], trace[i], ratio))
232232
perception.theta = math.atan2(trace[i][1] - trace[i - 1][1],
233233
trace[i][0] - trace[i - 1][0])
234-
234+
perception.velocity.CopyFrom(get_velocity(perception.theta, description["speed"]))
235235
perception.ClearField("polygon_point")
236236
perception.polygon_point.extend(generate_polygon(perception.position, perception.theta,
237237
perception.length, perception.width))
@@ -272,9 +272,9 @@ def perception_publisher(perception_channel, files, period):
272272
node = cyber.Node("perception")
273273
writer = node.create_writer(perception_channel, PerceptionObstacles)
274274
perception_description = load_descrptions(files)
275-
sleep_time = int(1.0 / period) # 10Hz
275+
sleep_time = float(period) # 10Hz
276276
global _s_delta_t
277-
_s_delta_t = period
277+
_s_delta_t = sleep_time
278278
perception = None
279279
while not cyber.is_shutdown():
280280
perception = generate_perception(perception_description, perception)

0 commit comments

Comments
 (0)