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

Python vrep.simxStartSimulation函数代码示例

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

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



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

示例1: __init__

    def __init__(self):

        self.ip = '127.0.0.1'
        self.port = 19997
        self.scene = './simu.ttt'
        self.gain = 2
        self.initial_position = [3,3,to_rad(45)]

        self.r = 0.096 # wheel radius
        self.R = 0.267 # demi-distance entre les r

        print('New pioneer simulation started')
        vrep.simxFinish(-1)
        self.client_id = vrep.simxStart(self.ip, self.port, True, True, 5000, 5)

        if self.client_id!=-1:
            print ('Connected to remote API server on %s:%s' % (self.ip, self.port))
            res = vrep.simxLoadScene(self.client_id, self.scene, 1, vrep.simx_opmode_oneshot_wait)
            res, self.pioneer = vrep.simxGetObjectHandle(self.client_id, 'Pioneer_p3dx', vrep.simx_opmode_oneshot_wait)
            res, self.left_motor = vrep.simxGetObjectHandle(self.client_id, 'Pioneer_p3dx_leftMotor', vrep.simx_opmode_oneshot_wait)
            res, self.right_motor = vrep.simxGetObjectHandle(self.client_id, 'Pioneer_p3dx_rightMotor', vrep.simx_opmode_oneshot_wait)

            self.set_position(self.initial_position)
            vrep.simxStartSimulation(self.client_id, vrep.simx_opmode_oneshot_wait)

        else:
            print('Unable to connect to %s:%s' % (self.ip, self.port))
开发者ID:dtbinh,项目名称:mines_olp,代码行数:27,代码来源:vrep_pioneer_simulation.py


示例2: restart

    def restart(self,earlyStop = False):
        if (self.cid != None):
            vrep.simxStopSimulation(self.cid, self.mode())
            vrep.simxSynchronousTrigger(self.cid)
        vrep.simxFinish(-1)  # just in case, close all opened connections
        time.sleep(1)
        self.connect()
        time.sleep(1)

        vrep.simxLoadScene(self.cid, '/home/elias/[email protected]/_Winter2015/CSC494/Scenes/Base_Quad.ttt', 0, self.mode())
        if earlyStop:
            vrep.simxStopSimulation(self.cid, self.mode())
            vrep.simxSynchronousTrigger(self.cid)
            vrep.simxFinish(-1)  # just in case, close all opened connections
            return
        vrep.simxStartSimulation(self.cid, self.mode())
        self.runtime = 0
        err, self.copter = vrep.simxGetObjectHandle(self.cid, "Quadricopter_base",
                                               vrep.simx_opmode_oneshot_wait)
        err, self.target = vrep.simxGetObjectHandle(self.cid, "Quadricopter_target",
                                               vrep.simx_opmode_oneshot_wait)

        err, self.front_camera = vrep.simxGetObjectHandle(self.cid, 'Quadricopter_frontCamera', vrep.simx_opmode_oneshot)

        err, lin, ang = vrep.simxGetObjectVelocity(self.cid, self.copter, vrep.simx_opmode_streaming)
        self.getTargetStart()
        for i in range(4):
            self.propellerScripts[i] = vrep.simxGetObjectHandle(self.cid,
                                                            'Quadricopter_propeller_respondable' + str(i) + str(1),
                                                            self.mode())
开发者ID:Etragas,项目名称:GPSDrone,代码行数:30,代码来源:Simulation.py


示例3: reset_simulation

def reset_simulation(clientID):
    vrep.simxStopSimulation(clientID, vrep.simx_opmode_oneshot)
    time.sleep(1) # um pequeno sleep entre o stop e o start
    vrep.simxStartSimulation(clientID, vrep.simx_opmode_oneshot)
    for move in startMoves:
        JointControl(clientID, 0, Body, move)
        time.sleep(0.1)
开发者ID:TomasSQ,项目名称:vrepSimulation,代码行数:7,代码来源:algoritmos_geneticos_v1_runner.py


