Skip to content

Commit

Permalink
avoid unstable LaserScan status for rviz2 (#614)
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
  • Loading branch information
Chen Lihui authored May 8, 2023
1 parent 7275613 commit 83046c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dummy_robot/dummy_sensors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ros2 run dummy_sensors dummy_laser
# Terminal Output
[INFO] [1658564972.776089023] [dummy_laser]: angle inc: 0.004363
[INFO] [1658564972.776138078] [dummy_laser]: scan size: 1081
[INFO] [1658564972.776148752] [dummy_laser]: scan time increment: 0.000028
[INFO] [1658564972.776148752] [dummy_laser]: scan time increment: 0.000000
```

### **2 - dummy_joint_states**
Expand Down
5 changes: 3 additions & 2 deletions dummy_robot/dummy_sensors/src/dummy_laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ int main(int argc, char * argv[])
}
msg.ranges.resize(static_cast<int>(num_values));

msg.time_increment =
static_cast<float>((angle_resolution / 10000.0) / 360.0 / (scan_frequency / 100.0));
// Set `time_increment` with 0 to avoid unstable status shown in the `LaserScan` display of rviz2
// while looking up transform with a forward time value.
msg.time_increment = 0.0f;
msg.angle_increment = static_cast<float>(angle_resolution / 10000.0 * DEG2RAD);
msg.angle_min = static_cast<float>(start_angle / 10000.0 * DEG2RAD - M_PI / 2);
msg.angle_max = static_cast<float>(stop_angle / 10000.0 * DEG2RAD - M_PI / 2);
Expand Down

0 comments on commit 83046c2

Please sign in to comment.