{"id":26269458,"url":"https://github.com/simone-contorno/rt-assignment-3","last_synced_at":"2026-04-15T15:32:48.058Z","repository":{"id":86020783,"uuid":"438573941","full_name":"simone-contorno/rt-assignment-3","owner":"simone-contorno","description":"Research Track 1 - Third assignment - Control of a robot in a simulated environment using Gazebo and Rviz","archived":false,"fork":false,"pushed_at":"2022-04-04T08:43:31.000Z","size":131,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T00:59:09.031Z","etag":null,"topics":["cpp","enginneering","robot","robotics","ros"],"latest_commit_sha":null,"homepage":"https://github.com/simone-contorno/RT-Assignment-3","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simone-contorno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-15T09:41:37.000Z","updated_at":"2025-01-19T11:45:17.000Z","dependencies_parsed_at":"2023-03-03T16:45:22.755Z","dependency_job_id":null,"html_url":"https://github.com/simone-contorno/rt-assignment-3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simone-contorno/rt-assignment-3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simone-contorno%2Frt-assignment-3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simone-contorno%2Frt-assignment-3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simone-contorno%2Frt-assignment-3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simone-contorno%2Frt-assignment-3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simone-contorno","download_url":"https://codeload.github.com/simone-contorno/rt-assignment-3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simone-contorno%2Frt-assignment-3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278395910,"owners_count":25979690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","enginneering","robot","robotics","ros"],"created_at":"2025-03-14T05:14:17.398Z","updated_at":"2025-10-05T00:59:13.069Z","avatar_url":"https://github.com/simone-contorno.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Third Assignment of Research Track 1 - Robotics Engineering\n## Author: Simone Contorno\n\n\u003cbr\u003e\n\nControl of a robot in a simulated environment.\n\n### Introduction\nAn overview of this program function.\u003cbr\u003e\n[Go to Introduction](#intro)\n\n### How it works\nA rapid description of how the program works (pseudo-code).\u003cbr\u003e\n[Go to How it works](#how)\n\n### Installation and Execution\nHow install and run this program in Linux.\u003cbr\u003e\n[Go to Installation and Execution](#installation)\n\n### Improvements\nHow this program could be improved.\u003cbr\u003e\n[Go to Improvements](#improve)\n\n\u003ca name=\"intro\"\u003e\u003c/a\u003e\n### Introduction\n\nThis program manage a robot, endowed with laser scanners, which should move autonomously inside a map.\u003cbr\u003e\nYou can use the user interface to:\n\u003col\u003e\n    \u003cli\u003eLet the robot to autonomously reach a x,y coordinate inserted by command line.\u003c/li\u003e\n    \u003cli\u003eDrive the robot with the keyboard.\u003c/li\u003e\n    \u003cli\u003eDrive the robot with the keyboard availing of a simple driving assistance.\u003c/li\u003e\n\u003c/ol\u003e\n\nThe map is this one:\u003cbr\u003e\n\u003cbr\u003eRviz:\u003cbr\u003e\n\u003cimg src=\"https://github.com/simone-contorno/RT-Assignment-3/blob/main/third_assignment_map_rviz.png\" width=\"275\" height=\"377\"\u003e\n\u003cbr\u003e\u003cbr\u003eGazebo:\u003cbr\u003e\n\u003cimg src=\"https://github.com/simone-contorno/RT-Assignment-3/blob/main/third_assignment_map_gazebo.png\" width=\"500\" height=\"259\"\u003e\n\n\u003ca name=\"how\"\u003e\u003c/a\u003e\n### How it works\n\nThe program use the launch file \"simulation_gmapping.launch\" to run the simulated environment, and the launch file \"move_base.launch\" to run the action move_base that provides several topics, including:\n\u003cul\u003e\n    \u003cli\u003emove_base/goal to publish the goal position;\u003c/li\u003e\n    \u003cli\u003emove_base/feedback to receive the feedback;\u003c/li\u003e \n    \u003cli\u003emove_base/cancel to cancel the current goal.\u003c/li\u003e\n\u003c/ul\u003e\n\nThere are 3 subscribers that run simultaneously thanks to a multi-thread architecture given by the ROS class AsyncSpinner:\n\u003cul\u003e\n    \u003cli\u003esub_pos: subscribes to the topic /move_base/feedback through the function currentStatus that continuosly update the current goal ID and check whether the robot has reached the goal position.\u003c/li\u003e\n    \u003cli\u003esub_goal: subscribes to the topic /move_base/goal through the function currentGoal that continuosly update the current goal coordinates.\u003c/li\u003e\n    \u003cli\u003esub_laser: subscribes to the topic /scan through the function drivingAssistance that continuosly take data by the laser scanner and, if the driving assistance is enabled, help the user to drive the robot stopping its if there is a wall too close in the current direction.\u003c/li\u003e\n\u003c/ul\u003e\n\nThe robot can:\n\u003col\u003e\n    \u003cli\u003eAutonomously reaching a goal position: \n        \u003cul\u003e\n            \u003cli\u003eask to the user to insert the coordinates x and y to reach;\u003c/li\u003e\n            \u003cli\u003esave the current time;\u003c/li\u003e\n            \u003cli\u003eset the frame_id to \"map\" (corresponding to the environment that is used) and the new coordinates to reach;\u003c/li\u003e\n            \u003cli\u003epublish the new goal to move_base/goal.\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003eCancel the current goal:\n        \u003cul\u003e\n            \u003cli\u003etake the current goal ID;\u003c/li\u003e\n            \u003cli\u003epublish its to the topic move_base/cancel.\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003eBe driven by the user through the keyboard (the list of commands is printed on the console).\u003c/li\u003e\n\u003c/ol\u003e\n\nYou can change 3 constant values to modify some aspect of the program:\n    \u003cul\u003e\n        \u003cli\u003eDIST: minimum distance from the wall with the driving assistance enabled.\u003c/li\u003e\n        \u003cli\u003ePOS_ERROR: position range error.\u003c/li\u003e\n        \u003cli\u003eMAX_TIME: maximum time to reach a goal (microseconds).\u003c/li\u003e\n    \u003c/ul\u003e\nIn the code these appear like:\n``` cpp\n#define DIST 0.35 \n#define POS_ERROR 0.5 \n#define MAX_TIME 120000000 \n```\n\nA short description of the program behavior is this one:\n\u003cpre\u003e\u003ccode\u003e\nFUNCTION manualDriving\n    WHILE user does not quit\n        TAKE user input through the keyboard\n        EXEC corresponding task\n        PUBLISH new robot velocity\n    ENDWHILE\nENDFUNCTION\n\nFUNCTION drivingAssistance WITH (msg)\n    COMPUTE minimum distance on the right\n    COMPUTE minimum distance in the middle\n    COMPUTE minimum distance on the left\n    \n    IF driving assistance is enabled AND\n        the robot is going against a wall THEN\n        SET robot velocity TO 0\n        PUBLISH robot velocity\n    ENDIF\n\n    IF a goal position is set THEN\n        COMPUTE the time elapsed\n        IF the time elapsed IS GREATER THAN 120 seconds THEN\n            DELETE current goal\n        ENDIF\n    ENDIF\nENDFUNCTION\n\nFUNCTION currentStatus WITH (msg) \n    SET current robot position\n    COMPUTE the difference between the current robot position\n    and the current goal position\n    IF the difference IS LESS THAN 0.5 THEN\n        STOP to compute the elapsed time\n    ENDIF\nENDFUNCTION\n\nFUNCTION currentGoal WITH (msg)\n    SET current goal position\nENDFUNCTION\n\nFUNCTION userInterface \n    WHILE user does not quit\n        TAKE user input through the keyboard\n        EXEC corresponding task\n    ENDWHILE\nENDFUNCTION\n\nFUNCTION main WITH (argc, argv)\n    INITIALIZE the node \"final_robot\"\n\n    SET the first publisher TO \"move_base/goal\"\n    SET the second publisher TO \"move_base/cancel\"\n    SET the third publisher TO \"cmd_vel\"\n\n    SET the first subscriber TO \"/move_base/feedback\" WITH currentStatus\n    SET the second subscriber TO \"/move_base/goal\" WITH currentGoal\n    SET the third subscriber TO \"/scan\" WITH drivingAssistance\n\n    INITIALIZE spinner WITH 3 threads\n    START spinner\n    CALL userInterface\n    STOP spinner\n    CALL ros::shutdown\n    CALL ros::waitForShutdown\n\n    RETURN 0\nENDFUNCTION\n\u003c/code\u003e\u003c/pre\u003e\n\nLook the pseudocode file final_robot_pseudocode for more details.\u003cbr\u003e\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n### Installation and Execution\n\nOpen the terminal, and download this repository:\n\n\u003cpre\u003e\u003ccode\u003egit clone https://github.com/simone-contorno/rt-assignment-3\u003c/code\u003e\u003c/pre\u003e\n\nCopy or move the folder final_assignment into the src folder of your ROS workspace.\u003cbr\u003e \nGo into the root folder of your ROS workspace and type: \n\n\u003cpre\u003e\u003ccode\u003ecatkin_make\u003c/code\u003e\u003c/pre\u003e\n\nAfterwards type:\n\n\u003cpre\u003e\u003ccode\u003erospack profile\u003c/code\u003e\u003c/pre\u003e\n\nNow, open 3 terminals; in the first one launch the environment:\n\n\u003cpre\u003e\u003ccode\u003eroslaunch final_assignment simulation_gmapping.launch\u003c/code\u003e\u003c/pre\u003e\n\nIn the second one launch the action move_base:\n\n\u003cpre\u003e\u003ccode\u003eroslaunch final_assignment move_base.launch\u003c/code\u003e\u003c/pre\u003e\n\nIn the third one run the node final_robot:\n\n\u003cpre\u003e\u003ccode\u003erosrun final_assignment final_robot\u003c/code\u003e\u003c/pre\u003e\n\nAlternatively, you can launch all these nodes using the launch file final_assignment.launch, but first you need to install xterm:\n\n\u003cpre\u003e\u003ccode\u003esudo apt install xterm\u003c/code\u003e\u003c/pre\u003e\n\nNow you can type:\n\n\u003cpre\u003e\u003ccode\u003eroslaunch final_assignment final_assignment.launch\u003c/code\u003e\u003c/pre\u003e\n\n\u003ca name=\"improve\"\u003e\u003c/a\u003e\n### Improvements\n\nThe driving assistance can be improved by move the robot in the right direction when the user is driving \nits against a wall, instead of just stop it.\u003cbr\u003e\u003cbr\u003e\n\nThanks to have read this file, i hope it was clear and interesting.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimone-contorno%2Frt-assignment-3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimone-contorno%2Frt-assignment-3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimone-contorno%2Frt-assignment-3/lists"}