Difference between revisions of "PhantomX Reactor Robot"

From RobolaboWiki
Jump to: navigation, search
Line 170: Line 170:
 
and it will move to the specified position.
 
and it will move to the specified position.
  
<h1> Practice 1 (P1) Template </h1>
+
<h1> Practice 1 Template (P1)</h1>

Revision as of 11:12, 17 October 2016

Note: Most of the information of this website is obtained from: http://learn.trossenrobotics.com/projects/182-arbotix-getting-started-guide-arduino-ide-1-6-x-setup.html Please refer to the previuos link if you need more information.

Configuring the environment

Setting up the Arduino Software

  • Download the Arduino IDE 1.6.x according to your operating system from: https://www.arduino.cc/en/Main/Software .
  • Install the Arduino IDE
    • If you have chosen to download the installer, run the installer and install the software in a path of your convenience.
    • If you have chosen to download the sources (Linux or zip on Windows), uncompress the software in a path of your convenience
  • Open/run Arduino IDE, so it will create all the folders needed
  • Close Arduino IDE

Installing Tools and Libraries

  • Download the robot libraries from: here .
  • Uncompress the libraries to a path of your convenience. In this file you will find two folders: hardware and libraries
  • Copy both folders to the <ARDUINO_MAIN_DIRECTORY>. In some Windows you will find this folder in My Documents\Arduino\ , while in others you will find it in Documents\Arduino\ . In Linux you will find this folder in ~/Arduino/.
    Important: If you already have a libraries folder inside your <ARDUINO_MAIN_DIRECTORY>, move the content of the libraries folder downloaded inside the libraries folder of <ARDUINO_MAIN_DIRECTORY>.

Check installation

  • Open/run Arduino IDE
  • Open a Robot Test:
  •  
    File -> Examples -->ArbotiX --> Tests --> ReactorTest
    
  • Select the Arbotix board
  • Tools -> Board -> ArbotiX Std
    
  • Compile the program
  • Program-> Verify/Compile
    

    If there is no errors, you are ready for the next step. If you found some errors, please review the previous steps.

  • Close Arduino IDE

Installing FTDI drivers

If you are using Linux or Mac, skip this step. If you are using Windows, power up the robot and connect it to your computer. Windows should ask you to install some FTDI drivers to be able to connect to the robot.

Hello World example

We have created a helloWorld example to test the communication with the robot. Please download it from here in your prefered destination. Untar the file:

tar -xvzf helloWorld.tgz

Compiling the code

  • Open Arduino IDE and load the .ino file in your environment:
  • File --> Open --> <HELLOWORLD_EXAMPLE>
    
  • Select the Arbotix board:
  • Tools -> Board -> ArbotiX Std
    
  • Compile the program:
  • Program-> Verify/Compile
    

    Downloading the code to the robot

    Once compiled, select the correct por to download the binaries: In Linux, typically:

    tools -> Port -> /dev/ttyUSBX
    

    In Windows, typically:

    tools -> Port -> COMX
    

    where X depends on your system and the number of peripherals on it

    Upload your code to the board:

    Program -> Upload
    

    The IDE will notify that it is uploading and after some seconds it will say uploaded .

    Playing with HelloWorld

    This example allows you to move different joints of the robot.

    Once the code have been loaded, you can open the serial port:

    Tools --> Serial Monitor
    

    In some seconds you should see the board communicating the following menu:

    
    ################################
    Serial Communication Established
    ################################
    ################################
    Please enter option 1-6
    0) Relax Servos
    1) Hold Servos
    2) Get Joints Pos
    3) Gripper Close
    4) Gripper Open
    5) TestAllJoints
    6) MoveSpecificJoint
    ################################
    

    Lets explain the different options

    • Option 0 unpowers the servomotors of the robot.
    • Option 1 powers the servomotors of the robot.
    • Option 2 prints the position of every generalized coordinate (Base, Shoulder, Elbow, Wrist and Wrist rotation).
    • Option 3 closes the gripper.
    • Option 4 opens the gripper.
    • Option 5 provides a test movement for the complete robot.
    • Option 6 allows to move specific joints. In this case, once the option is selected, the following menu will appear:
    Base: 0
    Shoulder: 1
    Elbow: 2
    Wrist: 3
    Wrist Rot: 4
    
    Joint to move?: 
    

    The user must choose one of the 5 options, which correspond to different joints.

    For every joint, once selected, the program will ask for a position to move, given the limits of the joint, for example:

    Joint selected: 1
    Shoulder: [-0.33, 2.97]
    Position to move?: 
    

    Once the position is provided through the serial port it will return all the information inserted, for example:

    Moving Joint: 1 to position: 1.57
    

    and it will move to the specified position.

    Practice 1 Template (P1)