{"id":31802040,"url":"https://github.com/digioref/robotics-project","last_synced_at":"2026-05-01T21:33:49.640Z","repository":{"id":313983939,"uuid":"1053626801","full_name":"Digioref/Robotics-Project","owner":"Digioref","description":"Repository for Robotics challenges at Polimi. Computation of odometry and Map Navigation.","archived":false,"fork":false,"pushed_at":"2025-09-19T10:11:47.000Z","size":1001,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-19T12:29:31.953Z","etag":null,"topics":["cpp","mapping","odometry","odometry-estimation","odometry-messages","odometry-node","polimi","politecnico-di-milano","quaternions","robotics","ros"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Digioref.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-09-09T17:51:12.000Z","updated_at":"2025-09-19T10:11:50.000Z","dependencies_parsed_at":"2025-09-09T23:29:52.177Z","dependency_job_id":"b03d2f6e-e6ff-49b0-acce-dd99762c87d2","html_url":"https://github.com/Digioref/Robotics-Project","commit_stats":null,"previous_names":["digioref/robotics-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Digioref/Robotics-Project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digioref%2FRobotics-Project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digioref%2FRobotics-Project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digioref%2FRobotics-Project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digioref%2FRobotics-Project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Digioref","download_url":"https://codeload.github.com/Digioref/Robotics-Project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digioref%2FRobotics-Project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005657,"owners_count":26083941,"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-10T02:00:06.843Z","response_time":62,"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","mapping","odometry","odometry-estimation","odometry-messages","odometry-node","polimi","politecnico-di-milano","quaternions","robotics","ros"],"created_at":"2025-10-11T00:16:17.847Z","updated_at":"2025-10-11T00:16:22.938Z","avatar_url":"https://github.com/Digioref.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Robotics: Project\n\n## Introduction\nThis is the repository for the two Projects of Robotics in the academic year 2022/2023 at Polytechnic of Milan.\n\nSubject: 089013 - Robotics\n\nProfessor: Matteucci Matteo\n\nAcademic Year: 2022/2023\n\n## Description of the Project\nThe project is divided into two sub-projects, whose specifications are:\n- First project: compute the odometry of an autonomous vehicle.\n- Second project: mapping of an environment and then map navigation.\n\nFor the first project, please refer to [first project](Specifications/first_project_2023.pdf).\n\nFor the second project, please refer to [second project](Specifications/second_project_2023.pdf).\n\nBoth pojects were done in **C++** and using **ROS** as the robot framework.\n\n### First project\nIn [first_project](first_project.zip), there are four folders: launch, msg, srv, src.\n\nIn the folder launch, there is only one file, the first_project.launch file, which is used to start the node odom_node. Inside this file, we specified:\n- the node, named odom_node;\n- 4 static transformation for the 4 robot's single plane lasers;\n- set of some node parameters: starting_x, starting_y and starting_th, all set to 0.0 as a starting value;\n- set use_sim_time to true;\n- \nUsing the command \"roslaunch first_project first_project.launch\", all the nodes should start.\n\nIn the folder msg, we defined the structure of the custom message Odom in the only file there, Odom.msg:\n- 3 fields with type float representing x, y and th;\n- a string named timestamp representing the time;\n\nIn the folder srv, we defined the structure of the service reset_odom in the file reset_odom.srv. Inside the file, we specified:\n- a boolean resetted, which is the return value of the service, set to true when the odometry is resetted;\n- no input;\n\nIn the folder src, there is the source code of the node, inside a file called odom_node.cpp, written in C++ language. In this file, we created:\n- a class called odom_node;\n- a main function;\n\nIn the main function, the node is initialized with \"ros::init\" and the odom_node is created.\nThe class has some private features and some methods.\nThe private features are:\n- n, the NodeHandle;\n- sub_odom, which is a subscriber subscribed to the topic \"speed_steer\";\n- pub_odom, a publisher which publishes messages about the topic \"odometry\";\n- pub_custom, a publisher which publishes messages about the topic \"custom_odometry\";\n- starting_x, starting_y and starting_th are the values used for the computation of the odometry;\n- t_prev is the previous time;\n- transform_broadcaster publishes the transformation;\n- odomTransform is a TransformStamped message published by the transform_broadcaster;\n- reset_service is the service which, when it's called, resets the starting values (sets each of them to 0.0);\n\nThen, there is the method odom_node(), which:\n- takes the starting values for starting_x, starting_y and starting_th from the first_project.launch file;\n- sub_odom subscribes to the \"speed_steer\" topic;\n- pub_odom and pub_custom are connected to the corresponding topic (\"odometry\" and \"custom_odometry\", respectively);\n- reset_service is connected to the callback (reset_odom);\n\nAfter this method, we defined the methods used for the computation of the odometry and the publication of the messages.\n\nThe method calculate_odometry, as its name underlines, calculates the odometry of the robot. We considered the kinematics of the robot as an Ackermann ssteering, using the bycicle approximation. In the calculus, we used the 2nd order Runge-Kutta integration for a better approximation.\n\nFirst of all, we computed the angular velocity of the robot using the data provided by the \"speed_steer\" topic and the following formula:\n\n**ω = V ∙ tan(α) / d**, \n\nwhere d = 2.8 and α is the steering angle.\n\nThen, the pose is computed:\n\n**xk+1 = xk + vkT cos(θk + ωkT/2)**\n\n**yk+1 = yk + vkT sin(θk + ωkT/2)**\n\n**θk+1 = θk + ωkT**\n\n**T = tk+1 - tk**\n\nwhere (xk+1, yk+1, θk+1) is the next pose, while (xk, yk, θk) is the previous one, and T is the delta time.\nAfter the computation, the methods publishTFOdometry and publishOdometry are called and the new pose is assigned to the old one.\n\nThe method publishTFOdometry takes in input the new pose (x_next, y_next, theta_next) and the time and publishes the odomTransform (a TransformStamped message), which has several features:\n- stamp, which is the time, which the input value is assigned to;\n- header.frame_id, which is the parent's reference frame, so it is set to \"odom\";\n- child_frame_id, which is the robot's reference frame, so it is set to \"base_link\";\n\nThen, we set odomTranform's translation according to the values in input and we created a Quaternion, setting it using the provided theta. Finally, we set odomTransform's rotation using the Quaternion and, using the transform_broadcaster, the odomTransform message is published.\n\nIn the publishOdometry, we did similar steps. We created two messages, an Odom message and an Odometry message. The Odom message is the custom one, so we set its features (x, y, theta, timestamp) using the values in input. While, for the Odometry message, we proceeded in the same way as for the tf aforementioned, adding the velocity, linear and angular, set according to the input values. Finally, both messages are published using the corresponding publisher.\n\nThe last method is reset_odom, the callback method of the service. It sets to 0.0 all the starting features and set to true the boolean resetted, returning true.\n\n### Second Project\nFor mapping we decided to use slam toolbox instead of gmapping mainly for the ease of use.\nWe decided to clean the map a little for navigation even though we probably didn't need to. \nWe also decided to move the robot's starting position to the bottom-left corner to make it easier to plan the path with the waypoints.\nDuring mapping we used a node to publish the tf.\n\nFor localization we used amcl as written in the specifics.\nFor path planning we used the base global planner and teb local planner with clearing rotation.\nTo move the robot we used move_base and used our node as an action client to publish the goals.\n\nFor the navigation node we decided to read 4 variables from the csv file x and y for the position and z and w of a quaternion for the heading. (We could have easily used radiants then convert them in a quaternion but we preferred to use the quaternion values directly).\n\nTo load the waypoints.csv file, we used \"getParam\" in the node navigation to get the path of the file, which is set in the launch file as a parameter, and then the file is opened using ifstream.\n\nFor the code, check the zip folder [second_project](second_project.zip)\n\n## Final Considerations\nFirst Project Mark: 3.0/3.0\n\nSecond Project Mark: 3.0/3.0\n\n## Authors\nThis Project was developed by:\n- Francesco Di Giore [@Digioref](https://github.com/Digioref)\n- Federico de Introna [@federicodeintrona](https://github.com/federicodeintrona)  \n- Carlo Arnone [@CarloArnone](https://github.com/CarloArnone)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigioref%2Frobotics-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigioref%2Frobotics-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigioref%2Frobotics-project/lists"}