ABB fabrication runner

Note

Outdated.

Note

Requires compas_rrc. Follow the installation steps in Installation.

Requirements

  • Virtual or real ABB controller with compas_rrc’s rapid set up.

  • Python >=3.7

  • Docker desktop

  • abb-driver image from compas_rrc

Fabrication data

Fabrication data is created in Grasshopper, see Grasshopper files. The information is stored as a list of rapid_clay_formations_fab.fab_data.ClayBullet dumped to a JSON file.

The JSON file can be edited from Grasshopper after initial creation.

Fabrication configuration

Fabrication configurations are stored as YAML files which allows for easy editing.

Default configuration
# Fabrication run config for abb_rcf_runner
# YAML format, https://yaml.org/spec/1.2

logfile: C:\rcf_robotcontrol\04_logs\fab.log
robot_client:
    controller: virtual
    docker:
        timeout_ping: 2
        sleep_after_up: 2
    wobjs:
        pick: wobj0
        place: wobj0

    tools:
        pick_place:
            name: t_A057_ClayTool02 # name of tool
            io_pin_needles: doUnitC1Out1 # name of DO
            extend_signal: 1 # state (0 or 1)
            retract_signal: 0 # state (0 or 1)
            needles_pause: 0.5 # Seconds to wait before and after extending or
                               # retracting needles

    wait_at_place_egress: 0

    robot_movement:
        global_speed_accel:
            speed_override: 100 # %
            speed_max_tcp: 500 # mm/s
            accel: 100 # mm/s^2
            accel_ramp: 100 # %, optional, default 100, the rate at which acceleration
                        # increases or decreases as a percentage of the normal values
        speed:
            # velocities defined as mm/s
            pick: 200 # mm/s
            travel: 600 # mm/s
            place: 120 # mm/s

        zone:
            # Either rapid variable name or mm
            pick: Z10
            place: Z10
            place_egress: Z20
            travel: Z100

        joint_positions:
            start: [ -127.0, 54.0, 9.0, -2.0, 30.0, 7.0 ] # 6 joint values in degrees
            end: [ -127.0, 54.0, 9.0 , 2.0 , 30.0, 7.0 ] # 6 joint values in degrees
        skip_all_pick_movements: false

Fabrication run

Run the script from a terminal using the command :code:python -m rapid_clay_formations_fab.abb.run. There are some flags that can be set when running this command:

$ python -m rapid_clay_formations_fab.abb.run --help
usage: run.py [-h] [-t {real,virtual}] [-q] [--debug] [--skip-logfile]
           [--skip-progress-file]

optional arguments:
  -h, --help            show this help message and exit
  -t {real,virtual}, --target {real,virtual}
                        Set fabrication runner target.
  -q, --quiet           Don't print logging messages to console.
  --debug               Log DEBUG level messages.
  --skip-logfile        Don't send log messages to file.
  --skip-progress-file  Skip writing progress to json during run.

Run setup

Select target (real or virtual controller) and configuration file.

$ python -m rapid_clay_formations_fab.abb.run
{{timestamp}}:INFO:<module>:rapid_clay_formations_fab version: {{version}}
? Load config or use default?  (Use arrow keys)
» Default.
  Load.
? Load config or use default?  Default.
{{timestamp}}:INFO:interactive_conf_setup:Default configuration loaded from package
? Target?  (Use arrow keys)
» Virtual robot
  Real robot
? Target?  Virtual robot
{{timestamp}}:INFO:interactive_conf_setup:Target is VIRTUAL controller.
[...]

Next docker-compose up runs to make sure these three containers are running:

  • ros-master

  • ros-bridge

  • abb-driver

[...]
ros-master-driver is up-to-date
ros-bridge-driver is up-to-date
abb-driver is up-to-date
[...]

Next, select fabrication file using the open file dialog.

[...]
{{timestamp}}:INFO:main:Fabrication data read from: {{path to json-file}}
{{timestamp}}:INFO:main:x items in clay_bullets.
[...]

Now the connection to ROS is set up, and the script tries to ping the controller. If there is no response, the docker container abb-driver is restarted. This is because of some issues with reconnecting with ROS to the controller.

[...]
{{timestamp}}:INFO:onOpen:Connection to ROS MASTER ready.
{{timestamp}}:INFO:check_reconnect:No response from controller, restarting abb-driver service.
Recreating abb-driver ... done
[...]

After the connection is set up the fabrication data is checked for ClayBullets with the attribute placed, if found the scripts prompts the user if they want to skip ClayBullets.

[...]
? Some or all bullet seems to have been placed already.  (Use arrow keys)
» Skip all bullet marked as placed in JSON file.
  Place all anyways.
  ---------------
  Place some of the bullets.
[...]

Finally, there is a last confirmation before the robot starts moving.

[...]
? Ready to start program?  (Y/n)
[...]

During the run

The script then goes through the list and sends commands to pick and place clay cylinders. There’s timers set for the pick and place procedures which is used to calculate cycle time for every bullet. This together with the time of placement is stored in the ClayBullet in the attributes cycle_time and placed.

The list of ClayBullets is continually written to a file in the same directory as the original fabrication data file, but with “IN_PROGRESS” prepended to the file name.

This is to record the cycle time and time of placement, but also to create a file that an interrupted run can use as a start point. This makes resuming a fabrication run after an interruption easy.

The progress of the fabrication run is printed in the terminal as well as on the flexpendant:

[...]
{{timestamp}}:INFO:main:Bullet 000/1827 with id 18280.
[...]

End of run

[...]
{{timestamp}}:INFO:main:Finished program with x bullets.

When all ClayBullets are placed the "IN-PROGRESS" file is moved to 00_done, in the same directory as the original fabrication file.