Skip to content
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

Adds PlaybackPlugin with ignition-gui 3 #376

Merged
merged 3 commits into from
Apr 6, 2021

Conversation

francocipollone
Copy link
Collaborator

@francocipollone francocipollone commented Apr 5, 2021

Part of #332

  • Replicates UI from PlaybackWidget which uses ign-gui0.
    • EDITED: play/pause buttons are merged into one.
  • Implements the same functionality.
delphyne_replay2.mp4
  • I've added a new configuration file called: layout2_for_playback.config in which the PlaybackPlugin is added.
    In addition a delphyne_gui/python/toolkit/replay2.py script was added for executing the replayer with the new visualizer and with the PlaybackPlugin.
    Note: In essence this app is equal to the delphyne_gui/python/toolkit/replay.py script that runs the old visualizer with
    PlaybackWidget, the only difference is that during this script the plugin is injected to the default layout instead of directly using the layout created for that end.

For executing the replay app:
1 - Create a log file, e.g.:

delphyne_gazoo -l -f /home/<USER>/maliput_ws/my_awesome_sim.log

2 - Execute delphyne_replay2 app:

delphyne_replay2 my_awesome_sim.log

@francocipollone
Copy link
Collaborator Author

2f81bc1 --> Changes icon style for the buttons

Copy link
Collaborator

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

// An ignition transport node.
ignition::transport::Node node_;

SimTimes time_status_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timeStatus_ to keep the format?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I believe you should remove the underscore at the end and add one in all function arguments

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done x2 !

// @brief Converts from ignition::msgs::Time to std::chrono::duration.
// @param[in] src Time to be converted
// @returns `src` converted to std::chrono::duration::nanoseconds.
std::chrono::nanoseconds TimeToChrono(const ignition::msgs::Time& src) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it IgnitionTimeToChrono

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// @param[out] dst Duration
// @throws When `dst` is nullptr.
void ChronoToDuration(const std::chrono::nanoseconds& src, ignition::msgs::Duration* dst) {
DELPHYNE_DEMAND(dst != nullptr);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw instead of abort.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// @throws When `dst` is nullptr.
void ChronoToDuration(const std::chrono::nanoseconds& src, ignition::msgs::Duration* dst) {
DELPHYNE_DEMAND(dst != nullptr);
std::chrono::seconds src_in_seconds = std::chrono::duration_cast<std::chrono::seconds>(src);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be const.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


PlaybackPlugin::PlaybackPlugin() : ignition::gui::Plugin() { qRegisterMetaType<ignition::msgs::PlaybackStatus>(); }

PlaybackPlugin::~PlaybackPlugin() {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it default or implicit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3

Rectangle {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code in this file should also be documented.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added some minor comments. I don't know how deep it should be given that there isn't that much code here.

#

"""
The replay tool.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please a doctring explaining how it works?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

OUTPUT_NAME PlaybackPlugin
)

target_link_libraries(PlaybackPlugin
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to link against ignition-plugin1::register ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently. However It didn't complain about it.
Added.

ARCHIVE DESTINATION lib
)

include_directories(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already four times in this file. Can we just leave it once?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Done.

anchors.leftMargin : 10
anchors.verticalCenter : rewindButton.verticalCenter
onClicked: {
if (isPlaying){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that 2 spaces indentation is OK. Would you please adjust it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@francocipollone francocipollone merged commit eeeeaf6 into master Apr 6, 2021
@francocipollone francocipollone deleted the francocipollone/playback_plugin branch April 6, 2021 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants