Skip to content

Commit

Permalink
feat(app): Enable support for IPv4 wired robots by default (#2090)
Browse files Browse the repository at this point in the history
Fixes #990, fixes #1964
  • Loading branch information
mcous authored Aug 22, 2018
1 parent 5108f21 commit d3a3afa
Show file tree
Hide file tree
Showing 29 changed files with 175 additions and 888 deletions.
12 changes: 10 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,20 @@ Be sure to check out the [API `README`][api-readme] for additional instructions.

```shell
# run API with virtual robot
make -C api dev ENABLE_VIRTUAL_SMOOTHIE=true
# run API with robot's motor driver connected via USB to UART cable
make -C api dev
# run API with robot's motor driver connected via USB to UART cable
make -C api dev ENABLE_VIRTUAL_SMOOTHIE=false

# push the current contents of the api directory to robot for testing
# defaults to currently connected ethernet robot
make push-api
# takes optional host variable for other robots
make push-api host=${some_other_ip_address}

# SSH into the currently connected ethernet robot
make term
# takes optional host variable for other robots
make term host=${some_other_ip_address}
```

### Releasing (for Opentrons developers)
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ ifeq ($(watch), true)
cover := false
endif

# run at usage (=), not on makefile parse (:=)
usb_host = $(shell yarn run -s discovery find -i 169.254 fd00 -c "[fd00:0:cafe:fefe::1]")

# install all project dependencies
# front-end dependecies handled by yarn
.PHONY: install
Expand Down Expand Up @@ -53,14 +56,24 @@ install-types:
flow-typed install --overwrite --flowVersion=0.61.0

.PHONY: push-api
push-api: export host = $(usb_host)
push-api:
$(MAKE) -C $(API_LIB_DIR) push
$(MAKE) -C $(API_DIR) push
$(MAKE) -C $(API_DIR) restart

.PHONY: api-local-container
api-local-container:
docker build --no-cache --build-arg base_image=resin/amd64-alpine-python:3.6-slim-20180123 --build-arg running_on_pi=0 --build-arg data_mkdir_path_slash_if_none=/data/system .
docker build . \
--no-cache \
--build-arg base_image=resin/amd64-alpine-python:3.6-slim-20180123 \
--build-arg running_on_pi=0 \
--build-arg data_mkdir_path_slash_if_none=/data/system

.PHONY: term
term: export host = $(usb_host)
term:
$(MAKE) -C $(API_DIR) term

# all tests
.PHONY: test
Expand Down
9 changes: 0 additions & 9 deletions app-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,6 @@ Full name of app user to populate "Name" in support conversations.

Email of app user to populate "Email" in support conversations.

##### discovery.enabled

* CLI argument: `--discovery.enabled`
* Environment variable: `OT_APP_DISCOVERY__ENABLED`
* JSON path: `discovery.enabled`
* Default: `false`

Enables experimental robot discovery client for improved robot tracking.

##### discovery.candidates

* CLI argument: `--discovery.candidates`
Expand Down
2 changes: 0 additions & 2 deletions app-shell/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const DEFAULTS: Config = {

// robot discovery
discovery: {
// new discovery client feature flag
enabled: false,
candidates: []
}
}
Expand Down
6 changes: 1 addition & 5 deletions app-shell/src/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import assert from 'assert'
import groupBy from 'lodash/groupBy'
import map from 'lodash/map'
import noop from 'lodash/noop'
import uniqBy from 'lodash/uniqBy'
import Store from 'electron-store'

Expand Down Expand Up @@ -33,9 +32,6 @@ let client

export function registerDiscovery (dispatch: Action => void) {
config = getConfig('discovery')

if (!config.enabled) return noop

store = new Store({name: 'discovery', defaults: {services: []}})

client = DiscoveryClient({
Expand Down Expand Up @@ -73,7 +69,7 @@ export function registerDiscovery (dispatch: Action => void) {
}

export function getRobots () {
if (!client || !config || !config.enabled) return []
if (!client) return []

return servicesToRobots(client.services)
}
Expand Down
8 changes: 1 addition & 7 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,14 @@ dist:

.PHONY: dev
dev:
concurrently --no-color --kill-others --names "server,mdns,shell"\
concurrently --no-color --kill-others --names "server,shell" \
"$(MAKE) dev-server" \
"$(MAKE) dev-mdns" \
"$(MAKE) dev-shell"

.PHONY: dev-server
dev-server:
$(env)=development PORT=$(port) webpack-dev-server --hot

# TODO(mc, 2017-10-31): remove when API is capable of advertising itself
.PHONY: dev-mdns
dev-mdns:
$(env)=development node scripts/advertise-local-api.js

.PHONY: dev-shell
dev-shell:
wait-on http-get://localhost:$(port) && \
Expand Down
1 change: 0 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@opentrons/components": "3.3.0-beta.1",
"@opentrons/shared-data": "3.3.0-beta.1",
"@thi.ng/paths": "^1.3.8",
"bonjour": "^3.5.0",
"classnames": "^2.2.5",
"electron": "1.8.3",
"history": "^4.7.2",
Expand Down
75 changes: 0 additions & 75 deletions app/scripts/advertise-local-api.js

This file was deleted.

5 changes: 2 additions & 3 deletions app/src/components/calibrate-pipettes/Pipettes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {InstrumentGroup, AlertItem} from '@opentrons/components'
import styles from './styles.css'

type Props = {
name: string,
pipettes: Array<Pipette>,
currentPipette: ?Pipette,
actualPipettes: ?PipettesResponse
Expand All @@ -23,7 +22,7 @@ const ATTACH_ALERT = 'Pipette missing'
const CHANGE_ALERT = 'Incorrect pipette attached'

export default function Pipettes (props: Props) {
const {name, currentPipette, pipettes, actualPipettes} = props
const {currentPipette, pipettes, actualPipettes} = props
const currentMount = currentPipette && currentPipette.mount

const infoByMount = PIPETTE_MOUNTS.reduce((result, mount) => {
Expand Down Expand Up @@ -66,7 +65,7 @@ export default function Pipettes (props: Props) {
/>
<p className={styles.wrong_pipette_message}>
{'Go to the '}
<Link to={`/robots/${name}`}>
<Link to='/robots'>
robot settings
</Link>
{` panel to ${alertType} pipette.`}
Expand Down
1 change: 1 addition & 0 deletions app/src/components/calibrate-pipettes/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
// instrument setup components
import PipetteTabs from './PipetteTabs'
import Pipettes from './Pipettes'
Expand Down
1 change: 0 additions & 1 deletion app/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export type Config = {
},

discovery: {
enabled: boolean,
candidates: string | Array<string>
},
}
Expand Down
13 changes: 0 additions & 13 deletions app/src/discovery/__tests__/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,4 @@ describe('discovery actions', () => {
jest.runTimersToTime(expectedTimeout)
expect(store.getActions()).toEqual([expectedStart, expectedFinish])
})

// TODO(mc, 2018-08-10): legacy discovery support; remove
test('startDiscovery with discovery disabled', () => {
store = mockStore({config: {discovery: {enabled: false}}})

const expectedStart = {
type: 'robot:DISCOVER',
meta: {robotCommand: true}
}

store.dispatch(startDiscovery())
expect(store.getActions()).toEqual([expectedStart])
})
})
52 changes: 0 additions & 52 deletions app/src/discovery/__tests__/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,6 @@ describe('discoveryReducer', () => {
}
}
},
// TODO(mc, 2018-08-10): legacy; remove when DC enabled by default
{
name: 'robot:DISCOVER sets scanning: true',
action: {type: 'robot:DISCOVER'},
initialState: {scanning: false},
expectedState: {scanning: true}
},
// TODO(mc, 2018-08-10): legacy; remove when DC enabled by default
{
name: 'robot:DISCOVER_FINISH sets scanning: false',
action: {type: 'robot:DISCOVER_FINISH'},
initialState: {scanning: true},
expectedState: {scanning: false}
},
{
name: 'discovery:START sets scanning: true',
action: {type: 'discovery:START'},
Expand All @@ -52,44 +38,6 @@ describe('discoveryReducer', () => {
initialState: {scanning: true},
expectedState: {scanning: false}
},
// TODO(mc, 2018-08-10): legacy; remove when DC enabled by default
{
name: 'robot:ADD_DISCOVERED adds robot to list',
action: {
type: 'robot:ADD_DISCOVERED',
payload: {name: 'foo', ip: '192.168.1.42', port: 31950, wired: false}
},
initialState: {robotsByName: {}},
expectedState: {
robotsByName: {
foo: {
name: 'foo',
connections: [
{ip: '192.168.1.42', port: 31950, ok: true, local: false}
]
}
}
}
},
// TODO(mc, 2018-08-10): legacy; remove when DC enabled by default
{
name: 'robot:REMOVE_DISCOVERED sets ok to false',
action: {
type: 'robot:REMOVE_DISCOVERED',
payload: {name: 'foo', ip: '192.168.1.42', port: 31950, wired: false}
},
initialState: {robotsByName: {}},
expectedState: {
robotsByName: {
foo: {
name: 'foo',
connections: [
{ip: '192.168.1.42', port: 31950, ok: false, local: false}
]
}
}
}
},
{
name: 'discovery:UPDATE_LIST resets discovered list',
action: {
Expand Down
Loading

0 comments on commit d3a3afa

Please sign in to comment.