当前位置: 首页>>代码示例>>Python>>正文


Python ALProxy.setWalkTargetVelocity方法代码示例

本文整理汇总了Python中naoqi.ALProxy.setWalkTargetVelocity方法的典型用法代码示例。如果您正苦于以下问题:Python ALProxy.setWalkTargetVelocity方法的具体用法?Python ALProxy.setWalkTargetVelocity怎么用?Python ALProxy.setWalkTargetVelocity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在naoqi.ALProxy的用法示例。


在下文中一共展示了ALProxy.setWalkTargetVelocity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
def main(robotIP, PORT = 9559, turn="left"):
    motionProxy = ALProxy("ALMotion", robotIP, PORT)
    postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)

    motionProxy.wakeUp()
    postureProxy.goToPosture("StandInit", 0.5)
    motionProxy.setMoveArmsEnabled(True, True)
    motionProxy.setExternalCollisionProtectionEnabled("All", False)
    
    if turn == "left":
        theta = .5
    else:
        theta = -.5

    # X, Y, Theta, Freq
    motionProxy.setWalkTargetVelocity(0, 0, theta, 1)
    time.sleep(3.65)
    motionProxy.setWalkTargetVelocity(0, 0, 0, 0) # stop motion
开发者ID:icrl,项目名称:nico,代码行数:20,代码来源:turn.py

示例2: exe

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
 def exe(self, args=None, addr=None):
     
     # check arguments
     if len(args) != 5:
         print "argument error", args
         return False
     
     # get data
     x = float(args[1])
     y = float(args[2])
     theta = float(args[3])
     frequency = float(args[4])
     
     # create proxy
     print "velocityWalk", x, y, theta, frequency
     motion = ALProxy("ALMotion", Settings.naoHostName, Settings.naoPort)
     motion.setWalkTargetVelocity(x, y, theta, frequency)
     
     
开发者ID:Adriencerbelaud,项目名称:NAO-Communication-server,代码行数:19,代码来源:cmdVelocityWalk.py

示例3: Mouvements

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
class Mouvements(object):

	def __init__(self):
		IP, PORT = "127.0.0.1", 9559
		self.vx = 0.0
		self.vy = 0.0
		self.vth = 0.0
		self.dt = 0.227
		self.joints = []
		self.io_file = IO_file()
		self.is_recording = False
		self.postureProxy = ALProxy("ALRobotPosture", IP, PORT)
		self.motionProxy = ALProxy("ALMotion", IP, PORT)
		self.motionProxy.setWalkArmsEnabled(True, True)
		self.motionProxy.setMotionConfig([["ENABLE_FOOT_CONTACT_PROTECTION", False]])
		self.motionProxy.setFallManagerEnabled(False)

	def stiffness(self, go_rigide):
		parametre = 1.0 if go_rigide else 0.0
		self.motionProxy.stiffnessInterpolation("Body", parametre, 1.0)

	def go_debout(self):
		self.stiffness(True)
		self.postureProxy.goToPosture("Stand", 0.8)

	def go_assis(self):
		self.stiffness(True)
		self.postureProxy.goToPosture("Sit", 0.8)
		self.stiffness(False)

	def go_ventre(self):
		self.stiffness(True)
		self.postureProxy.goToPosture("LyingBelly", 0.8)
		self.stiffness(False)

	def go_dos(self):
		self.stiffness(True)
		self.postureProxy.goToPosture("LyingBack", 0.8)
		self.stiffness(False)

	def go_dos(self):
		self.stiffness(True)
		self.postureProxy.goToPosture("Crouch", 0.8)
		self.stiffness(False)

	def go_move(self):
		self.motionProxy.setWalkTargetVelocity(self.vx, self.vy, self.vth, 0.8)

	def set_vx(self, vx):	self.vx = vx
	def set_vy(self, vy):	self.vy = vy
	def set_vth(self, vth):	self.vth = vth

	def update_joints(self):	self.joints = self.motionProxy.getAngles("Body", False)

	def save_joints(self, write):
		self.update_joints()
		if write: fichier = self.io_file.init_write_joints()
		self.io_file.add_joints(self.joints, self.dt)
		if write: self.io_file.write_joints(fichier)

	def record(self):
		self.is_recording = not self.is_recording
		if self.is_recording:
			self.recorder = Recorder(self)
			self.recorder.continuer = True
			self.recorder.start()
		else:
			self.recorder.continuer = False
			self.recorder.join()

	def apply_joints_from_file(self, only_last):
		temps, angles = self.io_file.read_joints(only_last)
		if len(angles) == 0 : return
		self.motionProxy.angleInterpolation("Body", angles, temps, True)

	def move_head(self, vx, vy):
		self.motionProxy.angleInterpolation(["HeadYaw", "HeadPitch"], [-0.1 * float(vx), -0.1 * float(vy)], [0.2, 0.2], False)