示例4: start_sim

 def start_sim(self):
     time.sleep(self.sleep_sec_min)
     vrep.simxStartSimulation(self.clientID, vrep.simx_opmode_oneshot)
     self.gripper_enabled = False
     self.__update_all_object_positions()
     self.cylinder_height = self.get_object_height(self.cylinder_handle)
     self.cylinder_z_locus = self.get_position(self.cylinder_handle)[2]
     self.bin_position = self.get_position(self.bin_handle)
开发者ID:anandsaha,项目名称:stash,代码行数:8,代码来源:robot.py


示例5: connect

 def connect(self):
     global SYNC
     self.cid = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5)  # Connect to V-REP
     if self.cid != -1:
         print ('Connected to V-REP remote API serv'
                '\er, client id: %s' % self.cid)
         vrep.simxStartSimulation(self.cid, vrep.simx_opmode_oneshot)
         if SYNC:
             vrep.simxSynchronous(self.cid, True)
     else:
         print ('Failed connecting to V-REP remote API server')
         exit()
开发者ID:Etragas,项目名称:GPSDrone,代码行数:12,代码来源:Simulation.py


示例6: startsim

    def startsim(self):
        """
        Start the simulation in synchronous mode to achieve exact simulation
        independent of the framerate. To be able to do this, you have to 
        connec to the port 19997 of vrep, edit the file
        `remoteApiConnections.txt` to contain something like

            portIndex1_port           = 19997
            portIndex1_debug          = true
            portIndex1_syncSimTrigger = false

        """
        self.set_led(8,0)
        vrep.simxStartSimulation(self._clientID, vrep.simx_opmode_oneshot)
        vrep.simxSynchronous(self._clientID, True)
        self.stepsim(1)
开发者ID:RL-LDV-TUM,项目名称:epuck-vrep,代码行数:16,代码来源:ePuckVRep.py


示例7: wait_until_simulator_started

def wait_until_simulator_started(clientID):
    while True:
        try:
            if vrep.simxStartSimulation(clientID, vrep.simx_opmode_oneshot_wait) == vrep.simx_return_ok:
                break
        except KeyboardInterrupt:
            sys.exit('Program Ended')
开发者ID:RyoheiGoto,项目名称:inverted_pendulum,代码行数:7,代码来源:simulator.py


示例8: __init__

    def __init__(self, sim_dt=0.05, nengo_dt=0.001, sync=True):
        vrep.simxFinish(-1) # just in case, close all opened connections
        self.cid = vrep.simxStart('127.0.0.1',19997,True,True,5000,5)
        self.sync = sync

        if self.cid != -1:
            print ('Connected to V-REP remote API server, client id: %s' % self.cid)
            vrep.simxStartSimulation( self.cid, vrep.simx_opmode_oneshot )
            if self.sync:
              vrep.simxSynchronous( self.cid, True )
        else:
            print ('Failed connecting to V-REP remote API server')
            exit(1)
        self.count = 0
        self.sim_dt = sim_dt
        self.nengo_dt = nengo_dt
开发者ID:bjkomer,项目名称:nengo_vrep,代码行数:16,代码来源:robots.py


示例9: startSim

 def startSim(self, clientID, screen=True):
     vrep.simxSetIntegerParameter(clientID,vrep.sim_intparam_dynamic_engine,bulletEngine ,vrep.simx_opmode_oneshot_wait)
     vrep.simxSetFloatingParameter(clientID,vrep.sim_floatparam_simulation_time_step, simulatioTimeStepDT, vrep.simx_opmode_oneshot_wait)
     error=vrep.simxStartSimulation(clientID,vrep.simx_opmode_oneshot)
     if not screen:
         vrep.simxSetIntegerParameter(clientID,vrep.sim_intparam_visible_layers,2,vrep.simx_opmode_oneshot_wait)
         #vrep.simxSetBooleanParameter(clientID,vrep.sim_boolparam_display_enabled,0,vrep.simx_opmode_oneshot_wait)
     return error
开发者ID:PatriciaPolero,项目名称:lucy,代码行数:8,代码来源:Simulator.py


