• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vrep.simxSetJointTargetVelocity函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vrep.simxSetJointTargetVelocity函数的典型用法代码示例。如果您正苦于以下问题:Python simxSetJointTargetVelocity函数的具体用法?Python simxSetJointTargetVelocity怎么用?Python simxSetJointTargetVelocity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: drive

 def drive(self):
     Left = self.v0
     Right = self.v0
     
     for i in range(0,len(self.ultra_sensors)-1):
         res, detectionState, \
         detectedPoint, detectedObjectHandle, \
         detectedSurfaceNormalVector = \
             vrep.simxReadProximitySensor(self.clientID, 
                                         self.ultra_sensors[i],
                                         vrep.simx_opmode_buffer)
         dist = vec_length(detectedPoint)
         if (res==0) and (dist<self.noDetectionDist):
             if (dist<self.maxDetectionDist):
                 dist=self.maxDetectionDist
             self.detect[i]=1-((dist-self.maxDetectionDist)/(self.noDetectionDist-self.maxDetectionDist))
         else:
             self.detect[i]=0
 	
         Left=Left+self.braitenbergL[i]*self.detect[i]
         Right=Right+self.braitenbergR[i]*self.detect[i]
         
         
     vrep.simxSetJointTargetVelocity(self.clientID,
                                     self.left_motor_handle,
                                     Left,
                                     vrep.simx_opmode_streaming)
     vrep.simxSetJointTargetVelocity(self.clientID,
                                     self.right_motor_handle,
                                     Right,
                                     vrep.simx_opmode_streaming)
开发者ID:dtbinh,项目名称:vrep-python-ai,代码行数:31,代码来源:Pioneer3D.py


示例2: moveKJuniorReadProxSensors

    def moveKJuniorReadProxSensors(self):
        "slowly move forward and print normal vector readings"
 
        rightInput = vrep.simxReadProximitySensor(self.simulID, self.KJrightEye, vrep.simx_opmode_streaming)
        leftInput = vrep.simxReadProximitySensor(self.simulID, self.KJleftEye, vrep.simx_opmode_streaming)
        vrep.simxSynchronousTrigger(self.simulID)
        print "Proximity sensor readings error codes: ", rightInput[0],leftInput[0]
        for step in xrange(self.noSteps):
            rightSpeed = 10
            leftSpeed = rightSpeed
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.KJrightMotor, rightSpeed, vrep.simx_opmode_oneshot_wait)
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.KJleftMotor, leftSpeed, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            rightInput = vrep.simxReadProximitySensor(self.simulID, self.KJrightEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            leftInput = vrep.simxReadProximitySensor(self.simulID, self.KJleftEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            print "Left-->err:%s - Detct'd: %s\t%s\t\t\tRight--> err:%s - Detct'd: %s\t%s" % (leftInput[0],
                                                                                              leftInput[3],
                                                                                              leftInput[4],
                                                                                              rightInput[0],
                                                                                              rightInput[3],
                                                                                              rightInput[4])

            sleep(.2)
开发者ID:dtbinh,项目名称:Homeo,代码行数:25,代码来源:ProxSensorTest.py


示例3: moveRobotRaw_dr20_

def moveRobotRaw_dr20_(leftJoint, rightJoint, clientID):
    err_move_leftJ = vrep.simxSetJointTargetVelocity(clientID, leftJoint, 2, vrep.simx_opmode_oneshot)
    err_move_rightJ = vrep.simxSetJointTargetVelocity(clientID, rightJoint, 2, vrep.simx_opmode_oneshot)
    if err_move_leftJ != vrep.simx_error_noerror:
        print "Das linke Gelenk konnte nicht bewegt werden!"
    if err_move_rightJ != vrep.simx_error_noerror:
        print "Das rechte Gelenk konnte nicht bewegt werden!"
开发者ID:Alminc91,项目名称:v-rep-py,代码行数:7,代码来源:_dr20_login_vrep_func.py


示例4: testMaxSpeed

 def testMaxSpeed(self, maxSpeed, mode):
     """test max speed of khepera-like robot in V-Rep
        revving the motors up to maxSpeed in the self.noSteps and then backward.
        mode--> 1, both motors, 2: right only, 3: left only"""
     if mode == 1: 
         rightOn = leftOn = 1
     elif mode == 2:             
         rightOn = 1
         leftOn = 0
     elif mode == 3:
         rightOn = 0
         leftOn = 1
     unitSpeed = maxSpeed /self.noSteps
          
     for i in xrange(self.noSteps):
         eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.rightMotor, unitSpeed *(i+1)*rightOn, vrep.simx_opmode_oneshot_wait)
         eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.leftMotor,  unitSpeed *(i+1)*leftOn, vrep.simx_opmode_oneshot_wait)
         vrep.simxSynchronousTrigger(self.simulID)
         print "Step: %s\t Speed now: %.2f" %(str(i),(unitSpeed *(i+1)))
    
     for i in xrange(self.noSteps):
         eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.rightMotor, -(maxSpeed/(i+1))*rightOn, vrep.simx_opmode_oneshot_wait)
         eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.leftMotor,  -(maxSpeed/(i+1))*leftOn, vrep.simx_opmode_oneshot_wait)
         vrep.simxSynchronousTrigger(self.simulID)
         print "Step: %s\t Speed now: %.2f" % (str(i), (maxSpeed/(i+1))*rightOn) 
