0.3.3 • Published 8 months ago

robusdk v0.3.3

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
8 months ago
(async () => {
  const robsdk = require('robusdk')
  const {Coroutine, Sequence, Logger, Awaitable} = require('robusdk')

  const Client = await robsdk({
    url: 'http://192.168.192.168:6680/',
    username: 'admin',
    password: 'elite2014'
  })
  const rpc = Client('RPC')
  const pipeline = Client('PIPELINE')
  const options = {
    repeat: 4,
    delay: 1000
  }

  Logger.info(await rpc.get_joint_pos().next())

  Logger.info(await pipeline.machinePos().next())

  for await (const result of rpc.get_joint_pos()) {
    Logger.info(result)
  }

  for await (const result of pipeline.machinePos()) {
    Logger.info(result)
  }

  Logger.info(await new Coroutine([
    new Sequence(() => rpc.get_joint_pos(), Logger.debug, Logger.error, options),
    new Sequence(() => pipeline.machinePos(), Logger.debug, Logger.error, options),
    new Sequence(() => pipeline.motorSpeed(), Logger.debug, Logger.error, options),
  ]))

  Logger.info(await new Coroutine([
    ...[...Array(4).keys()].map((addr) => new Sequence(() => rpc.getSysVarP({addr}), Logger.debug, Logger.error, options)),
    ...[...Array(4).keys()].map((addr) => new Sequence(() => rpc.getSysVarB({addr}), Logger.debug, Logger.error, options)),
  ]))

  Logger.info(await new Coroutine([
    new Awaitable(() => pipeline(['machinePos', 'machinePose']), Logger.info, Logger.error),
    new Awaitable(() => pipeline(), Logger.info, Logger.error),
  ]))
})()
async def future():
  from robusdk import robusdk, Logger, Sequence, Coroutine, Awaitable
  Client = await robusdk(
    url='http://192.168.192.168:6680/',
    username='admin',
    password='elite2014',
  )
  rpc = Client('RPC')
  pipeline = Client('PIPELINE')
  options = {'repeat': 4, 'delay': 1000}

  Logger.info(await anext(rpc.get_joint_pos()))

  Logger.info(await anext(pipeline.machinePos()))

  async for result in rpc.get_joint_pos():
      Logger.info(result)

  async for result in pipeline.machinePos():
      Logger.info(result)

  Logger.info(await Coroutine([
    Sequence(lambda: rpc.get_joint_pos(), Logger.debug, Logger.error, options),
    Sequence(lambda: pipeline.machinePos(), Logger.debug, Logger.error, options),
    Sequence(lambda: pipeline.motorSpeed(), Logger.debug, Logger.error, options),
  ]))

  Logger.info(await Coroutine([
    *list(map(lambda addr: Sequence(lambda: rpc.getSysVarP(addr=addr), Logger.debug, Logger.error, options), range(4))),
    *list(map(lambda addr: Sequence(lambda: rpc.getSysVarB(addr=addr), Logger.debug, Logger.error, options), range(4))),
  ]))

  Logger.info(await Coroutine([
      Awaitable(lambda: pipeline(['machinePos', 'machinePose']), Logger.info, Logger.error),
  ]))

from asyncio import run
run(future())
0.3.3

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.3

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.5

1 year ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.30

2 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago