Skip to content

Software OpenCR Arduino

williamrousseau edited this page Apr 19, 2020 · 3 revisions

Software setup

Firstly, the workspace must be set up. this website contains all the relevant information, but the main step for a setup on Windows10 will be described here.

Worskspace Setup :

1. Arduino IDE

Download and install Arduino Ide on this website: https://www.arduino.cc/en/Main/Software Keep all the default options during the installation.

2. Preferences

On arduino IDE, on File-> preferences. When the Preferences window appears, copy and paste following link to the Additional Boards Manager URLs textbox. (This step may take about 20 min.) https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json

3. OpenCR setup

Click Tools → Board → Boards Manager. Type OpenCR into the textbox to find the OpenCR by ROBOTIS package. After it finds out, click Install. After the installation, “INSTALLED” will be appeared. See if OpenCR Board is now on the list of Tools → Board. Click this to import the OpenCR Board source

4. PWMServoDriver setup

You need to download the library PWM-Servo-Driver via https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library to the library file of the Arduino IDE in your PC. After the library has been downloaded, in Arduino IDE → Click sketch → Add a library → Manage the lybrary and then the PWM-Servo-Driver library must appear.

5. OpenCR Testing

To see if the installation worked, plug your OpenCr card via an USB port, it should appears in Tools → Port → COMX where X is the number of the usb port (1,2,3...) You can also test the exemples in FILE → EXEMPLES → OpenCr → "any exemple code" Your workspace should be fine. If not refers to this documentation

6. Code Setup

Simply upload the latest code version in the OpenCr.

Software normal usage

It is made to be controlled via the list below at any time:

  • Serial Monitor of the Arduino IDE
  • Raspberry Pi Terminal Window
  • Application

Before Opening the Drawer, make sure that the ReerSwitch is activated (It means that the drawer is completely closed and a magnet is on the Reerswitch)

IF YOU DON'T HAVE ANY SAVINGFILE OR NOT CONNECTED TO A RASPBERRY PI, PUT SavingFile=false at line 90

Drawer Setup :

The code relative to the drawer is identified in the XXXX.ino file. In this section the user MUST adjust the drawer_depth variable value based on his own drawer. We recommend to begin with a value under the one measured, and slightly increasing it after some tests.

Normal drawer usage

The drawer will only open when it receives the instruction to open and if the reer switch in the back of the drawer detects a magnet (signifying that the drawer if closed). Similarly, the drawer will only close if it is opened AND it has not been moved since its last opening operation. If it has been moved, the user must close the drawer completely and send a reset request with the app. With those constraints, the software protect the hardware from a request that could lead to the Dynamixel to force against a completely opened/closed drawer.


Code explainations

Functions

Many functions can be used the control the Servos or the Dynamixel.

All Input must be write between start markers and end markers: <function> <drawer> <open> When you call a function, you enter in a loop and you can't come back until you send <back>

Functions

position section

 <position> ======================================== To enter in the position loop 
           |<motors> =============================== To move Joint by Joint   
           |        |<X> =========================== To move the motor X
           |        |   |<left> ==================== To move to the left
           |        |   |<right> =================== To move to the right
           |        |   |<------|<stop> ============ To stop the movement
           |        |   |       |**NOTE**
           |        |   |       |  To Stop, send any input to the serial and then <stop>
           |        |<--|<back> ==================== To Select another Servo
           |        |<save> ======================== To save the actual position
           |        |<-----|<X> ==================== To save in the position No.X
           |<-------|<back> ======================== To Select another function in position loop   
           |<saved_positions> ====================== To go to a position previously saved
           |                 |<X> ================== To go to the position X
           |                 |<--|<stop> =========== To stop the movement
           |                 |   |**NOTE**
           |                 |   |  To Stop, send any input to the serial and then <stop>
           |<----------------|<back> =============== To return to the position loop         
  <--------|<back> ================================= To return to the main loop

function section

   <function> ====================================== To enter in the function loop
             |<drawer> ============================= To Open or Close the Drawer 
             |        |<open> ====================== To Open the drawer (Careful, the reerswitch must be on. It means that it need a magnet on it)
             |        |<close> ===================== To Close the drawer
             |        |<reset> ===================== To reset the position of the Drawer to the actual position
             |<-------|<back> ====================== To return to the function loop
             |<gripper> ============================ To Open or Close the gripper
             |         |<open> ===================== To open the gripper
             |         |<close> ==================== To close the gripper
             |         |<------|<stop> ============= To stop when its enough opened or closed
             |         |       | **NOTE**
             |         |       |   To Stop, send any input to the serial and then <stop>
             |<--------|<back> ===================== To return to the function loop
             |<icecube> ============================ To Open or Close the IceCube finger
             |         |<open> ===================== To open the gripper
             |         |<close> ==================== To close the gripper
             |         |<------|<stop> ============= To stop when its enough opened or closed
             |         |       |**NOTE**
             |         |       |  To Stop, send any input to the serial and then <stop>
             |<--------|<back> ===================== To return to the function loop
    <--------|<back> =============================== To return to the main loop                             

List of all functions only for Serial monitor or Terminal Window

   <setspeed><X> =================================== To modify the speed at X
                       
                             POSITION SECTION
   <PtDisplay><X>  ================================= To display the position X
   <PtAllDisplay>  ================================= To display all the positions (Used to save all positions each time a position is changed)
   <PtRename><XX><HOME> ============================ To name the position XX HOME 
   <PtInit><1> ===================================== To reset the position 1
                        
                             PROGRAM SECTION
    <ProgAddPt><X><Z> =============================== To add a position in the program X after the position Z 
    <ProgRun><X> ==================================== To run the program No.X 
    <ProgDisplay><X> ================================ To display program No.X 
    <ProgAllDisplay> ================================ To display all programs
    <ProgRename><X><GoHome> ========================= To change the Name of the program for GoHome
    <ProgModify><X><H> ============================== To modify position H in program X
    <ProgPtRename><X><W><RETREAT> =================== To change the name of the position W in the program X for RETREAT
    <ProgSupressPt><X><Z> =========================== To supress position Z of program X 
  

Clone this wiki locally