Welcome to Research Track 2 documentation!

Indices and tables

Robot_Controller documentation!

This is the documentation of the Robot_Controller package!

Firstnode Module

This node implements a controller for a robot using the ROS framework.

Clients:

/client_A

scripts.Firstnode.cancel_target()[source]

This function sends a cancel command to the action server, effectively cancelling the current planning goal.

scripts.Firstnode.interface_space()[source]

This function displays a controlling panel with a welcome message and a list of options the user can select from. The function takes user input and calls the appropriate function based on the input.

scripts.Firstnode.target_client()[source]

This function allows the user to enter the position of the robot’s target and sends it to the action server. The function waits for the action server to start, publishes a PlanningGoal message with the target position, and sends it to the action server using a SimpleActionClient. This function sends a message to the action server using ‘SimpleActionClient’

Secondnode Module

This ROS node is to receive the Odometry messages from the “/odom” topic, extract the position and linear velocity data from the received message, and publish it as a custom message of type custom_msg to the “chatter” topic.

Subscribes to:

/odom

Publishes to:

chatter

scripts.Secondnode.Initialize()[source]

This function initializes the node with the name “secondnode” using the rospy.init_node() method. It also creates a subscriber to listen to the “/odom” topic with the message type Odometry

scripts.Secondnode.cl_bck(data)[source]

This function is the callback function that is called each time a new Odometry message is received on the “/odom” topic. The function extracts position and linear velocity data from the message and assigns it to the corresponding fields of the custom_msg message. Then, it prints the message to the console and publishes it to the “chatter” topic using the publisher pub.

The velocity and position is published as custom_msg message, which is subscribed in scripts.Fourthnode

Thirdnode Module

This node is to track the number of times a robot reaches a goal and the number of times a goal is canceled.

Subscribes to:

/reaching_goal/result

scripts.Thirdnode.cl_bck(req)[source]

This function is called when the service “reach_cancel_ints” is called. It prints the current values of the global variables cancelation_times and reaching_times and returns an empty response.

Parameters

req (msg) – a request message of type Empty.

scripts.Thirdnode.cl_bck_sub(data)[source]

This function checks the status field of the message to determine whether the goal was reached or canceled. If the goal was canceled, it increments the cancelation_times counter. If the goal was reached, it increments the reaching_times counter.

Parameters

data – a message of type assignment_2_2022.msg.PlanningActionResult

Fourthnode Module

This node is to calculate information includes the distance to a objective position and the average velocity of the robot.

Subscribes to:

/chatter

scripts.Fourthnode.cl_bck_sub(value)[source]

This is a callback function which takes in a message of type custom_msg and calculates the distance to a specific position and the average velocity of the object based on the data in the message.

Parameters

value (msg) – a message received from the /chatter topic.