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

RT Capabilities Part 1 - robot-log-visualizer #80

Open
wants to merge 81 commits into
base: main
Choose a base branch
from

Conversation

nicktrem
Copy link

@nicktrem nicktrem commented Mar 4, 2024

This PR for the robot-log-visualizer is a smaller simpler version of the original PR for the robot-log-visualizer and just contains the bare-bone code needed to visualize data online. The point of breaking up the original PR was to simplify the merge process for the robot-log-visualizer.

Copy link
Member

@GiulioRomualdi GiulioRomualdi left a comment

Choose a reason for hiding this comment

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

Hi @nicktrem,

First of all, thank you for working on this feature. It will be really useful to have. Still, there are some things that should be fixed before merging the PR. In general:

  1. I would keep the same style as the repo, so use snake_case for functions and variables and CamelCase for classes.
  2. I would keep yarp and blf as optional dependencies. Indeed, the visualizer is installed via pip, and blf is not included.
  3. The real-time logging can be moved to a separate class. Indeed, it's just a different provider compared to the mat file. Then the GUI may be attached to that real-time provider.
  4. I would avoid replotting the signal from scratch (i.e., delete the axes). In theory, you can use the animation and just modify the content of the variables of the matplotlib line.
  5. You should avoid to use prints, In case of warning/error you can use the logger provided by the gui

robot_log_visualizer/file_reader/signal_provider.py Outdated Show resolved Hide resolved
robot_log_visualizer/file_reader/signal_provider.py Outdated Show resolved Hide resolved
robot_log_visualizer/file_reader/signal_provider.py Outdated Show resolved Hide resolved
if not self.realtimeNetworkInit:
yarp.Network.init()

param_handler = blf.parameters_handler.YarpParametersHandler()
Copy link
Member

Choose a reason for hiding this comment

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

I'm fine to have config files. However, I would keep blf deps relegated only for the real-time logging and use qt config

robot_log_visualizer/robot_visualizer/meshcat_provider.py Outdated Show resolved Hide resolved
robot_log_visualizer/robot_visualizer/meshcat_provider.py Outdated Show resolved Hide resolved
robot_log_visualizer/ui/autogenerated/visualizer.py Outdated Show resolved Hide resolved
robot_log_visualizer/ui/autogenerated/visualizer.py Outdated Show resolved Hide resolved
Comment on lines +394 to +398
# Update the indexes of plotData before deletion
for i in range(index, len(self.plotData.keys()) - 1):
self.plotData[i] = self.plotData[i + 1]
# Remove the last key
del self.plotData[list(self.plotData.keys())[-1]]
Copy link
Member

Choose a reason for hiding this comment

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

can you explain why this is required? We can discuss this F2F

Copy link
Contributor

Choose a reason for hiding this comment

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

@nicktrem can you check this comment?

@nicktrem
Copy link
Author

nicktrem commented May 17, 2024

As discussed today f2f with @GiulioRomualdi and @traversaro the remaining parts of this PR to be addressed are:

  • Try to import BLF and set a flag if to change the text of the realtime button
  • camelCase to snake_case
  • remove print statements
  • clear plots only when RT is enabled

These points have all been addressed today. @GiulioRomualdi if you have any further questions feel free to ask me 😄

@traversaro traversaro requested a review from GiulioRomualdi May 18, 2024 20:00
@@ -11,6 +11,10 @@
import idyntree.swig as idyn


# for real-time logging
import yarp
Copy link
Contributor

Choose a reason for hiding this comment

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

@GiulioRomualdi should we lazy load also yarp or we just need to lazy load blf?

fyi @nicktrem

0, self.signal_provider.end_time - self.signal_provider.initial_time
)
if realtime_plot:
#self.axes.autoscale()
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not needed we can remove it.

@@ -239,15 +239,25 @@ def setupUi(self, MainWindow):
icon = QtGui.QIcon.fromTheme("exit")
self.actionQuit.setIcon(icon)
self.actionQuit.setObjectName("actionQuit")

# Add the GUI components for the open action
Copy link
Member

Choose a reason for hiding this comment

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

This is an autogenerated file and cannot be touched the correct approach here is to modify the UI file directly with qtcreator

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in be77f98

# Disable these buttons for RT communication
self.ui.startButton.setEnabled(False)
self.ui.timeSlider.setEnabled(False)
self.network_thread = threading.Thread(target=self.establish_connection, args=(root,))
Copy link
Member

Choose a reason for hiding this comment

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

can you use qtthread here?

robot_log_visualizer/ui/gui.py Outdated Show resolved Hide resolved
@GiulioRomualdi
Copy link
Member

I'm cleaning a bit the PR to move the blf deps optional so the feature can be ported to pip

@GiulioRomualdi
Copy link
Member

Hi @nicktrem let me know when it's ready so I can start checking it :)

@traversaro
Copy link
Contributor

traversaro commented Nov 13, 2024

@nicktrem @GiulioRomualdi there is any update on this? Thanks!

@nicktrem
Copy link
Author

It is good to go on my end @GiulioRomualdi let me know if you have any questions

@traversaro
Copy link
Contributor

According to @GiulioRomualdi he did some tests on the real robot, and he did not remember well, but when using the RT logger, something related to saving the data was not working.

@nicktrem
Copy link
Author

That issue is on the BLF side, not the robot-log-visualizer side. I can investigate that separately, however, that issue is separate from this PR

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.

3 participants