开发者ID:dtbinh,项目名称:Homeo,代码行数:25,代码来源:VREPDetermTest.py


示例5: moveAndReadProxSensors

    def moveAndReadProxSensors(self):
        "rotate in place and print sensor distance and normal vector readings"
 
        for step in xrange(self.noSteps):
            if step>self.noSteps / 2:
                rightSpeed = -1
                leftSpeed = -rightSpeed
            else:
                rightSpeed = 1
                leftSpeed = -rightSpeed
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.rightMotor, rightSpeed, vrep.simx_opmode_oneshot_wait)
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.leftMotor, leftSpeed, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            rightInput = vrep.simxReadProximitySensor(self.simulID, self.rightEye, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            leftInput = vrep.simxReadProximitySensor(self.simulID, self.leftEye, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            print "Left-->err:%s - Detct'd: %s\t%s\t\tRight--> err:%s - Detct'd: %s\t\t\t%s" % (leftInput[0],
                                                                                        leftInput[3],
                                                                                        leftInput[2],
                                                                                        rightInput[0],
                                                                                        rightInput[3],
                                                                                        rightInput[2])

            sleep(.1)
        self.stopRobot(self.simulID,[self.rightMotor,self.leftMotor])
        vrep.simxSynchronousTrigger(self.simulID)
开发者ID:dtbinh,项目名称:Homeo,代码行数:27,代码来源:VREPDetermTest.py


示例6: braiten1b

    def braiten1b(self):
        "slowly move forward and print normal vector readings"
        intens = 100
        ambientIntensRatio = 0.2
        attVect = [0,0,pi *4]

        for step in xrange(self.noSteps):
            rightInput = vrep.simxReadProximitySensor(self.simulID, self.rightEye, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            leftInput = vrep.simxReadProximitySensor(self.simulID, self.leftEye, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            centerInput = vrep.simxReadProximitySensor(self.simulID, self.KJcenterEye, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            angle = degrees(self.angleBetVecs([0,0,1], centerInput[2]))
            lightReading = self.irradAtSensor(intens, ambientIntensRatio, centerInput[2], attVect)
            print "Center-->err:%s - Detct'd: %s\tAngle:%.3f\tIrrad:%.3f\tNorm: %.3f\tVector:%s\t" % (centerInput[0],
                                                                                                      centerInput[3],
                                                                                                      angle,
                                                                                                      lightReading,
                                                                                                      norm(centerInput[2]),
                                                                                                      centerInput[2])
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.rightMotor, 1/lightReading, vrep.simx_opmode_oneshot_wait)
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.leftMotor,  1/lightReading, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            sleep(0)
开发者ID:dtbinh,项目名称:Homeo,代码行数:25,代码来源:VREPDetermTest.py


示例7: execute_action

def execute_action(clientID, RobotHandle, LMotorHandle, RMotorHandle, raw_pose_data, next_action):
    linearVelo, angularVelo, goal_pose = compute_control(raw_pose_data, next_action)
    l_ang_v, r_ang_v = dif_drive(linearVelo, angularVelo)
    #----------
    dist_bound = 0.15
    ang_bound = 0.1*PI
    # retDia, DialogHandle, uiHandle = vrep.simxDisplayDialog(clientID, 'Current Action', next_action, vrep.sim_dlgstyle_message, 'None', None, None, vrep.simx_opmode_blocking)
    #----------
    while (distance(raw_pose_data, goal_pose)>= dist_bound) or (abs(raw_pose_data[2]-goal_pose[2])>=ang_bound):
        # print '--line_distance--', distance(raw_pose_data, goal_pose)
        # print '--angle distance--', abs(raw_pose_data[2]-goal_pose[2])
        pret, RobotPos = vrep.simxGetObjectPosition(clientID, RobotHandle, -1, vrep.simx_opmode_blocking)
        #print "robot position: (x = " + str(RobotPos[0]) + ", y = " + str(RobotPos[1]) + ")"
        oret, RobotOrient = vrep.simxGetObjectOrientation(clientID, RobotHandle, -1, vrep.simx_opmode_blocking)
        #print "robot orientation: (a = " + str(RobotOrient[0]) + ", b = " + str(RobotOrient[1]) +", g = " + str(RobotOrient[2]) + ")"
        raw_pose_data = shift_raw_pose([RobotPos[0], RobotPos[1], RobotOrient[2]])
        #------------------------------
        linearVelo, angularVelo = Find_Control(raw_pose_data, next_action, goal_pose)
        l_ang_v, r_ang_v = dif_drive(linearVelo, angularVelo)
        #print 'raw_pose_data', raw_pose_data
        vrep.simxSetJointTargetVelocity(clientID, LMotorHandle, l_ang_v, vrep.simx_opmode_streaming)
        vrep.simxSetJointTargetVelocity(clientID, RMotorHandle, r_ang_v, vrep.simx_opmode_streaming)
        #print 'distance_x_y:%s; angle_dif:%s' %(str(distance(raw_pose_data, goal_pose)),str(abs(raw_pose_data[2]-goal_pose[2])))
    print 'Goal pose reached!'
    # vrep.simxSetJointTargetVelocity(clientID, LMotorHandle, 0, vrep.simx_opmode_blocking)
    # vrep.simxSetJointTargetVelocity(clientID, RMotorHandle, 0, vrep.simx_opmode_blocking)
    # time.sleep(0.5)
    # retEnd = vrep.simxEndDialog(clientID, DialogHandle, vrep.simx_opmode_blocking)
    return raw_pose_data
开发者ID:MengGuo,项目名称:P_MDP_TG,代码行数:29,代码来源:plan_execution.py


示例8: set_motors

def set_motors():
    global linearVelocityLeft, linearVelocityRight, wheelRadius, vrep, clientID, leftJointDynamic, rightJointDynamic
    t1 = linearVelocityLeft/wheelRadius
    t2 = linearVelocityRight/wheelRadius
    print t1, t2
    vrep.simxSetJointTargetVelocity(clientID, leftJointDynamic, t1, vrep.simx_opmode_oneshot_wait)
    vrep.simxSetJointTargetVelocity(clientID, rightJointDynamic, t2, vrep.simx_opmode_oneshot_wait)
开发者ID:SiChiTong,项目名称:snap-v-rep-example,代码行数:7,代码来源:snap_vrep_backend.py


示例9: set_motor_velocity

    def set_motor_velocity(self, control):
        """Set a target velocity on the pioneer motors, multiplied by the gain
        defined in self.gain

        Args:
            control(list): the control [left_motor, right_motor]
        """
        vrep.simxSetJointTargetVelocity(self.client_id, self.left_motor, self.gain*control[0], vrep.simx_opmode_oneshot_wait)
        vrep.simxSetJointTargetVelocity(self.client_id, self.right_motor, self.gain*control[1], vrep.simx_opmode_oneshot_wait)
开发者ID:dtbinh,项目名称:mines_olp,代码行数:9,代码来源:vrep_pioneer_simulation.py


示例10: handle_input

    def handle_input(self, values):
        # Set the velocity to some large number with the correct sign,
        # because v-rep is weird like that
        vrep.simxSetJointTargetVelocity(self.cid, self.arm_joint, values[0]*100,
                                        vrep.simx_opmode_oneshot)

        # Apply the desired torques to the joints
        # V-REP is looking for just the absolute value here
        vrep.simxSetJointForce(self.cid, self.arm_joint, abs(values[0]),
                                        vrep.simx_opmode_oneshot)
开发者ID:bjkomer,项目名称:nengo_vrep,代码行数:10,代码来源:robots.py


示例11: setController

 def setController(self, name, typeController, val):
     """
     Give an order to a controller
     """
     if typeController == "motor":
         if name in self.handles.keys():
             pass
         else:
             self.initHandle(name)
         motor_handle=self.handles[name]
         vrep.simxSetJointTargetVelocity(self.clientID,motor_handle,val, vrep.simx_opmode_streaming)
开发者ID:bchappet,项目名称:dnfpy,代码行数:11,代码来源:vRepSimulator.py


示例12: applyActionAbsolute

 def applyActionAbsolute(self,action):
     self.desiredWheelRotSpeed=self.absSpeed[action[0]]
     self.desiredSteeringAngle=self.absAngle[action[1]]
     
     returnCode=vrep.simxSetJointTargetVelocity(self.clientID,self.ml,self.desiredWheelRotSpeed,vrep.simx_opmode_oneshot)
     returnCode=vrep.simxSetJointTargetVelocity(self.clientID,self.mr,self.desiredWheelRotSpeed,vrep.simx_opmode_oneshot)
     
     steeringAngleLeft=math.atan(self.l/(-self.d+self.l/math.tan(self.desiredSteeringAngle+0.00001)))
     steeringAngleRight=math.atan(self.l/(self.d+self.l/math.tan(self.desiredSteeringAngle+0.00001)))
             
     returnCode=vrep.simxSetJointTargetPosition(self.clientID,self.sl,steeringAngleLeft,vrep.simx_opmode_oneshot)
     returnCode=vrep.simxSetJointTargetPosition(self.clientID,self.sr,steeringAngleRight,vrep.simx_opmode_oneshot)
开发者ID:dtbinh,项目名称:RL-on-VREP,代码行数:12,代码来源:robot.py


示例13: run360

def run360():
    print "connecting to vrep with address", IPADDRESS, "on port", PORT

    clientID = vrep.simxStart(IPADDRESS, PORT, True, True, 5000, 5)
        
    print "hello vrep! ", clientID

    if clientID == -1:
        print "failed to connect to vrep server"
        return

    # get the motor joint handle
    error,jointHandle = vrep.simxGetObjectHandle(clientID, "plantStandMotor", vrep.simx_opmode_oneshot_wait)
    
    print "starting the motor..."
    
    # set the velocity of the joint
    vrep.simxSetJointTargetVelocity(clientID, jointHandle, 1.0, vrep.simx_opmode_oneshot_wait);

    print "spinning 360 degrees..."
    
    # set up to stream joint positions
    vrep.simxGetJointPosition(clientID, jointHandle, vrep.simx_opmode_streaming);
    
    passed90Degrees = False

    # The control loop:
    while vrep.simxGetConnectionId(clientID) != -1 : # while we are connected to the server..
        (error,position) = vrep.simxGetJointPosition(
            clientID,
            jointHandle,
            vrep.simx_opmode_buffer
            )

        # Fetch the newest joint value from the inbox (func. returns immediately (non-blocking)):
        if error==vrep.simx_error_noerror : 
            # here we have the newest joint position in variable jointPosition! 
            # break when we've done a 360
            if passed90Degrees and position >= 0 and position < math.pi/2.0:
                break
            elif not passed90Degrees and position > math.pi/2.0:
                passed90Degrees = True

    print "stoppping..."
            
    vrep.simxSetJointTargetVelocity(clientID, jointHandle, 0.0, vrep.simx_opmode_oneshot_wait);

    if clientID != -1:
        vrep.simxFinish(clientID)

    print "done!"
开发者ID:robz,项目名称:vrep_scenes,代码行数:51,代码来源:remote_control.py


示例14: reset_vrep

def reset_vrep():
    print 'Start to connect vrep'
    # Close eventual old connections
    vrep.simxFinish(-1)
    # Connect to V-REP remote server
    clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5)
    opmode = vrep.simx_opmode_oneshot_wait
    # Try to retrieve motors and robot handlers
    # http://www.coppeliarobotics.com/helpFiles/en/remoteApiFunctionsPython.htm#simxGetObjectHandle
    ret_l, LMotorHandle = vrep.simxGetObjectHandle(clientID, "Pioneer_p3dx_leftMotor", opmode)
    ret_r, RMotorHandle = vrep.simxGetObjectHandle(clientID, "Pioneer_p3dx_rightMotor", opmode)
    ret_a, RobotHandle = vrep.simxGetObjectHandle(clientID, "Pioneer_p3dx", opmode)
    vrep.simxSetJointTargetVelocity(clientID, LMotorHandle, 0, vrep.simx_opmode_blocking)
    vrep.simxSetJointTargetVelocity(clientID, RMotorHandle, 0, vrep.simx_opmode_blocking)
    time.sleep(1)    
    vrep.simxStopSimulation(clientID, vrep.simx_opmode_oneshot_wait)
    vrep.simxFinish(clientID)
    print 'Connection to vrep reset-ed!'
开发者ID:MengGuo,项目名称:P_MDP_TG,代码行数:18,代码来源:plan_execution.py


示例15: moveKJuniorReadProxSensors

    def moveKJuniorReadProxSensors(self):
        "slowly move forward and print normal vector readings"
        intens = 100
        ambientIntens = 0
        attVect = [0,0,pi *4]
 
        rightInput = vrep.simxReadProximitySensor(self.simulID, self.KJrightEye, vrep.simx_opmode_streaming)
        leftInput = vrep.simxReadProximitySensor(self.simulID, self.KJleftEye, vrep.simx_opmode_streaming)
        centerInput = vrep.simxReadProximitySensor(self.simulID, self.KJcenterEye, vrep.simx_opmode_streaming)
        vrep.simxSynchronousTrigger(self.simulID)
        print "Proximity sensor readings error codes: ", rightInput[0],leftInput[0]
        for step in xrange(self.noSteps):
            rightSpeed = 10
            leftSpeed = rightSpeed
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.KJrightMotor, rightSpeed, vrep.simx_opmode_oneshot_wait)
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.KJleftMotor, leftSpeed, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            rightInput = vrep.simxReadProximitySensor(self.simulID, self.KJrightEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            leftInput = vrep.simxReadProximitySensor(self.simulID, self.KJleftEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            centerInput = vrep.simxReadProximitySensor(self.simulID, self.KJcenterEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            #===================================================================
            # print "Left-->err:%s - Detct'd: %s\t%s\t\t\tRight--> err:%s - Detct'd: %s\t%s" % (leftInput[0],
            #                                                                                   leftInput[3],
            #                                                                                   leftInput[4],
            #                                                                                   rightInput[0],
            #                                                                                   rightInput[3],
            #                                                                                   rightInput[4])
            #===================================================================
            angle = degrees(self.angleBetVecs([0,0,1], centerInput[2]))
            lightReading = self.irradAtSensor(intens, ambientIntens, centerInput[2], attVect)
            print "Center-->err:%s - Detct'd: %s\tAngle:%.3f\tIrrad:%.3f\tNorm: %.3f\tVector:%s\t" % (centerInput[0],
                                                                                                      centerInput[3],
                                                                                                      angle,
                                                                                                      lightReading,
                                                                                                      norm(centerInput[2]),
                                                                                                      centerInput[2])


            sleep(0)
开发者ID:dtbinh,项目名称:Homeo,代码行数:42,代码来源:VREPVectorTests.py


示例16: moveAndReadLights

    def moveAndReadLights(self):
        "rotate in place and print light readings"
        eCode, res, rightEyeRead = vrep.simxGetVisionSensorImage(self.simulID, self.rightEye, 0, vrep.simx_opmode_streaming)
        ecode, res, leftEyeRead = vrep.simxGetVisionSensorImage(self.simulID, self.leftEye, 0, vrep.simx_opmode_streaming)
        vrep.simxSynchronousTrigger(self.simulID)

        for step in xrange(self.noSteps):
            rightSpeed = 25
            leftSpeed = rightSpeed
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.rightMotor, rightSpeed, vrep.simx_opmode_oneshot_wait)
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.leftMotor, leftSpeed, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)
            eCodeR, res, rightEyeRead = vrep.simxGetVisionSensorImage(self.simulID, self.rightEye, 0, vrep.simx_opmode_buffer)
            eCodeL, res, leftEyeRead  = vrep.simxGetVisionSensorImage(self.simulID, self.leftEye,  0, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
#             print "Right eCode:\t", eCodeR,
#             print "Left eCode:\t", eCodeL
#             leftImg = np.array(leftEyeRead, np.uint8)
#             rightImg.resize(res[0],res[1],3)
            print "Right:\t%d, %d\tLeft:\t%d, %d"% (len(rightEyeRead),sum(rightEyeRead), len(leftEyeRead),sum(leftEyeRead))
开发者ID:dtbinh,项目名称:Homeo,代码行数:20,代码来源:VREPDetermTest.py


示例17: move

	def move(self, direction):
		"""
			sets velocity of wheels to move the bubbleRob
		"""

		velocity = []

		if direction == 0: #forward
			velocity = [8,8]
		elif direction == 1: #left
			velocity = [3,8]
		elif direction == 2: #right
			velocity = [8,3]
		elif direction == 3: #backward
			velocity = [-8,-8]

		vrep.simxSetJointTargetVelocity(self.clientID,self.leftMotorHandle,velocity[0],vrep.simx_opmode_oneshot)
		vrep.simxSetJointTargetVelocity(self.clientID,self.rightMotorHandle,velocity[1],vrep.simx_opmode_oneshot)

		time.sleep(0.1)
开发者ID:schlowmo,项目名称:neuronal_network_navigation,代码行数:20,代码来源:rob.py


示例18: computeVelocityStraight

 def computeVelocityStraight(self, LastPosition, NextPosition ):
     if self.clientID != -1:
         vector_displacement = [NextPosition[0]-LastPosition[0],NextPosition[1]-LastPosition[1]] 
         distanceStaight = math.sqrt(vector_displacement[0]*vector_displacement[0] + vector_displacement[1]*vector_displacement[1])
         Vmax = OmegaMax*RWheel
         Time_needed = math.fabs(distanceStaight) / Vmax
         print(Time_needed)
         vrep.simxSetJointTargetVelocity(self.clientID,self.LWMotor_hdl[1],OmegaMax,vrep.simx_opmode_oneshot)
         vrep.simxSetJointTargetVelocity(self.clientID,self.RWMotor_hdl[1],OmegaMax,vrep.simx_opmode_oneshot)
         time.sleep(Time_needed)
         vrep.simxSetJointTargetVelocity(self.clientID,self.LWMotor_hdl[1],0.0,vrep.simx_opmode_oneshot)
         vrep.simxSetJointTargetVelocity(self.clientID,self.RWMotor_hdl[1],0.0,vrep.simx_opmode_oneshot)             
         print ('MovementDone')
开发者ID:Jacky-Fabbros,项目名称:kimeo,代码行数:13,代码来源:test.py


示例19: MotorDifferential

def MotorDifferential(clientID, handleList, speed, diff, astern):
  # Get all the handles at once 
  shape = len(handleList)
  errorcode =[]
  
  if shape % 2 == 0:
    for x in range(1,shape+1,2):
      if astern :
        get_errorCode=vrep.simxSetJointTargetVelocity(clientID, handleList[x-1], -speed, vrep.simx_opmode_oneshot)
        errorcode.append(get_errorCode)
        get_errorCode=vrep.simxSetJointTargetVelocity(clientID, handleList[x], -(speed-diff), vrep.simx_opmode_oneshot)
        errorcode.append(get_errorCode)
      else:
        get_errorCode=vrep.simxSetJointTargetVelocity(clientID, handleList[x-1], speed, vrep.simx_opmode_oneshot)
        errorcode.append(get_errorCode)
        get_errorCode=vrep.simxSetJointTargetVelocity(clientID, handleList[x], speed-diff, vrep.simx_opmode_oneshot)
        errorcode.append(get_errorCode)
  else:
    sys.exit('Differential needs pairs of motors')

  return errorcode
开发者ID:CuriosityCreations,项目名称:VREP,代码行数:21,代码来源:trainvrep.py


示例20: braiten2a

    def braiten2a(self):
        "Seek light source"
        intens = 50
        ambientIntensRatio = .2
        attVect = [0,0,1]
 
        rightInput = vrep.simxReadProximitySensor(self.simulID, self.KJrightEye, vrep.simx_opmode_streaming)
        leftInput = vrep.simxReadProximitySensor(self.simulID, self.KJleftEye, vrep.simx_opmode_streaming)
        centerInput = vrep.simxReadProximitySensor(self.simulID, self.KJcenterEye, vrep.simx_opmode_streaming)
        vrep.simxSynchronousTrigger(self.simulID)
        print "Proximity sensor readings error codes: ", rightInput[0],leftInput[0]
        for step in xrange(self.noSteps):
            rightInput = vrep.simxReadProximitySensor(self.simulID, self.KJrightEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            leftInput = vrep.simxReadProximitySensor(self.simulID, self.KJleftEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            centerInput = vrep.simxReadProximitySensor(self.simulID, self.KJcenterEye, vrep.simx_opmode_buffer)
            vrep.simxSynchronousTrigger(self.simulID)
            #===================================================================
            # print "Left-->err:%s - Detct'd: %s\t%s\t\t\tRight--> err:%s - Detct'd: %s\t%s" % (leftInput[0],
            #                                                                                   leftInput[3],
            #                                                                                   leftInput[4],
            #                                                                                   rightInput[0],
            #                                                                                   rightInput[3],
            #                                                                                   rightInput[4])
            #===================================================================
            angle = degrees(self.angleBetVecs([0,0,1], centerInput[2]))
            lightReading = self.irradAtSensor(intens, ambientIntens, centerInput[2], attVect)
            print "Center-->err:%s - Detct'd: %s\tAngle:%.3f\tIrrad:%.3f\tNorm: %.3f\tVector:%s\t" % (centerInput[0],
                                                                                                      centerInput[3],
                                                                                                      angle,
                                                                                                      lightReading,
                                                                                                      norm(centerInput[2]),
                                                                                                      centerInput[2])
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.KJrightMotor, lightReading, vrep.simx_opmode_oneshot_wait)
            eCode = vrep.simxSetJointTargetVelocity(self.simulID, self.KJleftMotor,  lightReading, vrep.simx_opmode_oneshot_wait)
            vrep.simxSynchronousTrigger(self.simulID)


            sleep(0)
开发者ID:dtbinh,项目名称:Homeo,代码行数:40,代码来源:VREPVectorTests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vrep.simxStart函数代码示例发布时间:2022-05-26
下一篇:
Python vrep.simxGetObjectPosition函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap