AMIGO ROS Script

From Control Systems Technology Group

(Difference between revisions)
Jump to: navigation, search
Line 27: Line 27:
In the code in line 37 it is extra defined that the data to be received over the topic indicated with the name "multiarray" is a ''Float64MultiArray''
In the code in line 37 it is extra defined that the data to be received over the topic indicated with the name "multiarray" is a ''Float64MultiArray''
-
type of message. In line 38-39 an array of 14 numbers is defined. In line 41 an action called ''move_arms'' is called for. This more or less executes
+
type of message. In line 38-39 an array of 14 numbers is defined. In line 40 an action called ''move_arms'' is called for. This more or less executes
the action in which an array of 14 can be processed into coordinates for AMIGO's arms. This action is defined in the next section of the script.
the action in which an array of 14 can be processed into coordinates for AMIGO's arms. This action is defined in the next section of the script.
-
 
+
The code in line 43 makes sure that the node "armTrajCopier" initiated can receive information from the topic

Revision as of 20:18, 16 June 2016

The ROS script used for our project involving AMIGO is given below.

File:AmigoROSScriptPart1.png

In the first lines of the script a lot is imported. All import (..) lines are there to import and open multiple kinds of software and files that are required to succesfully execute the script. Import python is meant to indicate the code language python, which is the programming language this script is made with. Most other imported items were derived from the example script this script was based on. Their function is not known to us, but they are required to be imported nonetheless. Import startup imports a file name startup. The part between "from" and "import" indicates the directory or folder this file comes from. Import Float64MultiArray imports a type of message from a folder. This is a predefined type of message that is to send and received over the topic by the script. This type of message can be used to send arrays over a topic and is thus what needed to receive the proper information from the Kinect.

It is to be noted that you need to have these folders and files installed in order to import them in the script. The message types come with the installation of ROS and the startup file comes most likely once all AMIGO related software and files are installed.

File:AmigoROSScriptPart3.png

A class is defined. This is done so that the script initializes and can be ran. Thereafter a node corresponding to the script is initialized so that data can be received. This node is called "armTrajCopier".

This is followed by a few lines(22-25) that came with the example script. These are lines of code that execute parts of the starting up of the script when it is executed. The code in lines 26-35 requires an extra argument to be given when the script is executed in the terminal. The word "amigo" is required to be given, which will result in the script importing the robot model of AMIGO. If the word "amigo" is not inserted after the running command the script will not run.(The script could normally be executed by typing /.armTrajCopier.py in the terminal, but due to this code it can now only be executed by typing /.armTrajCopier.py amigo).

In the code in line 37 it is extra defined that the data to be received over the topic indicated with the name "multiarray" is a Float64MultiArray type of message. In line 38-39 an array of 14 numbers is defined. In line 40 an action called move_arms is called for. This more or less executes the action in which an array of 14 can be processed into coordinates for AMIGO's arms. This action is defined in the next section of the script.

The code in line 43 makes sure that the node "armTrajCopier" initiated can receive information from the topic



File:AmigoROSScriptPart2.png

Personal tools