StoglRobotics / ros_team_workspace

RosTeamWorkspace is a framework for boosting collaboration in teams when developing software for robots using Robot Operating System (ROS1 and ROS2).
https://rtw.stoglrobotics.de
Apache License 2.0
82 stars 17 forks source link

Add RTW “header” to terminal with all data #115

Open destogl opened 1 year ago

destogl commented 1 year ago

Current Situation

Currently, we provide data from RTW like current workspace, git branch and relative path in each line of the terminal. For example:

<user>@<machine-name>:[ros2_control_rolling]<adding-mecanum-drive-controller-state-msg>control_msgs$

This fills more than half of the terminal line and when using long commands they are hard to read.

Ideal situation

There is an option to fix a few top terminal lines and provide information there. Since most of the information is static in terms of the terminal session, this would be quite a suitable option for us.

The following line provides a short test of this configuration, but the configuration is broken so that any data is missing so that lines are not clean and are overwritten constantly. Still, it can be used as a starting idea.

export PS1='\e[s\e[0;0H\e[1;33m\h    \t\n\e[1;32mThis is my computer\e[u[\u@\h:  \w]\$ '

The proposed UI should have the following elements and can look something like the following image.

proposal_for_terminal_view

Appetite

2h

NOTE: Appetite is a measure that says how much effort we want to spend on a specific feature / bug fix – or in other words – what is the value in terms of time of the feature / bug-fix.

What we don't do

Don't try to make it perfect. It's important that it doesn't break any output in the terminal, but it may have glitches when you're resizing terminals. You may add additional raw if needed, change the order of things from the proposal, and so on. Furthermore, the colors are just showing to have different colors – it may be simplest to use the existing colors.

Timeboxed to 2 hours – if after 60 minutes are not moving toward a solution, kill it!

atticusrussell commented 1 year ago

This is a feature that I would greatly appreciate as a user. I am encountering issues where the prompt will glitch once it wraps, and it also shows unknown characters on windows terminal on WSL2 22.04. image

destogl commented 1 year ago

This is a feature that I would greatly appreciate as a user. I am encountering issues where the prompt will glitch once it wraps, and it also shows unknown characters on windows terminal on WSL2 22.04. image

Yeah, windows… (glad to not have to deal with them at all 😉)

OK, seriously now – We should figure out which characters are shows as unknown. I guess those are characters about end of color (this one. It seeems that the characters from chaning colors (from this line) are shown.

@atticusrussell do you know if WSL has some specific version of bash (or maybe even other shell)?

atticusrussell commented 1 year ago

@destogl sorry for my very delayed response. afaik WSL doesn't have any particular version of a shell - I believe it's just bash, and is customized with a normal .bashrc . I'll try to look into it more

atticusrussell commented 1 year ago

Various Windows applications to get a terminal to WSL: Ubuntu 22.04 application on Windows (that gets installed with the WSL distro) image

Windows Terminal on WSL Ubuntu 22.04 image

VSCode Terminal (WSL ubuntu 22.04) image

It's curious that these characters don't appear as errors in VSCode's terminal to WSL. Maybe there's something different with the way that VSCode handles text that could explain the issue.

atticusrussell commented 1 year ago

@destogl I created a PR to implement this feature. It seems that it may be more appropriate to address the corrupted characters in an issue separate from this one. I'm thinking I'll wait until that PR is addressed to open the issue, in case it changes anything.