Skip to content

Commit

Permalink
Merge pull request #68 from hello-robot/bugfix/add_user
Browse files Browse the repository at this point in the history
Make adding new users easier
  • Loading branch information
hello-binit authored May 7, 2024
2 parents 5cba1f7 + 877ad4b commit 0fb025a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 20 deletions.
39 changes: 22 additions & 17 deletions docs/add_new_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,48 @@

## Why

When multiple people are working with the robot, it can be helpful to create separate Ubuntu user accounts. Here's a few reasons you might add a new user:
If you're sharing Stretch with other developers, it can be helpful to create separate accounts for yourself and your team members. Your code and data will be password protected in your own account, and other developers can modify their own code without accidentally affecting yours.

- Your code and data is protected by password in your user account
- Your code is dependent on a specific version of Stretch's software and you don't want other users to accidentally upgrade it (NOTE: some of Stretch's software is installed per user, e.g. Stretch Body and Stretch ROS, whereas other parts of the software is installed per OS, e.g. ROS1 or ROS2)
- Logs from your experiments will not be mixed with logs from other users
!!! warning

Finally, note that changes made in your user account can break another user account's set up. For example, if you configure a different gripper or end effector onto the robot with your account, other accounts will have outdated configurations for what gripper is attached to the robot.
User accounts cannot completely insulate your account from changes in another. For example, if someone attaches a new gripper or end-effector tool to the robot, your account's software would have an outdated configuration for what tool is attached to the robot. A non-exhaustive list of changes that could break/affect accounts:

- Making hardware changes to the robot
- Updating the firmware
- Installing/changing [APT packages](#apt-package-manager)

## How

Login to the "hello-robot" user. The "hello-robot" user account has administrator privileges. Go to Users system settings and unlock the administrator actions.
Start by logging into the admin Hello Robot user. Go to Users system settings and unlock adminstrator actions.

![](./images/unlock_users.png)

Click "Add User..." and complete the subsequent form.
Click "Add User..." and complete the subsequent form. The new user needs to be an administrator.

![](./images/adding_new_user.png)

Logout and the log back in as the new user. Open a terminal and execute the following to pull down the Stretch Install repository.
Log out and back in as the new user. Open a terminal and execute the following to pull down the Stretch Install repository:

```bash
cd ~
git clone https://github.com/hello-robot/stretch_install
cd stretch_install
git pull
```{.bash .shell-prompt .copy}
git clone https://github.com/hello-robot/stretch_install ~/stretch_install
```

Execute the following to set up the new user account with Stretch packages and the robot's configuration data.
Make sure it's up-to-date:

```bash
```{.bash .shell-prompt .copy}
cd ~/stretch_install && git pull
```

Run the new user install script to set up the SDK for this new account:

```{.bash .shell-prompt .copy}
./stretch_new_user_install.sh
```

Finally, reboot your robot and execute the following to confirm the new user account was set up successfully.
Finally, reboot the robot and run a system check in the new user account to confirm everything was set up correctly.

```bash
stretch_robot_system_check.py
stretch_system_check.py
```

Your new user account is now set up successfully!
Expand Down
Binary file modified docs/images/adding_new_user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/unlock_users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions factory/20.04/stretch_create_catkin_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ if [[ -d $CATKIN_WSDIR ]]; then
prompt_yes_no
fi

echo "Updating rosdep indices..."
rosdep update --include-eol-distros &>> $REDIRECT_LOGFILE
echo "Deleting $CATKIN_WSDIR if it already exists..."
sudo rm -rf $CATKIN_WSDIR
echo "Creating the workspace directory..."
Expand Down
1 change: 0 additions & 1 deletion factory/20.04/stretch_install_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ if [ -f "/etc/ros/rosdep/sources.list.d/20-default.list" ]; then
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
fi
sudo rosdep init >> $REDIRECT_LOGFILE
rosdep update --include-eol-distros >> $REDIRECT_LOGFILE
echo "Install vcstool"
install python3-vcstool
echo ""
Expand Down
4 changes: 3 additions & 1 deletion factory/22.04/stretch_create_ament_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ fi
. /etc/hello-robot/hello-robot.conf
export HELLO_FLEET_ID HELLO_FLEET_ID
export HELLO_FLEET_PATH=${HOME}/stretch_user
echo "Updating rosdep indices..."
rosdep update --include-eol-distros &>> $REDIRECT_LOGFILE
echo "Deleting $AMENT_WSDIR if it already exists..."
sudo rm -rf $AMENT_WSDIR
echo "Creating the workspace directory..."
Expand Down Expand Up @@ -94,7 +96,7 @@ echo "Update ~/.bashrc dotfile to source workspace..."
echo "source $AMENT_WSDIR/install/setup.bash" >> ~/.bashrc
echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc
echo "Updating meshes and xacros to ROS from stretch_urdf package."
/home/hello-robot/.local/bin/stretch_urdf_ros_update.py -y -v >> $REDIRECT_LOGFILE
/home/$USER/.local/bin/stretch_urdf_ros_update.py -y -v >> $REDIRECT_LOGFILE
echo "Setup uncalibrated robot URDF..."
ros2 run stretch_calibration update_uncalibrated_urdf >> $REDIRECT_LOGFILE
echo "Setup calibrated robot URDF..."
Expand Down
1 change: 0 additions & 1 deletion factory/22.04/stretch_install_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ if [ -f "/etc/ros/rosdep/sources.list.d/20-default.list" ]; then
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
fi
sudo rosdep init >> $REDIRECT_LOGFILE
rosdep update --include-eol-distros >> $REDIRECT_LOGFILE
echo "Install vcstool"
install python3-vcstool
echo ""
Expand Down
7 changes: 7 additions & 0 deletions stretch_new_user_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ if [[ ! $factory_osdir =~ ^(18.04|20.04|22.04)$ ]]; then
exit 1
fi

echo "Prevent screen dimming..."
gsettings set org.gnome.desktop.session idle-delay 0 &> /dev/null || true
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 &> /dev/null || true
gsettings set org.gnome.settings-daemon.plugins.power idle-dim false &> /dev/null || true

if [ "$HELLO_FLEET_ID" ]; then
UPDATING=true
echo "###########################################"
Expand Down Expand Up @@ -115,6 +120,8 @@ elif [[ $factory_osdir = "20.04" || $factory_osdir = "22.04" ]]; then
echo "###########################################"
echo "INSTALLATION OF USER LEVEL PIP3 PACKAGES"
echo "###########################################"
echo "Clear pip cache"
python3 -m pip cache purge &>> $REDIRECT_LOGFILE
echo "Upgrade pip3"
python3 -m pip -q install --no-warn-script-location --user --upgrade pip &>> $REDIRECT_LOGFILE
echo "Install Stretch Body"
Expand Down

0 comments on commit 0fb025a

Please sign in to comment.