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

[ SCRIPTING ] : Adds Installations script #71

Merged
merged 34 commits into from
Apr 12, 2024

Conversation

AryanNanda17
Copy link
Contributor

This PR resolves issue #30.
The installation script provides a complete installation process for MARIO Workshop, which includes the following steps:-

  • Installing esp_idf-v5.1
  • Cloning the Mario repository
  • Installing ROS2 with additional packages
  • Creating a ros2_ws
  • Installing Gazebo
  • Copying Mario's folders to ros2_ws
  • Setting up microros_ws
    To do: Adding instructions for building microros_ws in MacOS.

I will verify the installation on both Linux and macOS systems and provide an update soon.

mario_install.sh Outdated
if [ ! -d "$HOME/MARIO" ]; then
cd "$HOME" || (echo "Error: Could not navigate to Home" && exit 1)
echo "Cloning Mario"
git clone --recursive https://github.com/AryanNanda17/MARIO.git /tmp/ros2_ws
Copy link
Member

Choose a reason for hiding this comment

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

This line clones your fork @AryanNanda17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated it!

mario_install.sh Outdated
if [ ! -d "$HOME/MARIO" ]; then
cd "$HOME" || (echo "Error: Could not navigate to Home" && exit 1)
echo "Cloning Mario"
git clone --recursive https://github.com/AryanNanda17/MARIO.git /tmp/ros2_ws
Copy link
Member

Choose a reason for hiding this comment

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

I will be renaming ros2 branch as humble, so accordingly you have to clone the branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I need to clone just the humble branch or the entire repository?

mario_install.sh Outdated
if [ ! -d "$HOME/MARIO" ]; then
cd "$HOME" || (echo "Error: Could not navigate to Home" && exit 1)
echo "Cloning Mario"
git clone --recursive https://github.com/AryanNanda17/MARIO.git /tmp/ros2_ws
Copy link
Member

Choose a reason for hiding this comment

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

and why is it cloned in /tmp/ros2_ws?

Copy link
Contributor Author

@AryanNanda17 AryanNanda17 Apr 9, 2024

Choose a reason for hiding this comment

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

The cloning of the repository is temporary as the script will later copy the folders to ros2_ws and ros2_ws_firmware.

Copy link
Member

Choose a reason for hiding this comment

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

I think its better to have the MARIO folder in home directory still for future contributors

mario_install.sh Outdated

# Install additional important ros2 packages
echo "Installing Additional Ros2 packages"
conda install ros-humble-desktop-full ros-humble-control-* ros-humble-gazebo-ros2-control ros-humble-joint-state-* ros-humble-forward-command-controller ros-humble-robot-state-publisher
Copy link
Member

Choose a reason for hiding this comment

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

ros-humble-control*

we need controller manager as well

mario_install.sh Outdated

# Install additional important ros2 packages
echo "Installing Additional Ros2 packages"
conda install ros-humble-desktop-full ros-humble-control-* ros-humble-gazebo-ros2-control ros-humble-joint-state-* ros-humble-forward-command-controller ros-humble-robot-state-publisher
Copy link
Member

Choose a reason for hiding this comment

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

also, add ros-humble-joint-trajectory-controller

mario_install.sh Outdated

cd ~/ros2_ws/src
if [[ ! -d "1_chatter_listener" ]]; then
mv /tmp/ros2_ws/1_* $HOME/ros2_ws/src
Copy link
Member

Choose a reason for hiding this comment

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

don't do this, just clone in MARIO folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

don't do this, just clone in MARIO folder

In the Discord, you advised doing that and not against it. So, should I proceed with copying these folders to the ros2_ws or not?

Copy link
Member

Choose a reason for hiding this comment

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

You should copy still, just not clone in tmp thing

mario_install.sh Outdated
case "${unameOut}" in
Linux*)
echo "Creating a microros_ws"
mkdir -p microros_ws/src
Copy link
Member

Choose a reason for hiding this comment

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

clone in the ros2_ws only

mario_install.sh Outdated
;;
Darwin*)
echo "Creating a microros_ws"
mkdir -p microros_ws/src
Copy link
Member

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 install catkin_pkg and all in macos?

mario_install.sh Outdated
cd ~/ros2_ws
mkdir src
colcon build
echo "source ~/ros2_ws/install/setup.bash" >> $HOME/."$_shell_"rc
Copy link
Member

Choose a reason for hiding this comment

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

add alias for sourcing
`sw = source install/setup.bash

and get_ros = source /opt/ros/humble/setup.bash

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add alias for sourcing `sw = source install/setup.bash

and get_ros = source /opt/ros/humble/setup.bash

I've included a sourcing command in the terminal to ensure that the specified commands are automatically available whenever the user opens the terminal, this eliminates the need to manually execute them each time.

@aPR0T0 aPR0T0 changed the title Installatins script added [ SCRIPTING ] : Adds Installatoins script Apr 9, 2024
@AryanNanda17 AryanNanda17 changed the title [ SCRIPTING ] : Adds Installatoins script [ SCRIPTING ] : Adds Installations script Apr 9, 2024
@aPR0T0
Copy link
Member

