Simulator MRS
Pre-Requisites
- Ubuntu 20.04.2.0 LTS (Focal Fossa)
- Packages
$ sudo apt-get install git
Step 1 - Install the MRS package
In the prompt:
$ cd /tmp
$ echo '
GIT_PATH=~/git
mkdir -p $GIT_PATH
cd $GIT_PATH
git clone https://github.com/ctu-mrs/mrs_uav_system
cd mrs_uav_system
git checkout master
git pull
./install.sh -g $GIT_PATH
source ~/.bashrc ' > clone.sh && source clone.sh
Case. Error "exit code 1" change the file ~/git/mrs_uav_system/scripts/set_mrs_workspace.sh to this file and run the installation again
Case. Error "exit code 100" can to erase “sudo apt-get -y update” of the filles with error
Note: user is computer user
/home/user/git/simulation/installation/dependencies/ros.sh
/home/user/git/uav_core/installation/dependencies/ros.sh
/home/user/git/mrs_uav_system/installation/dependencies/ros.sh
Step 2: Install the package
Repository: https://github.com/lidiaxp/robotica_movel
$ cd ~/workspace/src
$ git clone https://github.com/lidiaxp/robotica_movel.git
$ catkin build
$ . ~/workspace/devel/setup.bash
Step 3: Setting Gazebo
Start Gazebo by entering the following at the command prompt.
$ gazebo
Click in Edit -> Model Editor
Click in File -> Save as
Save the model in the Location: /workspace/src/robotica_movel/models.
See example, the instructions in this video are until the minute 1:30 (https://youtu.be/aM0vAr_YDT8),
Note: In the video appears the path "catkin_ws/src/Petrobras_Challenge/models" but in this case we will be "workspace/src/robotica_movel/models".
Step 4: Test the environment
$ cd
$ bash workspace/src/robotica_movel/src/start/start.sh
After this execution the uav will be flying on the scenario
Note: If the error appears “reference validation failed, potential collision with an obstacle!”
In the prompt:
$ cd ~/mrs_workspace/src/uav_core/ros_packages/mrs_uav_managers/src
Delete the control_manager.cpp. Copy the control_manager.cpp file from repository: https://github.com/lidiaxp/extraFilesRobotics/tree/main/Robotica%20Movel, and paste in the same place.
$ catkin build
$ cd
$ bash mrs_workspace/src/robotica_movel/src/start/start.sh
Step 5: Use algorithms and information available from MRS
Repository 1: https://ctu-mrs.github.io/docs/system/uav_ros_interface.html#uavmanager
Repository 2: https://ctu-mrs.github.io/docs/software/mavros.html#used-topics-and-services
Topic Informations:
Localization: /uav1/odometry/odom_main
Laser: /uav1/garmin/range
Global motion: /uav1/control_manager/reference
Local motion: /uav1/control_manager/goto_fcu
Extra 1: Ways to stop the simulation
Press “CTRL + a” and after “k” in the prompt
If something remains open:
$ alias killg='killall gzclient && killall gzserver && killall rosmaster'
$ killall px4
$ tmux kill-server
Extra 2: Learning ROS
Communication with the MRS will be done through ROS. If you are not yet aware, it is interesting to carry out the tutorial 1.1.1 to 1.1.18 link:
http://wiki.ros.org/ROS/Tutorials
Note: In the class - Week 02, we will see ROS, but it is important for improving your expertise to do the tutorials. That will be passed as Frequency Activity of Week 02.
Extra 3: Change environment
Open the file ~/workspace/src/robotica_movel/src/start/start.sh
The line 31 will be:
$ 'Gazebo' "waitForRos; roslaunch robotica_movel simulation_arena.launch world_name:=fase1 gui:=true
Change the world_name:=fase1 to world_name:=floresta, or some world present in ~/workspace/src/robotica_movel/worlds