node_ur5_1 module

This program intends to control UR5_1 arm. UR5_1 arm function: To pick the objects from the shelf and place it on the coveyor belt.

class node_ur5_1.Camera2D

Bases: object

This class is used for getting the camera data and extracting required information.

func_callback_2D_camera(data)

Callback method for the 2D camera images.

This function receives the data from the subscription to the 2D camera topic.

Parameters

data (image structure) – This is the data received from the topic.

get_pkg_color(arg_image)

Get the color of the given package.

This function uses 2 methods to determine the package color.
  1. Reading the qr data

  2. Detecting the most prominant color in the image.

Parameters

arg_image (int[][][]) – This is the 3D array containg the image pixle values.

Returns

color of the package

Return type

string

class node_ur5_1.PriorityQueue

Bases: object

Data structure defination.

This class is defining the priority queue data structure.

delete()

This method is used for returning the max priority item in the queue.

Returns

Item with maximum priority.

insert(data)

Appending data into the queue.

is_empty()

Checking if the queue is empty.

Returns

bool value telling if the queue is empty or not.

class node_ur5_1.Ur5Moveit(arg_robot_name)

Bases: object

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

func_callback_topic_incoming_orders(data)

Callback method for the incoming orders.

This function receives the data from the subscription to the mqtt topic. The received data is inserted into the orders queue.

Parameters

data – This is the data received from the topic

func_callback_topic_logical_camera_1(LogicalCameraImage)

Callback Function for Logical Camera Subscription

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

Parameters

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

hard_play_planned_path_from_file(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_1.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_1.get_sku_str()

Month and Year string.

This function returns the current month and year.

Returns

A string of month and year.

node_ur5_1.get_time_str()

Date string.

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

Returns

A string of the data and time.

node_ur5_1.main()

Main Function

node_ur5_1.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.