flexbe_app
flexbe_app copied to clipboard
feat: Save new/changed behavior on the robot through SSH
What I did:
-
Used scp2 and ssh2 node modules to update the behavior package on the robot according to new changes made on this package (adding new behavior, modifying an existing one) through SSH.
-
The SSH configurations (hostname and username) shall be set in new input boxes provided in Code Generation section of Configuration tab. This feature is disabled by default and it can be set to enabled from the same section.
-
For security reasons (to don't store it as a cookie) password will be prompted on clicking the save behavior button.
-
Refactored the package.json and added dependency to scp2 module.
Important notes:
- The behavior package shall be already available on the robot.
- In order to be able to find package the path, the ROS environment variables shall be set properly on .profile script.
- In order to use this new feature its dependencies needs to be installed. To do so, the
npm install
command will be automatically executed duringcmake
. - If you saw any indentation incossitency, its because of using tabs instead of spaces in the whole original source code, while I used 4-spaces. This shall be fixed in a separate PR.
Feature works:
- Unfortunately, javascript doesn't provide a prompt box with password masking feature, as a matter of the fact, the current password prompt is unmasked. A proper solution is to replace the usage of the password with SSH keys.
- Currently, the whole package will be overwritten by clicking on save behavior. This can be improved by just updating the modified files.
@pschillinger Any comment on this?
This sounds like an exciting feature and I think it fits perfectly into the concept of the FlexBE app! Thanks a lot for your effort!
I wanted to get #19 out of the way, then I will try it out more carefully.
Hi @alireza-hosseini , Thanks for adding the ssh feature in flexBE App. I am getting an issue in implementing it. My flexbe_app is running on one system and flexbe_onboard is running on another system. I am able to run the behavior but having trouble in editing the code via ssh.
On your modifications, I have entered Robot's hostname as it's IP and Robot's username in Configuration -> Code Generation Tab, And on clicking save behaviour, it gives "Permission Denied Error".
Please refer the screenshot below,
On running it in super user,
And my .profile contains this code:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
Please suggest the changes to be done to make files edit and make it work?
@utkarsh447 Thanks for trying my proposed feature,
Regarding the first error I think it is related to the fact that probably when you tried to save the behavior, it was actually running on the remote machine so that "example_behavior_sm.py" was in read-only state which means scp
cannot overwrite the changes on this file.
About the second error, please make sure that you have the following line in your .profile:
source /STATIC_PATH_TO_YOUR_CATKIN_WS/devel/setup.bash
@utkarsh447 Thanks for trying my proposed feature, Regarding the first error I think it is related to the fact that probably when you tried to save the behavior, it was actually running on the remote machine so that "example_behavior_sm.py" was in read-only state which means
scp
cannot overwrite the changes on this file. About the second error, please make sure that you have the following line in your .profile:source /STATIC_PATH_TO_YOUR_CATKIN_WS/devel/setup.bash
Thank You very much, It is working as it should! And your added feature is awesome and really helped me alot..!! :)
@utkarsh447 Cool, glad to hear that ;-)
Thank you for testing @utkarsh447 and thank you again for contributing @alireza-hosseini !
I still have some questions, could you help me with those? I will annotate some in the code for easier reference.
Also, did you test this in combination with making runtime modifications? To me, it looks like these two features would interfere when doing an SSH save while a behavior is running/locked.
I'm really looking forward to merge this feature! I just want to make sure that nothing breaks, of course.