-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TimePanel port #599
TimePanel port #599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying out this PR, when I start RViz, without any persistent RViz config, no panels are loaded and the render window doesn't appear. I'm on Ubuntu Focal.
I'm not sure where the bug is. Does this work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with CI and @jacobperron's issue addressed
I didn't test it locally.
@jacobperron @wjwwood Thanks for the review. I tested it again and have the same bug that panels are not loaded. The problem is that the QMainWindow State needs to be updated too. If I comment out the time panel in the default config again, open rviz2 and add the time panel over the gui it works fine. But saving this configuration file leads to a lot of changes also in other panels that may not be necessary. I'm not sure how to handle it properly. Maybe you have an idea @jacobperron. I just fixed another bug: When saving the configuration and restarting rviz2 with activated time panel I get this error which results in a crash: terminate called after throwing an instance of 'std::runtime_error'
what(): can't subtract times with different time sources [1 != 2] The crash happens in this part of the code: double VisualizationManager::getROSTimeElapsed()
{
// TODO(wjwwood): why does this function return now - begin, whereas the getWallClockElapsed
// returns a pre-calculated elapsed value?
// figure out how this function is being used and make these consistent
// return (frame_manager_->getTime() - ros_time_begin_).nanoseconds() / 1e9; // crashed here
return static_cast<double>(ros_time_elapsed_) / 1e9; // changed to this line
} I tried to return the void VisualizationManager::updateTime()
{
rclcpp::Clock clock; // TODO(wjwwood): replace with clock attached to node for ROS Time
if (ros_time_begin_.nanoseconds() == 0) {
ros_time_begin_ = clock_->now();
}
ros_time_elapsed_ = (clock_->now() - ros_time_begin_).nanoseconds();
if (wall_clock_begin_.time_since_epoch().count() == 0) {
wall_clock_begin_ = std::chrono::system_clock::now();
}
wall_clock_elapsed_ = std::chrono::system_clock::now() - wall_clock_begin_;
} Tested on foxy branch (ROS foxy + Ubuntu 20.04) and on eloquent branch (ROS eloquent + Ubuntu 18.04). |
can be added manually over the gui
It would be nice to have the TimePanel on by default. Sorry, I'm starting a vacation and won't be able to take a closer look until a couple weeks from now. I can take a look then, if this ticket is still open. |
fixed indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working now (I guess the issue was caused by an incorrect indentation level in the default config?).
@jacobperron Thanks for approving! The time panel is activated and running by default now. That's how you wanted to have it? |
@neumann-nico I think having the time panel active by default is good. This is also the default in ROS 1, I think. Thanks for the feature! |
This pull request adds a working version of the Time Panel to rviz_common.
Tested on Ubuntu 20.04 ROS foxy and Ubuntu 18.04 ROS eloquent.