本文整理汇总了Python中org.myrobotlab.service.Runtime.start方法的典型用法代码示例。如果您正苦于以下问题:Python Runtime.start方法的具体用法?Python Runtime.start怎么用?Python Runtime.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.myrobotlab.service.Runtime
的用法示例。
在下文中一共展示了Runtime.start方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connect
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
# these are D6,D7 for 2 PWM motor control
pwmPin = 6
dirPin = 7
# this is "A7" on the Arduino Mega
potPin = 61
# port = "/dev/ttyACM0"
port = "COM31"
# to help avoid buffer overruns when sampling data from the arduino
sampleRate = 25
# Runtime.start("webgui", "WebGui")
# Start the Arduino
arduino = Runtime.start("arduino", "Arduino")
arduino.connect(port)
# a slight pause to let the arduino connect (maybe not necessary)
sleep(2)
# set up the motor control pins to be output
arduino.pinMode(pwmPin, Arduino.OUTPUT)
arduino.pinMode(dirPin, Arduino.OUTPUT)
# set the analog pin to be an input pin
arduino.pinMode(potPin, Arduino.INPUT)
# set the sample rate for the analog pins
arduino.setSampleRate(sampleRate)
arduino.analogReadPollingStart(potPin)
# start the motor service and attach it to the arduino
m1 = Runtime.start("m1", "Motor");
m1.setTypeSimple(pwmPin, dirPin);
m1.attach(arduino)
示例2:
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
#from org.myrobotlab.service import UltrasonicSensor
from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Servo
from org.myrobotlab.service import Runtime
from org.myrobotlab.service import GUIService
from org.myrobotlab.service import Speech
from time import sleep
# we need a dictionary of arrays which store calibration data for each servo/joint
calib = {}
# create the services
speech = Runtime.createAndStart("speech","Speech") # For voice feedback
#ear = Runtime.createAndStart("listen","Sphinx") # For hearing spoken commands
gui = Runtime.start("gui", "GUIService")
keyboard = Runtime.start("keyboard", "Keyboard") # For getting user confirmation
#keyboard.addKeyListener(python)
# Arduino to connect everything to like a spinal cord
arduino = Runtime.createAndStart("arduino","Arduino")
#sr04 = Runtime.start("sr04", "UltrasonicSensor") # For an ultrasonic view of the world
# 6 joints in the Right leg
rAnkle = Runtime.createAndStart("R Ankle","Servo")
rLowLeg = Runtime.createAndStart("R Low Leg","Servo")
rKnee = Runtime.createAndStart("R Knee","Servo")
rMidLeg = Runtime.createAndStart("R Mid Leg","Servo")
rUpLeg = Runtime.createAndStart("R Up Leg","Servo")
示例3:
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Servo
from org.myrobotlab.service import Runtime
from time import sleep
servo1Pin = 12
servo2Pin = 13
servo3Pin = 26
servo4Pin = 4
# comPort = "/dev/ttyUSB0"
comPort = "COM6"
# create the services
arduino = Runtime.start("arduino","Arduino")
servo01 = Runtime.start("servo01","Servo")
# initialize arduino
# arduino.connect("/dev/ttyUSB0")
arduino.connect(comPort)
# TODO - set limits
servo01.setMinMax(60, 120)
# attach servo
servo01.attach(arduino.getName(), servo1Pin)
# fast sweep
servo01.moveTo(90)
示例4:
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
#from org.myrobotlab.service import UltrasonicSensor
from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Servo
from org.myrobotlab.service import Runtime
from org.myrobotlab.service import SwingGui
from org.myrobotlab.service import Speech
from time import sleep
# we need a dictionary of arrays which store calibration data for each servo/joint
calib = {}
# create the services
speech = Runtime.createAndStart("speech","Speech") # For voice feedback
#ear = Runtime.createAndStart("listen","Sphinx") # For hearing spoken commands
gui = Runtime.start("gui", "SwingGui")
keyboard = Runtime.start("keyboard", "Keyboard") # For getting user confirmation
#keyboard.addKeyListener(python)
# Arduino to connect everything to like a spinal cord
arduino = Runtime.createAndStart("arduino","Arduino")
#sr04 = Runtime.start("sr04", "UltrasonicSensor") # For an ultrasonic view of the world
# 6 joints in the Right leg
rAnkle = Runtime.createAndStart("R Ankle","Servo")
rLowLeg = Runtime.createAndStart("R Low Leg","Servo")
rKnee = Runtime.createAndStart("R Knee","Servo")
rMidLeg = Runtime.createAndStart("R Mid Leg","Servo")
rUpLeg = Runtime.createAndStart("R Up Leg","Servo")
示例5: onJoystickInput
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
from org.myrobotlab.service import Runtime
serial = Runtime.createAndStart("serial","Serial")
serial.connect('COM4')
joystick = Runtime.start("joystick","Joystick")
joystick.setController(0)
python.subscribe("joystick","publishJoystickInput")
def onJoystickInput(data):
if (data.id=="R" and data.value == 1.0):
serial.write("255,0,0")
if (data.id=="G" and data.value == 1.0):
serial.write("0,255,0")
if (data.id=="B" and data.value == 1.0):
serial.write("0,0,255")
示例6:
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
#script to control the TrashyBot platform through remote control via Xbox 360 wireless remote
#
#
#Nolan B. 1/8/16
from org.myrobotlab.service import Joystick
from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Runtime
from time import sleep
#----------------------------------Web Gui--------------------------
webgui = Runtime.create("webgui", "WebGui")
webgui.autoStartBrowser(False)
Runtime.start("webgui", "WebGui")
#---------------------------------Create Services----------------------
arduino = Runtime.createAndStart("arduino","Arduino")
joystick = Runtime.createAndStart("joystick","Joystick")
motorL = Runtime.start("motorL","Motor")
motorR = Runtime.start("motorR","Motor")
log = Runtime.start("log","Log")
#----------------------Connect Peripherals-----------------------------------
joystick.setController(0); #PC only - Pi needs new
joystick.addInputListener(python)
arduino.connect("/dev/ttyACM0");
# Tell the joystick to turn on
示例7: onJoystickInput
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
from org.myrobotlab.service import Joystick
from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Runtime
from time import sleep
#---------------------------------Create Services----------------------
arduino = Runtime.createAndStart("arduino","Arduino")
joystick = Runtime.createAndStart("joystick","Joystick")
motorleft = Runtime.start("motorleft","Motor")
#----------------------Connect Peripherals-----------------------------------
joystick.setController(0); #PC only - Pi needs new
joystick.addInputListener(python)
# Tell the joystick to turn on
joystick.startPolling()
arduino.connect("/dev/ttyACM0");
arduino.motorAttach("motorleft", 5, 4)
#----------------------Define callback function for Joystick-----------
def onJoystickInput(data):
global float(ryValue)
if (data.id == 'A' and float(data.value) == 1.0):
print "Attatch MotorLeft"
if (data.id == 'B' and float(data.value) == 1.0):
print "Detach MotorLeft"
if (data.id == 'ry'):
ryValue = float(data.value)
printValue(ryValue)
moveLeftMotor(ryValue)
#-----------------------Main Loop----------------------------------------
示例8:
# 需要导入模块: from org.myrobotlab.service import Runtime [as 别名]
# 或者: from org.myrobotlab.service.Runtime import start [as 别名]
#script to connect pan and tilt motion of head servos to joystick movement
#instead of the servo motion being tied directly to servo position the servos will hold thier last position when
#control sticks return to center. Thanks to Kwatters for the syntax on the servo sweeping
#Nolan B. 1/4/16
from org.myrobotlab.service import Joystick
from org.myrobotlab.service import Arduino
from org.myrobotlab.service import Runtime
from org.myrobotlab.service import Servo
from time import sleep
#----------------------------------Web Gui--------------------------
webgui = Runtime.create("webgui", "WebGui")
webgui.autoStartBrowser(False)
Runtime.start("webgui", "WebGui")
#---------------------------------Create Services----------------------
arduino = Runtime.createAndStart("arduino","Arduino")
joystick = Runtime.createAndStart("joystick","Joystick")
servo01 = Runtime.start("servo01","Servo") #Head Tilt Servo
servo02 = Runtime.start("servo02","Servo") #Head Pan Servo
#------------------------Create Static Values-------------------------------
servo01Pin = 10
servo02Pin = 11
comPort = "/dev/ttyACM0"
servo01.setMinMax(30, 130)
servo02.setMinMax(30, 130)
#----------------------Connect Peripherals-----------------------------------