aPR0T0 commented Apr 9, 2024

@AryanNanda17 I don't see any commit resolving the bugs

@AryanNanda17 AryanNanda17 requested a review from aPR0T0 April 9, 2024 16:27
mario_install.sh Outdated
git clone -b humble https://github.com/micro-ROS/micro-ROS-Agent.git
sudo apt update && rosdep update
cd ..
pip3 install catkin_pkg lark-parser colcon-common-extensions -l rosdep
Copy link
Member

Choose a reason for hiding this comment

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

microros-esp-idf-components depends on this, so its good

mario_install.sh Outdated
echo "${red}======================$reset"
cd ~/ros2_ws/src

git clone -b humble https://github.com/micro-ROS/micro-ROS-Agent.git
Copy link
Member

Choose a reason for hiding this comment

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

have you tested the script with the microros folders in the firmware ?

Copy link
Contributor Author

@AryanNanda17 AryanNanda17 Apr 9, 2024

Choose a reason for hiding this comment

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

I am solving errors since the afternoon, but I am getting one error after another. I am not able to setup catkin_pkg in MacOS and I am getting this error when I try to run colcon build command in ros_ws

Copy link
Member

Choose a reason for hiding this comment

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

    pip3 install catkin_pkg lark-parser colcon-common-extensions -l rosdep
    
    isn't it same for mac?

Copy link
Contributor Author

@AryanNanda17 AryanNanda17 Apr 10, 2024

Choose a reason for hiding this comment

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

It's the same and I did that but still, I am getting the same error.

mario_install.sh Outdated
echo "${red}======================$reset"
cd ~/ros2_ws/src

git clone -b humble https://github.com/micro-ROS/micro-ROS-Agent.git
Copy link
Member

Choose a reason for hiding this comment

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

    pip3 install catkin_pkg lark-parser colcon-common-extensions -l rosdep
    
    isn't it same for mac?

mario_install.sh Outdated

cd ~/ros2_ws/src
if [[ ! -d "1_chatter_listener" ]]; then
mv ~/ros2_ws/1_* $HOME/ros2_ws/src
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't it be ~/MARIO/1_* and so on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, updated it!

@AryanNanda17
Copy link
Contributor Author

@SuperChamp234, could you please try running the installation script?

  • After copying the folders from Mario repo to ros2_ws, the script is doing colcon build, but errors are coming. Could you please help in debugging those errors?

@aPR0T0
Copy link
Member

aPR0T0 commented Apr 10, 2024

@AryanNanda17 also, please rename this file to install_codes.sh and remove other shell scripts from previous version of MARIO

@SuperChamp234
Copy link
Member

Hi Aryan, can you ask other team members to run the installation scripts? Both on Linux and Mac. I cannot run as I have an install of ROS for my work running and don’t want to disturb it.

@AryanNanda17
Copy link
Contributor Author

AryanNanda17 commented Apr 11, 2024

I arranged one Linux laptop and verified the installation script on it.

  • 1_chatter_listener:-
Screencast.from.04-11-2024.08.36.03.PM.webm
  • 2_simulation_dh
    Screenshot from 2024-04-11 20-40-43

  • 3_simulation_rviz
    Screenshot from 2024-04-11 20-41-52

  • 4_simulation_gazebo
    Screenshot from 2024-04-11 20-47-43

In 4_simulation_gazebo, I am getting above error.

@AryanNanda17
Copy link
Contributor Author

AryanNanda17 commented Apr 11, 2024

I tried testing the Installation instructions on MacOS:-
1_chatter_listener:-
Screenshot 2024-04-11 at 3 06 04 PM

2_simulation_dh:-
Screenshot 2024-04-11 at 2 55 54 PM

  1. 3_simulation_rviz:-
Screenshot 2024-04-11 at 9 02 55 PM

It says to install gazebo_ros2_control and when I do that using conda and I getting so many conflicts.

Screenshot 2024-04-11 at 9 04 11 PM
  1. 4_simulation_gazebo:-
Screenshot 2024-04-11 at 8 57 09 PM

This is also not working

@AryanNanda17 AryanNanda17 requested a review from aPR0T0 April 11, 2024 15:35
@aPR0T0
Copy link
Member

aPR0T0 commented Apr 11, 2024

image
Install this package as well and try again for simulation_gazebo

@aPR0T0
Copy link
Member

aPR0T0 commented Apr 11, 2024

And for linux it might be the same issue that the gazebo-ros package is not installed

for macOS for gazebo-ros2-control what command you used
I am hoping it was sudo mamba install ros-humble-gazebo-ros2-control

@aPR0T0
Copy link
Member

aPR0T0 commented Apr 11, 2024

@SuperChamp234 please see what's the issue with gazebo-ros2-control

@AryanNanda17
Copy link
Contributor Author

AryanNanda17 commented Apr 11, 2024

for macOS for gazebo-ros2-control what command you used I am hoping it was sudo mamba install ros-humble-gazebo-ros2-control

yes I used conda install ros-humble-gazebo-ros2-control

@AryanNanda17
Copy link
Contributor Author

image Install this package as well and try again for simulation_gazebo

I have installed these packages but still getting the same Linux error above.

@aPR0T0
Copy link
Member

aPR0T0 commented Apr 11, 2024

@AryanNanda17 send the gazebo error in pastebin

installations.sh Outdated

# Install additional ROS 2 packages
echo "Installing Additional Ros2 packages"
sudo apt install -y ros-humble-control-msgs ros-humble-control-toolbox ros-humble-gazebo-ros2-control ros-humble-joint-state-broadcaster ros-humble-joint-state-publisher ros-humble-joint-state-publisher-gui ros-humble-forward-command-controller ros-humble-robot-state-publisher ros-humble-gazebo-ros2-control ros-humble-robot-controllers ros-humble-robot-controllers-interface ros-humble-robot-controllers-msgs ros-humble-joint-trajectory-controller ros-humble-controller-manager ros-humble-controller-manager-msgs ros-humble-ros2-control
Copy link
Member

Choose a reason for hiding this comment

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

Why is gazebo-ros2-control mentioned two times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected it!

installations.sh Outdated
conda config --env --remove channels defaults || true
# Install ROS packages
mamba install ros-humble-desktop-full
mamba install -n ros_env -y ros-humble-control-msgs ros-humble-control-toolbox ros-humble-joint-state-broadcaster ros-humble-joint-state-publisher ros-humble-joint-state-publisher-gui ros-humble-forward-command-controller ros-humble-robot-state-publisher ros-humble-controller-manager ros-humble-controller-manager-msgs ros-humble-joint-trajectory-controller ros-humble-ros2-control
Copy link
Member

Choose a reason for hiding this comment

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

review the previous comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here, it is correct right?

@AryanNanda17
Copy link
Contributor Author

I tried again in Linux and it is working now. I guess
ros-humble-gazebo-ros-dbgsym
ros-humble-gazebo-ros-pkgs
weren't properly configured.
Screenshot from 2024-04-11 22-46-38

@AryanNanda17
Copy link
Contributor Author

For Mac:-
In robostack, this package is not available ros-humble-gazebo-ros-dbgsym. And conda install ros-humble-gazebo-ros-pkgs is also giving me conflicts.

@aPR0T0
Copy link
Member

aPR0T0 commented Apr 11, 2024

Solve the mac errors by tomorrow, I will merge then tomorrow morning!

case "${unameOut}" in
Linux*)
echo "Cloning microrosagent"
cd $HOME/ros2_ws/src
Copy link
Member

Choose a reason for hiding this comment

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

where is cloning step?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I missed cloning it here. Thanks for pointing it out @aPR0T0.

Copy link
Contributor

@RapidRoger18 RapidRoger18 left a comment

Choose a reason for hiding this comment

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

Please look into suggested changes. @SuperChamp234, Can you review the suggestions.

installations.sh Outdated
fi
echo "$reset"
# Clone Mario repository if not already cloned
if [ ! -d "$HOME/MARIO" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Using double inverted commas won't work. Make changes as per line 14 for esp folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using double inverted commas won't work. Make changes as per line 14 for the esp folder.

Hello @RapidRoger18, enclosing a string in double quotes indeed does work. When you use double quotes, variables, and certain special characters within the quotes get expanded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still, in order to maintain consistency, I have removed the double quotes.
Thanks for the suggestion!

Copy link
Member

Choose a reason for hiding this comment

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

You might have not pushed the changes @AryanNanda17 as I am unable to see removed quotes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushed now.

installations.sh Outdated

echo "Installing ESP IDF"

_shell_="${SHELL#${SHELL%/*}/}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestions: I would recommend using $0 command instead of $SHELL as some systems print shell path. Instead of concatenation $0 will always give shell name only.

Copy link
Contributor Author

@AryanNanda17 AryanNanda17 Apr 12, 2024

Choose a reason for hiding this comment

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

Thanks for the suggestion. Updated it!


# Install ROS 2
sudo apt install ros-humble-desktop-full
echo "source /opt/ros/humble/setup.bash" >> $HOME/."$_shell_"rc
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are identifying shell for each system better to use $0 to run the a particular shell script instead of using bash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Line 113 will only be executed in the case of linux, where Bash serves as the default shell.

@@ -0,0 +1,297 @@
!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are using bash from env why bother using $shell??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When a script starts with #!/usr/bin/env bash, it tells the system to execute the script using the bash interpreter found in the environment. In this context, $0 technically represents the script's filename, not the shell being used.

@aPR0T0
Copy link
Member

aPR0T0 commented Apr 12, 2024

@AryanNanda17 please go through this gist and make the generic changes

@aPR0T0 aPR0T0 merged commit c23f369 into SRA-VJTI:humble Apr 12, 2024
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.

4 participants