The assignment involves the implementation of three different nodes used to control a robot in 3D space. The nodes are used to provide a goal that can be deleted, return the coordinates of the last entered goal, and calculate the distance to the goal and the average speed of the robot.
Two different applications are needed to make the developed 3D environment work:
- rviz
- gazebo
these two should already be installed if you followed the following procedure for installing ros on ubuntu 22.04.
A further element to take into consideration in case the simulation does not work is the robot2_laser.gazebo file contained into the urdf directory, if the robot does not have the laser visible in the rviz window it's necessary to replace it with the one available at this link still contained into the urdfdirectory.
The first step is installing xterm (program used to manage multiple screen outputs) using this command in the terminal.
sudo apt-get install xtermThen it's possible to clone the repository into the src directory that is present in the ros environment.
git clone https://github.com/FedeMala00/second_assignment.gitSubsequently it's necessary to add the execution permission to all the .py files contained into the scripts directory, so first of all you need to move to scripts directory and then use this command.
chmod +x *.pyAt this point you can run the program using the appropriately modified launch file.
roslaunch second_assignment second_assignment.launchBy running the programm three different windows will open:
- one
rvizwindow that allows the user to view the simulated robot model, visualize sensor information from the robot's sensors in our case the laser one - one
gazebowindow that manages the 3D environment within which the robot will move, in fact you can see the present obstacles - three different
xtermwindows that allow the output on screen for the three created node:node_action_clientthat requires the choice of a goal that can be canceled and verifies the arrival at the target via feedback,last_target_serviceprints the instructions to obtain the last target given to the robot,subscriber_pos_velprints the distance between the robot and the target and the average velocity of the robot in the last 10 (chosen parameter) observations.
It performs the same action of node_action_client but using a jupyter notebook.
Then it plots the correspondent map with the goals set and the live position of the robot, and finally it plots an histogram containing the reached goals and the cancelled goals.
Link to the html page generated by Sphinx: https://fedemala00.github.io/second_assignment/