开发者ID:rouviecy,项目名称:NAO_TOOLS,代码行数:79,代码来源:Mouvements.py

示例4: __init__

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
class RobotLegs:
    def __init__(self, IP, PORT):
        self.IP = IP
        self.PORT = PORT

        self.motionProxy = ALProxy("ALMotion", self.IP, self.PORT)
        self.postureProxy = ALProxy("ALRobotPosture", self.IP, self.PORT)
        self.memoryProxy = ALProxy("ALMemory", self.IP, self.PORT)
        # self.sonarProxy = ALProxy("ALSonar", self.IP, self.PORT)


        # self.sonarProxy.subscribe("python_client_sonar")
        self.motionProxy.stiffnessInterpolation("Body", 1.0, 1.0)

        self.FallTime = time.time()

        self.LFFL = 0.0
        self.LFFR = 0.0
        self.LFRL = 0.0
        self.LFRR = 0.0
        self.RFFL = 0.0
        self.RFFR = 0.0
        self.RFRR = 0.0

    # def sonarLeftDist(self):
    #     return self.memoryProxy.getData("Device/SubDeviceList/US/Left/Sensor/Value")

    # def sonarRightDist(self):
    #     return self.memoryProxy.getData("Device/SubDeviceList/US/Right/Sensor/Value")

    def walk(self, value):
        self.motionProxy.setWalkTargetVelocity(1.0,0.0,value,1.0,
                [#LEFT
                ["MaxStepX", 0.07],
                #maxStepYRight,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0]],
                [#RIGHT
                ["MaxStepX", 0.7],
                #maxStepYLeft,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0], 
                ["TorsoWy", 0.0]])

    def walk2(self, x, y, theta):
        self.motionProxy.setWalkTargetVelocity(x,y,theta,1.0,
                [#LEFT
                ["MaxStepX", 0.07],
                #maxStepYRight,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0]],
                [#RIGHT
                ["MaxStepX", 0.7],
                #maxStepYLeft,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0], 
                ["TorsoWy", 0.0]])


    def stop(self):
        self.motionProxy.setWalkTargetVelocity(0.0,0.0,0,0.0,
                [#LEFT
                ["MaxStepX", 0.07],
                #maxStepYRight,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0]],
                [#RIGHT
                ["MaxStepX", 0.7],
                #maxStepYLeft,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0], 
                ["TorsoWy", 0.0]])

    def sidestep(self, value):
        self.motionProxy.setWalkTargetVelocity(0.0,value,0.0,1.0,
                [#LEFT
                ["MaxStepX", 0.07],
                #maxStepYRight,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0]],
                [#RIGHT
                ["MaxStepX", 0.7],
#.........这里部分代码省略.........
开发者ID:ChecksumCharlie,项目名称:nao-ucf,代码行数:103,代码来源:nao_movement.py

示例5: Nao

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]

#.........这里部分代码省略.........
    def setLedsGroup(self, names = None):
        if not names:
            # Create a new group
            names = [
            "Face/Led/Red/Left/0Deg/Actuator/Value",
            "Face/Led/Red/Left/90Deg/Actuator/Value",
            "Face/Led/Red/Left/180Deg/Actuator/Value",
            "Face/Led/Red/Left/270Deg/Actuator/Value",
            "Face/Led/Red/Right/0Deg/Actuator/Value",
            "Face/Led/Red/Right/90Deg/Actuator/Value",
            "Face/Led/Red/Right/180Deg/Actuator/Value",
            "Face/Led/Red/Right/270Deg/Actuator/Value"]
            self.__Leds.createGroup("MyGroup",names)
            
    def set_crouch_on_stop(self, crouch=True):
        self.__stop_crouch = crouch

    def move(self, Joint, Angle, Speed):
        self.__Motion.setAngles(Joint, Angle, Speed)

    def walk(self, X=0, Y=0, Teta=0):
        self.__Motion.walkTo(X, Y, Teta)

    def walkNav(self, X=0, Y=0, Teta=0, distance = 0.4):
        self.__Navigation.setSecurityDistance(distance)
        self.__Navigation.moveTo(X, Y, Teta)

    def isWalking(self):
        return self.__Motion.walkIsActive()    
        
    def stopwalk(self):
        self.__Motion.stopWalk()
        
    def setWalkTargetVelocity(self, x , y, theta, frequency):
        self.__Motion.setWalkTargetVelocity(x , y, theta, frequency)

    def is_speaking(self):
        if self.simulation:
            return False
        else:
            is_done_speaking = self.__Memory.getData("ALTextToSpeech/TextDone")
            if not is_done_speaking == None:
                is_done_speaking = int(is_done_speaking)
                if is_done_speaking == 0:
                    return True
            return False

    def say(self, Text, filename=None):
        if self.__TTS:
            #self.__TTS.say(str(Text))
            if filename:
                self.__TTS.sayToFile(Text, filename)
            else:
                self.__TTS.post.say(Text)
        else:
            print "[Nao says] " + Text


    def get_sonar_distance(self):
#        sonarValue= "SonarLeftDetected"
        if self.__Sonar:
#            data = self.__Sonar.getOutputNames()
            data = {"left": self.__Memory.getData("SonarLeftDetected",0), "right" : self.__Memory.getData("SonarRightDetected",0)}
            return data

    def get_yaw_pitch(self):
开发者ID:maxseidler,项目名称:PAS,代码行数:70,代码来源:nao.py

示例6: ALProxy

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
#!/usr/bin/python
# -*- coding: utf-8 -*-
from naoqi import ALProxy
from naoconfig import *
import time

proxyMo = ALProxy('ALMotion',robot_IP,robot_port)
proxyMo.stiffnessInterpolation('Body', 1.0, 1.0)

x  = 1.0
y  = 0.0
theta  = 0.0
frequency  = 1.0
proxyMo.setWalkTargetVelocity(x, y, theta, frequency)

time.sleep(2)

proxyMo.setWalkTargetVelocity(0.0, 0.0, 0.0, frequency)

开发者ID:akihikoy,项目名称:naist-robotics-edu,代码行数:20,代码来源:walk-spd1.py

示例7:

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
 key = "Device/SubDeviceList/HeadYaw/Position/Sensor/Value"
 value = memoryProxy.getData(key)
 print value
 # Check if move to left
 if value>=0.01:
     print "heading left"
     #motionProxy.stopMove()
     motionProxy.setWalkTargetVelocity(1.0,0.0,value,1.0,
         [#Left
         maxStepXRight,
         #maxStepYRight,
         ["MaxStepTheta", 0.349],
         maxStepFrequencyRight,
         stepHeightRight,
         torsoWxRight,
         torsoWyRight],
         [#Right
         maxStepXLeft,
         #maxStepYLeft,
         ["MaxStepTheta", 0.349],
         maxStepFrequencyLeft,
         stepHeightLeft,
         torsoWxLeft,
         torsoWyLeft])
 # Check if move to right
 elif value<=-0.01:
     print "heading right"
     #motionProxy.stopMove()
     motionProxy.setWalkTargetVelocity(1.0,0.0,value,1.0,
         [#Left
         maxStepXRight,
开发者ID:ChecksumCharlie,项目名称:nao-ucf,代码行数:33,代码来源:navalpha.py

示例8:

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
        time.sleep(.1)

if redBallTracker.isActive():
    crdArry = redBallTracker.getPosition()
    print "within if-else"
    print crdArry[0]
    print crdArry[1]
    while crdArry[0] >= 0.4:
        print "Still active:TRACKING SUCCESFUL"
        motion.setWalkTargetVelocity(.8,0.0,0.0,1.0,
                [ # LEFT FOOT
                ["MaxStepX", 0.065],
                ["StepHeight", 0.01],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0], 
                ["MaxStepTheta", .001]],
                [ # RIGHT FOOT
                ["StepHeight", 0.01],
                ["MaxStepX", 0.065],
                ["TorsoWx", 0.0], 
                ["TorsoWy", 0.0],
                ["MaxStepTheta", .001]] )
        time.sleep(.01)
        crdArry = redBallTracker.getPosition()
        print crdArry[0]
        print crdArry[1]
else:
    print "Failed Detection"
           
redBallTracker.stopTracker()
开发者ID:ChecksumCharlie,项目名称:nao-ucf,代码行数:32,代码来源:Chase.py

示例9: ALProxy

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
#!/usr/bin/python
# -*- coding: utf-8 -*-
from naoqi import ALProxy
from naoconfig import *

proxyMo = ALProxy('ALMotion',robot_IP,robot_port)

proxyMo.setWalkTargetVelocity(0.0, 0.0, 0.0, 1.0)

开发者ID:akihikoy,项目名称:naist-robotics-edu,代码行数:10,代码来源:walk-stop.py

示例10: while

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
try:
    while(1):
        if (not kicking):
            #get the current time in seconds
            seconds = int(time()%4)
        ############################################
        ######## KICK CODE #########################
        ############################################
        else:
            seconds = 10
            ##################################################
            ############## Setup for side kick ###############
            ##################################################
            if(i < 10):
                i += 1
                motionProxy.setWalkTargetVelocity(1, 0, -.2, 0.2)
            elif (i == 10):
                print "side kick"
                motionProxy.setWalkTargetVelocity(0, 0, 0, 0)
                # Get to a stable posture first
                postureProxy.goToPosture("StandInit", 0.8)
                    #wait a second to gain composure
                time2.sleep(1)
                #then kick
                # Activate Whole Body Balancer
                isEnabled  = True
                motionProxy.wbEnable(isEnabled)

                # Legs are constrained fixed
                stateName  = "Fixed"
                supportLeg = "Legs"
开发者ID:brandonstrong,项目名称:school,代码行数:33,代码来源:Naoqi+Penalty+Kick.py

示例11: abs

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
		if v_theta_body > +0.9 : v_theta_body = +0.9
		if abs(v_theta_body) < 0.2 : v_theta_body = 0.0
		if vitesse > +0.9 : vitesse = +0.9
		if vitesse < -0.9 : vitesse = -0.9
		if abs(vitesse) < 0.2 : vitesse = 0.0

	if state_punch > 0:
		state_punch += 1
		if state_punch == 10:
			state_punch = 0
	elif best_area > seuil_punch:
		punch(motionProxy, 1)
		vitesse = 0.
		v_theta_body = 0.
	else:
		punch(motionProxy, 0)


	motionProxy.setWalkTargetVelocity(vitesse, 0.0, v_theta_body, 0.8)
	motionProxy.setAngles("HeadYaw", x_head, 0.3)
	motionProxy.setAngles("HeadPitch", y_head, 0.3)


	if best_area == 0: setLeds(0, 255, 0)
	else: setLeds(255, 0, 0)


camProxy.unsubscribe(videoClient)
postureProxy.goToPosture("Sit", 0.8)
StiffnessOn(motionProxy, False)
开发者ID:cephdon,项目名称:NAO_SLAM,代码行数:32,代码来源:nao_grab_cam2.py

示例12: NaoMove

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
class NaoMove():
	# Class used to make all movements to Nao
	def __init__(self, parent):
		#Constructor
		
		self.motionProxy = None
		self.postureProxy = None
		self.tts = None
		self.memoryProxy = None
		self.behaviourProxy = None
		
		self.motorOn = False
		self.parent = parent
		
		self.memValue = ["FaceDetected"]
		
		self.headNames = ["HeadYaw", "HeadPitch"]
		self.leftArmNames = ["LShoulderRoll","LShoulderPitch","LElbowRoll","LElbowYaw"]
		self.rightArmNames = ["RShoulderRoll","RShoulderPitch","RElbowRoll","RElbowYaw"]
		
	def connect(self, robotIP, port):
		try:
			self.motionProxy = ALProxy("ALMotion", robotIP , port)
			self.tts = ALProxy("ALTextToSpeech", robotIP, port)
			self.postureProxy = ALProxy("ALRobotPosture", robotIP, port)
			self.memoryProxy = ALProxy("ALMemory", robotIP, port)
			self.behaviourProxy = ALProxy("ALBehaviorManager", robotIP, port)
		except:
			return 1
			
		# If connection is successful, we initialize few variables for Arms	
		self.anglesRight = self.motionProxy.getAngles(self.rightArmNames, True)
		self.anglesLeft = self.motionProxy.getAngles(self.leftArmNames, True)
		return 0
		
		
	def walk(self,x,y,theta,frequency):
		# Test if the stiffness of Nao is set to 1.0
		self.testMotorOn()
		
		# Launch the walk
		self.motionProxy.setWalkTargetVelocity(x, y, theta, frequency)
		
	def stopWalk(self, frequency):
		self.motionProxy.setWalkTargetVelocity(0.0, 0.0, 0.0, frequency)
		self.motionProxy.waitUntilMoveIsFinished()
		
	def stop(self):
		self.motionProxy.killMove()
		
	def standInit(self):
		self.postureProxy.goToPosture("StandInit", constante.FREQUENCY)
		
	def crouch(self):
		self.postureProxy.goToPosture("Crouch", constante.FREQUENCY)
		
	def runHello(self):
		self.testMotorOn()
		
		self.behaviourProxy.runBehavior("helloBoy")
		
	def openHand(self, hand):
		if hand == constante.RIGHT_HAND:
			self.motionProxy.openHand('RHand')
		else:
			self.motionProxy.openHand('LHand')
	
	def closeHand(self, hand):
		if hand == constante.RIGHT_HAND:
			self.motionProxy.closeHand('RHand')
		else:
			self.motionProxy.closeHand('LHand')
			
	def moveHead(self, angles):
		# Test if the stiffness of Nao is set to 1.0
		self.testMotorOn()
		
		current = self.motionProxy.getAngles(self.headNames, True)
		
		# this boucle is used to dynamically calculate the speed of the movement
		for i in range(len(angles)):
			speed = abs(angles[i]-current[i])/2.0
			
			if speed < 0.05:
				speed = 0.05
			if speed > 0.8:
				speed = 0.8
				
			# Make the movement
			self.motionProxy.setAngles(self.headNames[i], angles[i], speed)
			
	def detectFace(self):
		# Check that it is not already running.
		if (not self.behaviourProxy.isBehaviorRunning("faceDetect")):
			# Launch behavior. This is a blocking call, use post if you do not
			# want to wait for the behavior to finish.
			self.behaviourProxy.post.runBehavior("faceDetect")
		
	def naoMoveTwoArms(self, listPos):
		# Test if the stiffness of Nao is set to 1.0
#.........这里部分代码省略.........
开发者ID:Niels28,项目名称:LeapMotionWithNao,代码行数:103,代码来源:naoMove.py

示例13: __init__

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
class SimpleMotions:
    def __init__(self):
        self.motionProxy = ALProxy("ALMotion", Config.ROBOT_IP, Config.PORT)
        self.postureProxy = ALProxy("ALRobotPosture", Config.ROBOT_IP, Config.PORT)
        robotConfig = self.motionProxy.getRobotConfig()
        # print the robot configuration information
        for i in range(len(robotConfig[0])):
            print robotConfig[0][i], ": ", robotConfig[1][i]

    # turn on stiffness of body
    def stiffnessOn(self, motionProxy):
        allJoints = "Body"
        pStiffnessLists = 1.0
        pTimeLists = 1.0
        motionProxy.stiffnessInterpolation(allJoints, pStiffnessLists, pTimeLists)

    # turn off stiffness
    def stiffnessOff(self, motionProxy):
        allJoints = "Body"
        pStiffnessLists = 0.0
        pTimeLists = 1.0
        motionProxy.stiffnessInterpolation(allJoints, pStiffnessLists, pTimeLists)

    # make robot stand up
    def stand(self):  # def stand(self, name, speed):
        self.stiffnessOn(motionProxy=self.motionProxy)
        self.postureProxy.goToPosture("Stand", 0.4)

    # make the robot stand up fast
    def fastStand(self):  # def stand(self, name, speed):
        self.stiffnessOn(motionProxy=self.motionProxy)
        self.postureProxy.goToPosture("Stand", 1)

    # make the robot sit
    def sit(self):
        self.stiffnessOn(motionProxy=self.motionProxy)
        self.postureProxy.goToPosture("SitRelax", 1.0)

    '''
    make the robot move in a direction
    x: positive move forward, negative move backwards [-1.0 to 1.0]
    y: positive left, negative right [-1.0 to 1.0]
    theta: positive for counterclockwise, negative for clockwise [-1.0 to 1.0]
    speed: determines the frequency of the steps, so the velocity [0.0 to 1.0]
    '''
    def move(self, x, y, theta, speed):
        x = float(x)
        y = float(y)
        theta = float(theta)
        speed = float(speed)
        self.motionProxy.setWalkTargetVelocity(x, y, theta, speed)
        logObj.logWrite(time.time().__str__() + "_3_{0}_{1}_{2}_{3}".format(x,y,theta,speed))

    '''
    as an alternative and more controllable method of moving,
    this moves the robot a desired amount of cm in units of 4 cm. This method makes the robot move L R Fw Bw
    for rotation see the rotateTheta() method
    Config.DIRECTIONS = ["L", "R", "Fw", "Bw"]
    sends as output [time,action,dForwards,dSideways,dtheta,speed]

    input given in integer cm
    '''
    # TODO figure out how many m one footstep is, for all cases so L R Bw Fw
    def moveXYCm(self, x, y):
        self.stand()
        # convert from input string to integer
        x = int(x)
        y = int(y)
        action = 1
        theta = 0
        #self.standStraight()
        self.motionProxy.walkInit()

        # pos is L, neg is R
        if x == 0:
            amountStepsY, stepSizeY = self.getSteps(y)
            #stepSizeY from cm to m
            stepSizeY = float(stepSizeY)  # / 100 apparently not necessary
            amountStepsX = 0
            stepSizeX = 0
            if y > 0:
                positivity = True
                direction = Config.DIRECTIONS[0]
                stepSize = stepSizeY
                for i in xrange(0, amountStepsY):
                    if i % 2 == 0:
                        self.setStep(Config.LLEG, stepSizeX, stepSizeY, theta)
                        lastMovedLeg = Config.LLEG
                    else:
                        self.setStep(Config.RLEG, stepSizeX, stepSizeY, theta)
                        lastMovedLeg = Config.RLEG
            else:
                positivity = False
                direction = Config.DIRECTIONS[1]
                stepSize = -stepSizeY
                for i in xrange(0, amountStepsY):
                    if i % 2 == 0:
                        self.setStep(Config.RLEG, -stepSizeX, -stepSizeY, theta)
                        lastMovedLeg = Config.RLEG
                    else:
#.........这里部分代码省略.........
开发者ID:redsphinx,项目名称:Simple-NAO-Controller,代码行数:103,代码来源:SimpleMotions.py

示例14: setLeds

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
        x, y = x + dx, y + dy
        theta = x
        print "aire : ", best_area, " | dx : ", dx, " | dy : ", dy
        motionProxy.setAngles("HeadYaw", x, 0.3)
        motionProxy.setAngles("HeadPitch", y, 0.3)

    if theta < -0.9:
        theta = -0.9
    if theta > +0.9:
        theta = +0.9
    if best_area > seuil_max:
        vitesse = -bangbang
    elif best_area < seuil_mid and best_area > seuil_min:
        vitesse = +bangbang
    else:
        vitesse = 0.0
        if theta > -0.3 and theta < +0.3:
            theta = 0.0
    motionProxy.setWalkTargetVelocity(vitesse, 0.0, theta, 0.8)

    if best_area == 0:
        setLeds(0, 255, 0)
    else:
        setLeds(255, 0, 0)

    time.sleep(0.1)

camProxy.unsubscribe(videoClient)
postureProxy.goToPosture("Sit", 0.8)
StiffnessOn(motionProxy, False)
开发者ID:rouviecy,项目名称:NAO_SLAM,代码行数:32,代码来源:nao_grab_cam.py

示例15: __init__

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setWalkTargetVelocity [as 别名]
class RobotLegs:
    def __init__(self, IP, PORT):
        self.IP = IP
        self.PORT = PORT

        self.motionProxy = ALProxy("ALMotion", self.IP, self.PORT)

        self.motionProxy.stiffnessInterpolation("Body", 1.0, 1.0)

    def walk(self, value=0):
        self.value = value
        self.motionProxy.setWalkTargetVelocity(
            1.0,
            0.0,
            self.value,
            1.0,
            [  # LEFT
                ["MaxStepX", 0.07],
                # maxStepYRight,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0],
            ],
            [  # RIGHT
                ["MaxStepX", 0.7],
                # maxStepYLeft,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0],
            ],
        )

    def stop(self):
        self.motionProxy.setWalkTargetVelocity(
            0.0,
            0.0,
            0,
            0.0,
            [  # LEFT
                ["MaxStepX", 0.07],
                # maxStepYRight,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0],
            ],
            [  # RIGHT
                ["MaxStepX", 0.7],
                # maxStepYLeft,
                ["MaxStepTheta", 0.349],
                ["MaxStepFrequency", 1],
                ["StepHeight", 0.015],
                ["TorsoWx", 0.0],
                ["TorsoWy", 0.0],
            ],
        )
开发者ID:ChecksumCharlie,项目名称:nao-ucf,代码行数:63,代码来源:nao_movement.py


注:本文中的naoqi.ALProxy.setWalkTargetVelocity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。