node_ur5_2 module

This program intends to control UR5_2 arm. UR5_2 arm function: To sort the packages according to their respective colours.

class node_ur5_2.Ur5Moveit(arg_robot_name)

Bases: object

This class defines the robot and planning function of the ur5 arm.

func_callback_logical_camera(msg)

Callback Function for Logical Camera Subscription

This method is used for determining the presence of a package on the conveyor belt.

Parameters

msg – This is a msg received from the logical camera containing the the objects and their position and orientation on the conveyor belt.

func_callback_package_details(msg)

Callback function

This method assigns the string which is published on the topic topic_package_details.

Parameters

msg (string) – Msg obtained from the topic topic_shipped_data containing various attributes. packageName(string): Name of the package sent, color(string): Color of the package, city(string): Destination city of the package, orderid(string): Order ID assigned to the package.

func_publish_orders_shipped(city, color, orderid)

Publish function This method returns the string which is published on the topic topic_shipped_data.

Parameters
  • city (string) – Destination city of the package.

  • color (string) – Color of the package.

  • orderid (string) – Order ID assigned to the package.

hard_play_planned_path(arg_file_path, arg_file_name, arg_max_attempts)

Hard playing the saved trajectories from file. This method hard plays the trajectories till the path is played or maximum attemps have been made.

Parameters
  • arg_file_path (string) – Path of the file containing the trajectory.

  • arg_file_name (string) – Name of the file containing the trajectory.

  • arg_max_attempts (int) – Maximum number of attempts to play the file.

Returns

True-> Path executes || False-> Failed to execute the path

Return type

bool

on_transition(goal_handle)

State Machine : /action_ros_iot

This method will be called when there is a change of state in the Action Client.

Parameters

goal_handle – This is a structure containing attributes related to the goal sent.

play_planned_path_from_file(arg_file_path, arg_file_name)

Loading the trajectories from the file and executing. This method executes the the plan stored in the config folder.

Parameters
  • arg_file_path (string) – Path of the file containing the trajectory.

  • arg_file_name (string) – Name of the file containing the trajectory.

Returns

True-> Path executes || False-> Failed to execute the path

Return type

bool

send_spreadsheet_pub_goal(arg_protocol, arg_mode, arg_topic, arg_message)

Method to send Goals to Action Server: /action_ros_iot

This method is called for publishing the messages to the action server.

Parameters
  • arg_protocol (string) – Protocol used for sending the data. eg: mqtt, http.

  • arg_mode (string) – Mode of communication. eg: pub:Publishing the data, sub: Subscribing

  • arg_topic (string) – Name of the channel of communication.

  • arg_message (string) – Message to be sent through the topic.

Returns

A goal handle is returned.

Return type

goal handle

Note

The data type of arg_message is dependent on the defination of the message. In this case we are using a string.

node_ur5_2.activate_vacuum_gripper(state)

Enable/Disable Gripper Module

This function enables and disables the vaccum gripper on the arm.

Parameters

state (bool) – Required state of the vaccum gripper.

Returns

The service of activating the vaccum gripper is provided.

node_ur5_2.get_est_time_str(offset)

Date string.

This function is used to get the date after adding the offset date and extract current time in yyyymmdd format.

Parameters

offset (int) – Days which are to be added to the date.

Returns

The date after offset number of days.

node_ur5_2.get_time_str()

Date string.

This function is used to get the current time and time in yyyymmdd format.

Returns

string of the data and time.

node_ur5_2.main()

Main Function

node_ur5_2.set_conveyor_belt_speed(speed)

Control Conveyor Belt Speed This function allows us to control the speed of the conveyor belt using the service /eyrc/vb/conveyor/set_power.

Parameters

speed (int) – This value ranges from 0-100. Input value is directly proportional to power set.

Returns

The service call’s output is reflected in the world’s conveyor belt.