示例10: reset

 def reset(self):
     """In VREP we reset a simulation by stopping and restarting it"""
     eCode = vrep.simxStopSimulation(self._VREP_clientId, vrep.simx_opmode_oneshot_wait)  
     if eCode != 0:
         raise Exception("Could not stop VREP simulation")
     eCode = vrep.simxStartSimulation(self._VREP_clientId, vrep.simx_opmode_oneshot_wait)   
     if eCode != 0:
         raise Exception("Could not start VREP simulation")
     vrep.simxSynchronousTrigger(self._VREP_clientId)
开发者ID:dtbinh,项目名称:Homeo,代码行数:9,代码来源:SimulatorBackend.py


示例11: run

    def run(self):

        if self.clientID!=-1:
            _ = vrep.simxStartSimulation(self.clientID,vrep.simx_opmode_oneshot_wait)

            t0 = time.time()
            while time.time() - t0 < 30:
                for bot in self.bots:
                    bot.robotCode()
开发者ID:anandvgeorge,项目名称:team_ros_plays_football,代码行数:9,代码来源:matchplay.py


示例12: connection

 def connection(self):
     """
     Make connection with v-rep simulator
     """
     print ('Waiting for connection...')
     vrep.simxFinish(-1) # just in case, close all opened connections
     self.clientID=vrep.simxStart('127.0.0.1',self.port,True,True,5000,5) # Connect to V-REP
     if self.clientID!=-1:
         print ('Connected to remote API server')
         
         # enable the synchronous mode on the client:
         if self.synchronous:
             vrep.simxSynchronous(self.clientID,True)
         
         # start the simulation:
         vrep.simxStartSimulation(self.clientID,vrep.simx_opmode_oneshot_wait)
         
     else:
         raise IOError('Failed connecting to remote API server')
开发者ID:bchappet,项目名称:dnfpy,代码行数:19,代码来源:vRepSimulator.py


示例13: __init__

    def __init__(self):
        vrep.simxFinish(-1)  # just in case, close all opened connections
        time.sleep(0.5)
        self.clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5) # tenta conectar no simulador, se salva o clientID

        # paramos a simulacao, se estiver em andamento, e comecamos denovo
       # vrep.simxStopSimulation(self.clientID, vrep.simx_opmode_oneshot)
        #time.sleep(0.5)
        vrep.simxStartSimulation(self.clientID, vrep.simx_opmode_oneshot)

        # modo da API, como eh False, esta no modo assincrono(os ticks da simulacao rodam em velocidade independente)
        vrep.simxSynchronous(self.clientID, False)
        print("connected with id ", self.clientID)

        self.oldtarget = None
        self.camera = None

        self.setup()
        self.lastimageAcquisitionTime = 0
开发者ID:Williangalvani,项目名称:ninja-trex-opencv-quadcopter-token-tracker,代码行数:19,代码来源:interface.py


示例14: run

    def run(self):
        if self.clientID!=-1:
            if not self.multirobots:
                # Start simulation if MultiRobotRunner not already starting it
                _ = vrep.simxStartSimulation(self.clientID,vrep.simx_opmode_oneshot)
            self.robotCode()

        if not self.multirobots:
            # Stop VREP simulation cleanly if MultiRobotRunner not already stopping it
            self.clean_exit()
开发者ID:anandvgeorge,项目名称:team_ros_plays_football,代码行数:10,代码来源:base_robot.py


示例15: reset

 def reset( self ):
     err = vrep.simxStopSimulation(self.cid, vrep.simx_opmode_oneshot_wait)
     time.sleep(1)
     self.pos_err = [0,0,0]
     self.ori_err = [0,0,0]
     self.lin = [0,0,0]
     self.ang = [0,0,0]
     err = vrep.simxStartSimulation(self.cid, vrep.simx_opmode_oneshot_wait)
     if SYNC:
       vrep.simxSynchronous( self.cid, True )
开发者ID:Etragas,项目名称:GPSDrone,代码行数:10,代码来源:quadcopter.py


示例16: resetSimulation

 def resetSimulation(self):
     returnCode = vrep.simx_return_novalue_flag
     while returnCode!=vrep.simx_return_ok:
         returnCode=vrep.simxStopSimulation(self.__clientID, vrep.simx_opmode_oneshot)
         time.sleep(0.5)
     time.sleep(0.5)
     returnCode = vrep.simx_return_novalue_flag
     while returnCode!=vrep.simx_return_ok:
         returnCode=vrep.simxStartSimulation(self.__clientID, vrep.simx_opmode_oneshot)
         time.sleep(0.5)
     time.sleep(1.0)
开发者ID:dtbinh,项目名称:Lingadrome,代码行数:11,代码来源:VRepBRSimulator.py


示例17: reset_rob

	def reset_rob(self):
		"""
			Sets the bubbleRob to his starting position; mind the hack, simulation has to be stopped 
		"""

		##### Set absolute position

		#stop simulation
		vrep.simxStopSimulation(self.clientID,vrep.simx_opmode_oneshot_wait) 

		#100ms delay, this is a hack because server isn't ready either
		time.sleep(0.3)

		#set on absolute position
		err = vrep.simxSetObjectPosition(self.clientID, self.bubbleRobHandle, -1, self.bubbleRobStartPosition, vrep.simx_opmode_oneshot_wait)

		#start simulation again
		vrep.simxStartSimulation(self.clientID,vrep.simx_opmode_oneshot_wait)

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


示例18: start

 def start(self):
     returnCode = vrep.simxStartSimulation(self.clientID,vrep.simx_opmode_oneshot)
     if (returnCode>1):
         print "returnCode: ", returnCode
         raise Exception('Could not start')
     returnCode=vrep.simxSynchronous(self.clientID,True)
     
     for k in range(10): #Run to steps to step through initial "drop"
         returncode = vrep.simxSynchronousTrigger(self.clientID)
         
     if (returnCode!=0):
         raise Exception('Could not set synchronous mode')
开发者ID:dtbinh,项目名称:RL-on-VREP,代码行数:12,代码来源:environment.py


示例19: reset

 def reset( self ):
     err = vrep.simxStopSimulation(self.cid, vrep.simx_opmode_oneshot_wait)
     time.sleep(1)
     self.pos_err = [0,0,0]
     self.ori_err = [0,0,0]
     self.lin = [0,0,0]
     self.ang = [0,0,0]
     self.vert_prox = 0
     self.left_prox = 0
     self.right_prox = 0
     err = vrep.simxStartSimulation(self.cid, vrep.simx_opmode_oneshot_wait)
     if self.sync:
       vrep.simxSynchronous( self.cid, True )
开发者ID:bjkomer,项目名称:nengo_vrep,代码行数:13,代码来源:robots.py


示例20: init_vrep_connection

    def init_vrep_connection(self):
        vrep.simxFinish(-1) # just in case, close all opened connections
        self.client_id=vrep.simxStart(self.ip,self.port,True,True,5000,5) # Connect to V-REP

        if self.client_id!=-1:
            print ('Connected to remote API server on %s:%s' % (self.ip, self.port))
            res = vrep.simxLoadScene(self.client_id, self.scene, 1, vrep.simx_opmode_oneshot_wait)

            #get motor handler
            self.motor_handlers = []
            for motor in self.robot.motors:
                res, motor_handler = vrep.simxGetObjectHandle(
                    self.client_id,
                    motor.name,
                    vrep.simx_opmode_oneshot_wait
                )
                self.motor_handlers.append(motor_handler)
            self.motor_handlers.sort()
            print(self.motor_handlers)

            #get effector handler
            res, self.effector_handler = vrep.simxGetObjectHandle(
                self.client_id,
                'effector',
                vrep.simx_opmode_oneshot_wait
            )

            #get collision handler
            self.collision_handlers = []
            for collision in self.collision_list:
                res, collision_handler = vrep.simxGetObjectHandle(
                    self.client_id,
                    collision,
                    vrep.simx_opmode_oneshot_wait
                )
                self.collision_handlers.append(collision_handler)

            vrep.simxStartSimulation(self.client_id, vrep.simx_opmode_oneshot_wait)
开发者ID:sfosset,项目名称:luxo_alpha,代码行数:38,代码来源:vrep_direct_function_wo_pypot.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python vrep.simxStopSimulation函数代码示例发布时间:2022-05-26
下一篇:
Python vrep.simxStart函数代码示例发布时间: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