Welcome to RT1_assignment2’s documentation!

Indices and tables

RT1_assignment2 Documentation

This is the documentation for the package developed for the second assignment of the Research Track 1 class. The package provides three different node modules, a launch file, a message structure and a service structure.

Node A module

This node implements a controller for the robot in the envoiroment of the package assignmnet_2_2022 . It asks the user to insert the coordinates the robot has to reach and then it gives the user the possibility to cancel them until the robot hasn’t reached the desired position.

The nodes also publishes the robot’s velocity and position and it is the server of a service providing information about the number of position reached and cancelled.

Subscriber:
/odom
Publisher:
ass/pos_vel
Server:
ass/goal
Action Client:
/reaching_goal
src.nodeA.clbk_odom(msg)[source]

callback function that publishes robot’s velocity and distance from the desired position. It reads robot’s current position and velocity and compute the distance from the desired position. Then it sets the correct field of the message to pubblish and publishes it on the topic ‘ass/pos_vel’. This is used by nodeC.

Args: msg(nav_msgs::Odometry): message published on the ‘/odom’ topic describing robot current position and velocities.

Returns: None

src.nodeA.clbk_srv(req)[source]

callback function executed upon request by the service server. The function sends as response the number of goal(position) reached by the robot and the number of goal cancelled. The service and this function are used by nodeB

Args: req(GoalRequest): null

Returns: response(GalResponse): number of goal reached and cancelled

src.nodeA.nodeA_client()[source]

This function initializes a assignment_2_2022.msg::Planning Action client and wait for the server. Once a server is found in a while loop the function:

-asks the user to insert the cordinate to reach

-sends them to the action server

-cancels the goal if the user asks to

Once the goal is reached or canceled the instructions above are executed again.

The cordinates to reach are of type geometry_msgs::Point and only the value of x and y are set by the user. They are taken from input as two different float and the corresponding field of a geometry_msgs::Point variable are set. The coordinates to reach are then send to the assignment_2_2022.msg::Planning ActionServer as goal.

Args: none

Returns: none

Node B module

This node sends a request to the Goal Service and prints it’s response, which contains the number of goal reached by the robot and the number of goal the user cancel.

Client of:
ass/goal

Node C module

This node subscribes to the messages Custom published by nodeA and updates the value of robot current velocity and distance from target. Then it printes them with a frequency which is set in the ros parameter my_freq.

Subscriber:
ass/pos_vel
Ros parameter:
my_freq
src.nodeC.clbk(msg)[source]

Callback function executed each time a new message of type Custom is publish on the topic ‘ass/pos_vel’. The function updates the value of the node variables containg information about robot current velocity and distance from target.