├── CONTRIBUTING.md ├── src ├── ir │ ├── model.hdf5 │ ├── rl_bot.ttt │ ├── history_ir.p │ ├── model_ir.hdf5 │ ├── remoteApi.dll │ ├── remoteApi.so │ ├── __pycache__ │ │ ├── env.cpython-35.pyc │ │ ├── env.cpython-36.pyc │ │ ├── vrep.cpython-35.pyc │ │ ├── vrep.cpython-36.pyc │ │ ├── vrepConst.cpython-35.pyc │ │ └── vrepConst.cpython-36.pyc │ ├── history.p │ ├── test.py │ ├── train.py │ ├── env.py │ ├── vrepConst.py │ └── vrep.py ├── proxy │ ├── model.hdf5 │ ├── train.py │ ├── env.py │ └── history.p └── vrep │ ├── rl_bot.ttt │ ├── remoteApi.so │ └── vrepConst.py ├── final_report ├── 2.png └── 3.png └── README.md /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/ir/model.hdf5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/model.hdf5 -------------------------------------------------------------------------------- /src/ir/rl_bot.ttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/rl_bot.ttt -------------------------------------------------------------------------------- /final_report/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/final_report/2.png -------------------------------------------------------------------------------- /final_report/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/final_report/3.png -------------------------------------------------------------------------------- /src/ir/history_ir.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/history_ir.p -------------------------------------------------------------------------------- /src/ir/model_ir.hdf5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/model_ir.hdf5 -------------------------------------------------------------------------------- /src/ir/remoteApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/remoteApi.dll -------------------------------------------------------------------------------- /src/ir/remoteApi.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/remoteApi.so -------------------------------------------------------------------------------- /src/proxy/model.hdf5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/proxy/model.hdf5 -------------------------------------------------------------------------------- /src/vrep/rl_bot.ttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/vrep/rl_bot.ttt -------------------------------------------------------------------------------- /src/vrep/remoteApi.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/vrep/remoteApi.so -------------------------------------------------------------------------------- /src/ir/__pycache__/env.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/__pycache__/env.cpython-35.pyc -------------------------------------------------------------------------------- /src/ir/__pycache__/env.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/__pycache__/env.cpython-36.pyc -------------------------------------------------------------------------------- /src/ir/__pycache__/vrep.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/__pycache__/vrep.cpython-35.pyc -------------------------------------------------------------------------------- /src/ir/__pycache__/vrep.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/__pycache__/vrep.cpython-36.pyc -------------------------------------------------------------------------------- /src/ir/__pycache__/vrepConst.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/__pycache__/vrepConst.cpython-35.pyc -------------------------------------------------------------------------------- /src/ir/__pycache__/vrepConst.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akashdeepjassal/VREP-RL-bot/HEAD/src/ir/__pycache__/vrepConst.cpython-36.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VREP-RL 2 | Reinforcement Learning in Vrep 3 | # RL-Car 4 | 5 | This project implements OpenAI's gym like interface for V-Rep to train reinforcementt learning agents. 6 | 7 | Following two experiments were modeled on the aforementioned environment using Deep Q-Networks (DQN) in Keras, 8 | 9 | 1. Line follower using infrared (IR) sensors. 10 | 11 | ![](./final_report/2.png) 12 | 13 | 2. Obstacle avoidance using proximity sensors. 14 | 15 | ![](./final_report/3.png) 16 | -------------------------------------------------------------------------------- /src/ir/history.p: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'rList' 3 | p1 4 | (lp2 5 | cnumpy.core.multiarray 6 | scalar 7 | p3 8 | (cnumpy 9 | dtype 10 | p4 11 | (S'f8' 12 | p5 13 | I0 14 | I1 15 | tp6 16 | Rp7 17 | (I3 18 | S'<' 19 | p8 20 | NNNI-1 21 | I-1 22 | I0 23 | tp9 24 | bS'\x00\x00\x00\x00\x00\x00\x9d@' 25 | p10 26 | tp11 27 | Rp12 28 | asS'jList' 29 | p13 30 | (lp14 31 | I299 32 | asS'lList' 33 | p15 34 | (lp16 35 | g3 36 | (g7 37 | S'\x80\x85m\xea\xd9\xac\xf0@' 38 | p17 39 | tp18 40 | Rp19 41 | as. -------------------------------------------------------------------------------- /src/ir/test.py: -------------------------------------------------------------------------------- 1 | import os 2 | #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 3 | import numpy as np 4 | from env import RLBot 5 | import matplotlib.pyplot as plt 6 | import pickle 7 | from keras.models import load_model, Sequential 8 | from keras.layers import Dense, Activation 9 | 10 | 11 | def train(): 12 | env = RLBot() 13 | 14 | model = load_model('model_ir.hdf5') 15 | 16 | SPEED = 1 17 | num_episodes = 1500 18 | num_steps = 300 19 | rList = [] 20 | jList = [] 21 | 22 | for i in range(num_episodes): 23 | # Reset environment and get first new observation 24 | env.reset() 25 | s, r = env.step([SPEED, SPEED]) 26 | s = s['light_sensor'].reshape((1, -1)) 27 | r = r['light_sensor'] 28 | Q = model.predict(s) 29 | a = Q.argmax() 30 | rAll = 0 31 | done = False 32 | loss = 0 33 | # The Q-Network 34 | for j in range(num_steps): 35 | # Choose an action by greedily (with e chance of random action) 36 | # from the Q-network 37 | Q = model.predict(s) 38 | a = Q.argmax() 39 | print("Step {} | State: {} | Action: {} | Reward: {}".format(j, s, a, r)) 40 | # Get new state and reward from environment 41 | speed = np.zeros(2) 42 | # Q -> left, right, forward, break 43 | if a == 0: 44 | speed[0] = 0 45 | speed[1] = SPEED 46 | if a == 1: 47 | speed[0] = SPEED 48 | speed[1] = 0 49 | if a == 2: 50 | speed[0] = SPEED 51 | speed[1] = SPEED 52 | if a == 3: 53 | speed[0] = 0 54 | speed[1] = 0 55 | 56 | s_, r_ = env.step(speed) 57 | s_ = s_['light_sensor'].reshape((1, -1)) 58 | r_ = r_['light_sensor'] 59 | s = s_ 60 | r = r_ 61 | rAll += r 62 | if done is True: 63 | break 64 | # Reduce chance of random action as we train the model. 65 | jList.append(j) 66 | rList.append(rAll) 67 | print("Episode: " + str(i)) 68 | print("Reward: " + str(rAll)) 69 | 70 | print("Average number of steps: " + str(sum(jList) / num_episodes)) 71 | print("Average reward: " + str(sum(rList) / num_episodes)) 72 | 73 | plt.plot(rList) 74 | plt.plot(jList) 75 | 76 | 77 | if __name__ == '__main__': 78 | try: 79 | train() 80 | except KeyboardInterrupt: 81 | print('Exiting.') 82 | -------------------------------------------------------------------------------- /src/ir/train.py: -------------------------------------------------------------------------------- 1 | import os 2 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 3 | import numpy as np 4 | from env import RLBot 5 | import matplotlib.pyplot as plt 6 | import pickle 7 | from keras.models import load_model, Sequential 8 | from keras.layers import Dense, Activation 9 | 10 | def train(): 11 | env = RLBot() 12 | 13 | try: 14 | model = load_model('model_ir.hdf5') 15 | except: 16 | model = Sequential() 17 | model.add(Dense(units=10, input_dim=8)) 18 | model.add(Activation("relu")) 19 | model.add(Dense(units=6)) 20 | model.add(Activation("relu")) 21 | model.add(Dense(units=3)) 22 | model.add(Activation("relu")) 23 | model.compile(optimizer='Adam', loss='mse') 24 | 25 | # Set learning parameters 26 | y = .99 27 | e = 0.1 28 | num_episodes = 1500 29 | num_steps = 300 30 | # create lists to contain total rewards and steps per episode 31 | jList = [] 32 | rList = [] 33 | lList = [] 34 | SPEED = 0.7 35 | 36 | for i in range(num_episodes): 37 | # Reset environment and get first new observation 38 | env.reset() 39 | s, r = env.step([SPEED, SPEED]) 40 | s = s['light_sensor'].reshape((1, -1)) 41 | r = r['light_sensor'] 42 | Q = model.predict(s) 43 | a = Q.argmax() 44 | rAll = 0 45 | done = False 46 | loss = 0 47 | # The Q-Network 48 | for j in range(num_steps): 49 | print("Step {} | State: {} | Action: {} | Reward: {}".format(j, s, a, r)) 50 | # Choose an action by greedily (with e chance of random action) 51 | # from the Q-network 52 | Q = model.predict(s) 53 | a = Q.argmax() 54 | if np.random.rand(1) < e: 55 | a = np.random.randint(3) 56 | print("e = {}. Choosing Random Action: {}".format(e, a)) 57 | # Get new state and reward from environment 58 | speed = np.zeros(2) 59 | # Q -> left, right, forward, break 60 | if a == 0: 61 | speed[0] = 0 62 | speed[1] = SPEED 63 | if a == 1: 64 | speed[0] = SPEED 65 | speed[1] = 0 66 | if a == 2: 67 | speed[0] = SPEED 68 | speed[1] = SPEED 69 | if a == 3: 70 | speed[0] = 0 71 | speed[1] = 0 72 | 73 | s_, r_ = env.step(speed) 74 | s_ = s_['light_sensor'].reshape((1, -1)) 75 | r_ = r_['light_sensor'] 76 | # Obtain the Q' values by feeding the new state through our network 77 | Q_ = model.predict(s_) 78 | # Obtain maxQ' and set our target value for chosen action. 79 | maxQ_ = np.max(Q_) 80 | targetQ = Q 81 | targetQ[0, a] = r + y * maxQ_ 82 | # Train our network using target and predicted Q values 83 | loss += model.train_on_batch(s, targetQ) 84 | rAll += r 85 | s = s_ 86 | r = r_ 87 | if done is True: 88 | break 89 | # Reduce chance of random action as we train the model. 90 | e -= 0.001 91 | jList.append(j) 92 | rList.append(rAll) 93 | lList.append(loss) 94 | print("Episode: " + str(i)) 95 | print("Loss: " + str(loss)) 96 | print("e: " + str(e)) 97 | print("Reward: " + str(rAll)) 98 | pickle.dump({'jList': jList, 'rList': rList, 'lList': lList}, 99 | open("history_ir.p", "wb")) 100 | model.save('model_ir.hdf5') 101 | 102 | print("Average loss: " + str(sum(lList) / num_episodes)) 103 | print("Average number of steps: " + str(sum(jList) / num_episodes)) 104 | print("Average reward: " + str(sum(rList) / num_episodes)) 105 | 106 | plt.plot(rList) 107 | plt.plot(jList) 108 | plt.plot(lList) 109 | 110 | if __name__ == '__main__': 111 | try: 112 | train() 113 | except KeyboardInterrupt: 114 | print('Exiting.') 115 | -------------------------------------------------------------------------------- /src/proxy/train.py: -------------------------------------------------------------------------------- 1 | import os 2 | import numpy as np 3 | from env import RLBot 4 | import matplotlib.pyplot as plt 5 | import pickle 6 | from keras.models import load_model, Sequential 7 | from keras.layers import Dense, Activation 8 | 9 | os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 10 | 11 | 12 | def train(): 13 | env = RLBot() 14 | 15 | try: 16 | model = load_model('model_porxy.hdf5') 17 | except: 18 | model = Sequential() 19 | model.add(Dense(units=10, input_dim=16)) 20 | model.add(Activation("relu")) 21 | model.add(Dense(units=12)) 22 | model.add(Activation("relu")) 23 | model.add(Dense(units=3)) 24 | model.add(Activation("relu")) 25 | model.compile(optimizer='Adam', loss='categorical_crossentropy') 26 | 27 | # Set learning parameters 28 | y = .99 29 | e = 0.1 30 | num_episodes = 150 31 | num_steps = 30 32 | # create lists to contain total rewards and steps per episode 33 | jList = [] 34 | rList = [] 35 | lList = [] 36 | SPEED = 0.7 37 | 38 | for i in range(num_episodes): 39 | # Reset environment and get first new observation 40 | env.reset() 41 | s, r = env.step([SPEED, SPEED]) 42 | s = s['proxy_sensor'].reshape((1, -1)) 43 | r = r['proxy_sensor'] 44 | Q = model.predict(s) 45 | a = Q.argmax() 46 | rAll = 0 47 | done = False 48 | loss = 0 49 | # The Q-Network 50 | for j in range(num_steps): 51 | print("Step {} | Action: {} | Reward: {}".format(j, a, r)) 52 | # Choose an action by greedily (with e chance of random action) 53 | # from the Q-network 54 | Q = model.predict(s) 55 | a = Q.argmax() 56 | if np.random.rand(1) < e: 57 | a = np.random.randint(3) 58 | print("e = {}. Choosing Random Action: {}".format(e, a)) 59 | # Get new state and reward from environment 60 | speed = np.zeros(2) 61 | # Q -> left, right, forward, break, backward 62 | if a == 0: 63 | speed[0] = 0 64 | speed[1] = SPEED 65 | if a == 1: 66 | speed[0] = SPEED 67 | speed[1] = 0 68 | if a == 2: 69 | speed[0] = SPEED 70 | speed[1] = SPEED 71 | if a == 3: 72 | speed[0] = 0 73 | speed[1] = 0 74 | 75 | s_, r_ = env.step(speed) 76 | s_ = s_['proxy_sensor'].reshape((1, -1)) 77 | r_ = r_['proxy_sensor'] 78 | # Obtain the Q' values by feeding the new state through our network 79 | Q_ = model.predict(s_) 80 | # Obtain maxQ' and set our target value for chosen action. 81 | maxQ_ = np.max(Q_) 82 | targetQ = Q 83 | targetQ[0, a] = r + y * maxQ_ 84 | # Train our network using target and predicted Q values 85 | loss += model.train_on_batch(s, targetQ) 86 | rAll += r 87 | s = s_ 88 | r = r_ 89 | if done is True: 90 | break 91 | # Reduce chance of random action as we train the model. 92 | e -= 0.001 93 | jList.append(j) 94 | rList.append(rAll) 95 | lList.append(loss) 96 | print("Episode: " + str(i)) 97 | print("Loss: " + str(loss)) 98 | print("e: " + str(e)) 99 | print("Reward: " + str(rAll)) 100 | pickle.dump({'jList': jList, 'rList': rList, 'lList': lList}, 101 | open("history_porxy.p", "wb")) 102 | model.save('model_proxy.hdf5') 103 | 104 | print("Average loss: " + str(sum(lList) / num_episodes)) 105 | print("Average number of steps: " + str(sum(jList) / num_episodes)) 106 | print("Average reward: " + str(sum(rList) / num_episodes)) 107 | 108 | plt.plot(rList) 109 | plt.plot(jList) 110 | plt.plot(lList) 111 | 112 | 113 | if __name__ == '__main__': 114 | try: 115 | train() 116 | except KeyboardInterrupt: 117 | print('Exiting.') 118 | -------------------------------------------------------------------------------- /src/ir/env.py: -------------------------------------------------------------------------------- 1 | # Import Libraries: 2 | from vrep import vrep 3 | import sys 4 | import time 5 | import numpy as np 6 | import math 7 | import matplotlib.pyplot as plt 8 | 9 | 10 | class RLBot(object): 11 | 12 | def __init__(self): 13 | # just in case, close all opened connections 14 | vrep.simxFinish(-1) 15 | 16 | self.client_id = vrep.simxStart( 17 | '127.0.0.1', 5000, True, True, 5000, 5) 18 | 19 | if self.client_id != -1: # check if client connection successful 20 | print('Connected to remote API server') 21 | else: 22 | print('Connection not successful') 23 | sys.exit('Could not connect') 24 | 25 | # Restart the simulation 26 | self.reset() 27 | 28 | # Get handles 29 | self.get_handles() 30 | 31 | def get_handles(self): 32 | # retrieve motor handles 33 | _, self.left_motor_handle = vrep.simxGetObjectHandle( 34 | self.client_id, 'Pioneer_p3dx_leftMotor', vrep.simx_opmode_blocking) 35 | _, self.right_motor_handle = vrep.simxGetObjectHandle( 36 | self.client_id, 'Pioneer_p3dx_rightMotor', vrep.simx_opmode_blocking) 37 | 38 | # empty list for handles 39 | self.proxy_sensors = [] 40 | 41 | # for loop to retrieve proxy sensor arrays and initiate sensors 42 | for i in range(16): 43 | _, sensor_handle = vrep.simxGetObjectHandle( 44 | self.client_id, 'ultrasonic_sensor#' + str(i), 45 | vrep.simx_opmode_blocking) 46 | # Append to the list of sensors 47 | self.proxy_sensors.append(sensor_handle) 48 | 49 | # empty list for handles 50 | self.light_sensors = [] 51 | 52 | # for loop to retrieve light sensor arrays and initiate sensors 53 | for i in range(8): 54 | _, sensor_handle = vrep.simxGetObjectHandle( 55 | self.client_id, 'light_sensor#' + str(i), 56 | vrep.simx_opmode_blocking) 57 | # Append to the list of sensors 58 | self.light_sensors.append(sensor_handle) 59 | 60 | def destroy(self): 61 | vrep.simxStopSimulation(self.client_id, vrep.simx_opmode_blocking) 62 | 63 | def reset(self): 64 | # Restart the simulation 65 | stop = vrep.simxStopSimulation( 66 | self.client_id, vrep.simx_opmode_blocking) 67 | stop = vrep.simxStopSimulation( 68 | self.client_id, vrep.simx_opmode_blocking) 69 | start = vrep.simxStartSimulation( 70 | self.client_id, vrep.simx_opmode_blocking) 71 | start = vrep.simxStartSimulation( 72 | self.client_id, vrep.simx_opmode_blocking) 73 | print("Resetting Simulation. Stop Code: {} Start Code: {}".format(stop, start)) 74 | 75 | def step(self, action): 76 | # Activate the motors 77 | vrep.simxSetJointTargetVelocity( 78 | self.client_id, self.left_motor_handle, action[0], vrep.simx_opmode_blocking) 79 | vrep.simxSetJointTargetVelocity( 80 | self.client_id, self.right_motor_handle, action[1], vrep.simx_opmode_blocking) 81 | 82 | # Get observations 83 | observations = {} 84 | observations['proxy_sensor'] = [] 85 | observations['light_sensor'] = [] 86 | 87 | # Fetch the vals of proxy sensors 88 | for sensor in self.proxy_sensors: 89 | _, _, detectedPoint, _, _ = vrep.simxReadProximitySensor( 90 | self.client_id, sensor, vrep.simx_opmode_blocking) 91 | # Append to list of values 92 | observations['proxy_sensor'].append( 93 | np.linalg.norm(detectedPoint)) 94 | 95 | # Fetch the vals of light sensors 96 | for sensor in self.light_sensors: 97 | # Fetch the initial value in the suggested mode 98 | _, _, image = vrep.simxGetVisionSensorImage( 99 | self.client_id, sensor, 1, vrep.simx_opmode_blocking) 100 | # extract image from list 101 | image = image[0] if len(image) else -1 102 | # Append to the list of values 103 | observations['light_sensor'].append(image) 104 | 105 | # vrep gives a positive value for the black strip and negative for the 106 | # floor so convert it into 0 and 1 107 | 108 | observations['light_sensor'] = np.asarray(observations['light_sensor']) 109 | observations['light_sensor'] = np.sign(observations['light_sensor']) 110 | 111 | # Assign reward 112 | reward = {} 113 | 114 | # For light sensors 115 | # If any of the center 2 sensors is 1 give high reward 116 | if (observations['light_sensor'][[3, 4]] > 0).any(): 117 | reward['light_sensor'] = 5 118 | # If any of second, third, sixth or seventh is 1 119 | elif (observations['light_sensor'][[1, 2, 5, 6]] > 0).any(): 120 | reward['light_sensor'] = 2 121 | # If first or last are high 122 | elif (observations['light_sensor'][[0, 7]] > 0).any(): 123 | reward['light_sensor'] = 0 124 | # Bot is completly out of line 125 | else: 126 | reward['light_sensor'] = -5 127 | 128 | # For proximity sensors 129 | reward['proxy_sensor'] = 0 130 | 131 | # Should be rewarded for movement 132 | r = np.sum(np.sign(action)) * 2 133 | 134 | reward['light_sensor'] += r 135 | reward['proxy_sensor'] += r 136 | # reward['combined'] += r 137 | 138 | return observations, reward 139 | -------------------------------------------------------------------------------- /src/proxy/env.py: -------------------------------------------------------------------------------- 1 | # Import Libraries: 2 | import vrep 3 | import sys 4 | import time 5 | import numpy as np 6 | import math 7 | import matplotlib.pyplot as plt 8 | 9 | 10 | class RLBot(object): 11 | 12 | def __init__(self): 13 | # just in case, close all opened connections 14 | vrep.simxFinish(-1) 15 | 16 | self.client_id = vrep.simxStart( 17 | '127.0.0.1', 19997, True, True, 5000, 5) 18 | 19 | if self.client_id != -1: # check if client connection successful 20 | print('Connected to remote API server') 21 | else: 22 | print('Connection not successful') 23 | sys.exit('Could not connect') 24 | 25 | # Restart the simulation 26 | self.reset() 27 | 28 | # Get handles 29 | self.get_handles() 30 | 31 | def get_handles(self): 32 | # retrieve motor handles 33 | _, self.left_motor_handle = vrep.simxGetObjectHandle( 34 | self.client_id, 'Pioneer_p3dx_leftMotor', vrep.simx_opmode_blocking) 35 | _, self.right_motor_handle = vrep.simxGetObjectHandle( 36 | self.client_id, 'Pioneer_p3dx_rightMotor', vrep.simx_opmode_blocking) 37 | 38 | # empty list for handles 39 | self.proxy_sensors = [] 40 | 41 | # for loop to retrieve proxy sensor arrays and initiate sensors 42 | for i in range(16): 43 | _, sensor_handle = vrep.simxGetObjectHandle( 44 | self.client_id, 'ultrasonic_sensor#' + str(i), 45 | vrep.simx_opmode_blocking) 46 | # Append to the list of sensors 47 | self.proxy_sensors.append(sensor_handle) 48 | 49 | # empty list for handles 50 | self.light_sensors = [] 51 | 52 | # for loop to retrieve light sensor arrays and initiate sensors 53 | for i in range(8): 54 | _, sensor_handle = vrep.simxGetObjectHandle( 55 | self.client_id, 'light_sensor#' + str(i), 56 | vrep.simx_opmode_blocking) 57 | # Append to the list of sensors 58 | self.light_sensors.append(sensor_handle) 59 | 60 | def destroy(self): 61 | vrep.simxStopSimulation(self.client_id, vrep.simx_opmode_blocking) 62 | 63 | def reset(self): 64 | # Restart the simulation 65 | stop = vrep.simxStopSimulation( 66 | self.client_id, vrep.simx_opmode_blocking) 67 | stop = vrep.simxStopSimulation( 68 | self.client_id, vrep.simx_opmode_blocking) 69 | start = vrep.simxStartSimulation( 70 | self.client_id, vrep.simx_opmode_blocking) 71 | start = vrep.simxStartSimulation( 72 | self.client_id, vrep.simx_opmode_blocking) 73 | print("Resetting Simulation. Stop Code: {} Start Code: {}".format(stop, start)) 74 | 75 | def step(self, action): 76 | # Activate the motors 77 | vrep.simxSetJointTargetVelocity( 78 | self.client_id, self.left_motor_handle, action[0], vrep.simx_opmode_blocking) 79 | vrep.simxSetJointTargetVelocity( 80 | self.client_id, self.right_motor_handle, action[1], vrep.simx_opmode_blocking) 81 | 82 | # Get observations 83 | observations = {} 84 | observations['proxy_sensor'] = [] 85 | observations['light_sensor'] = [] 86 | 87 | # Fetch the vals of proxy sensors 88 | for sensor in self.proxy_sensors: 89 | _, _, detectedPoint, _, _ = vrep.simxReadProximitySensor( 90 | self.client_id, sensor, vrep.simx_opmode_blocking) 91 | # Append to list of values 92 | observations['proxy_sensor'].append( 93 | np.linalg.norm(detectedPoint)) 94 | 95 | # Fetch the vals of light sensors 96 | for sensor in self.light_sensors: 97 | # Fetch the initial value in the suggested mode 98 | _, _, image = vrep.simxGetVisionSensorImage( 99 | self.client_id, sensor, 1, vrep.simx_opmode_blocking) 100 | # extract image from list 101 | image = image[0] if len(image) else -1 102 | # Append to the list of values 103 | observations['light_sensor'].append(image) 104 | 105 | # vrep gives a positive value for the black strip and negative for the 106 | # floor so convert it into 0 and 1 107 | 108 | observations['light_sensor'] = np.asarray(observations['light_sensor']) 109 | observations['light_sensor'] = np.sign(observations['light_sensor']) 110 | 111 | # When nothing is detected a very small value is retured -> changing it to 2 112 | observations['proxy_sensor'] = np.asarray(observations['proxy_sensor']) 113 | observations['proxy_sensor'][observations['proxy_sensor'] < 0.001] = 2 114 | 115 | # Assign reward 116 | reward = {} 117 | 118 | # For light sensors 119 | # If any of the center 2 sensors is 1 give high reward 120 | if (observations['light_sensor'][[3, 4]] > 0).any(): 121 | reward['light_sensor'] = 5 122 | # If any of second, third, sixth or seventh is 1 123 | elif (observations['light_sensor'][[1, 2, 5, 6]] > 0).any(): 124 | reward['light_sensor'] = 2 125 | # If first or last are high 126 | elif (observations['light_sensor'][[0, 7]] > 0).any(): 127 | reward['light_sensor'] = 0 128 | # Bot is completly out of line 129 | else: 130 | reward['light_sensor'] = -5 131 | 132 | # For proximity sensors 133 | reward['proxy_sensor'] = ( 134 | observations['proxy_sensor'] < 0.7).sum() * -2 135 | reward['proxy_sensor'] += ( 136 | observations['proxy_sensor'] == 0).sum() * -10 137 | 138 | # Should be rewarded for movement 139 | r = np.clip(np.sum(np.absolute(action)) * 2, 0, 2) 140 | 141 | reward['light_sensor'] += r 142 | reward['proxy_sensor'] += r 143 | # reward['combined'] += r 144 | 145 | return observations, reward 146 | -------------------------------------------------------------------------------- /src/proxy/history.p: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'rList' 3 | p1 4 | (lp2 5 | cnumpy.core.multiarray 6 | scalar 7 | p3 8 | (cnumpy 9 | dtype 10 | p4 11 | (S'f8' 12 | p5 13 | I0 14 | I1 15 | tp6 16 | Rp7 17 | (I3 18 | S'<' 19 | p8 20 | NNNI-1 21 | I-1 22 | I0 23 | tp9 24 | bS'affff\xe9\xb1\xc0' 25 | p10 26 | tp11 27 | Rp12 28 | ag3 29 | (g7 30 | S'\xb4\xcc\xcc\xcc\xcc\x04\xa1\xc0' 31 | p13 32 | tp14 33 | Rp15 34 | ag3 35 | (g7 36 | S'Mffff\x16\xa3\xc0' 37 | p16 38 | tp17 39 | Rp18 40 | ag3 41 | (g7 42 | S'x\x99\x99\x99\x99E\x9f\xc0' 43 | p19 44 | tp20 45 | Rp21 46 | ag3 47 | (g7 48 | S'"3333\x87\x96\xc0' 49 | p22 50 | tp23 51 | Rp24 52 | ag3 53 | (g7 54 | S'y\x99\x99\x99\x99\x05\x9a\xc0' 55 | p25 56 | tp26 57 | Rp27 58 | ag3 59 | (g7 60 | S'\x183333\xbd\xa2\xc0' 61 | p28 62 | tp29 63 | Rp30 64 | ag3 65 | (g7 66 | S'\x1c3333\xcf\x97\xc0' 67 | p31 68 | tp32 69 | Rp33 70 | ag3 71 | (g7 72 | S'Hffff\xda\xa4\xc0' 73 | p34 74 | tp35 75 | Rp36 76 | ag3 77 | (g7 78 | S'Gffff\x86\xa1\xc0' 79 | p37 80 | tp38 81 | Rp39 82 | ag3 83 | (g7 84 | S'Cffff\x82\xa9\xc0' 85 | p40 86 | tp41 87 | Rp42 88 | ag3 89 | (g7 90 | S'Jffff\xa8\xa2\xc0' 91 | p43 92 | tp44 93 | Rp45 94 | ag3 95 | (g7 96 | S'}\x99\x99\x99\x99\x99\xa2\xc0' 97 | p46 98 | tp47 99 | Rp48 100 | ag3 101 | (g7 102 | S'\x82\x99\x99\x99\x99\xb7\xa0\xc0' 103 | p49 104 | tp50 105 | Rp51 106 | ag3 107 | (g7 108 | S'\x1c3333O\xa3\xc0' 109 | p52 110 | tp53 111 | Rp54 112 | ag3 113 | (g7 114 | S'Iffff\xea\xa2\xc0' 115 | p55 116 | tp56 117 | Rp57 118 | ag3 119 | (g7 120 | S'{\x99\x99\x99\x99\xa3\xa4\xc0' 121 | p58 122 | tp59 123 | Rp60 124 | ag3 125 | (g7 126 | S'Jffff&\xa2\xc0' 127 | p61 128 | tp62 129 | Rp63 130 | ag3 131 | (g7 132 | S'}\x99\x99\x99\x99;\xa3\xc0' 133 | p64 134 | tp65 135 | Rp66 136 | ag3 137 | (g7 138 | S'\xd5\xff\xff\xff\xff/\x9a\xc0' 139 | p67 140 | tp68 141 | Rp69 142 | ag3 143 | (g7 144 | S'MffffB\xa3\xc0' 145 | p70 146 | tp71 147 | Rp72 148 | ag3 149 | (g7 150 | S'\xaa\xcc\xcc\xcc\xcc\xea\xaa\xc0' 151 | p73 152 | tp74 153 | Rp75 154 | ag3 155 | (g7 156 | S'|\x99\x99\x99\x99)\xa3\xc0' 157 | p76 158 | tp77 159 | Rp78 160 | ag3 161 | (g7 162 | S'z\x99\x99\x99\x99\xc5\xa3\xc0' 163 | p79 164 | tp80 165 | Rp81 166 | ag3 167 | (g7 168 | S'\x183333\x83\x9b\xc0' 169 | p82 170 | tp83 171 | Rp84 172 | ag3 173 | (g7 174 | S'\xb9\xcc\xcc\xcc\xcc\xf8\x95\xc0' 175 | p85 176 | tp86 177 | Rp87 178 | ag3 179 | (g7 180 | S'm\x99\x99\x99\x99\xb9\x9f\xc0' 181 | p88 182 | tp89 183 | Rp90 184 | ag3 185 | (g7 186 | S'~\x99\x99\x99\x99o\xa2\xc0' 187 | p91 188 | tp92 189 | Rp93 190 | ag3 191 | (g7 192 | S'}\x99\x99\x99\x99\xb1\xa4\xc0' 193 | p94 194 | tp95 195 | Rp96 196 | ag3 197 | (g7 198 | S'}\x99\x99\x99\x99G\xa4\xc0' 199 | p97 200 | tp98 201 | Rp99 202 | ag3 203 | (g7 204 | S' 3333\xe7\x95\xc0' 205 | p100 206 | tp101 207 | Rp102 208 | ag3 209 | (g7 210 | S'\xe1\xff\xff\xff\xff/\x9b\xc0' 211 | p103 212 | tp104 213 | Rp105 214 | ag3 215 | (g7 216 | S'}\x99\x99\x99\x99Y\xa5\xc0' 217 | p106 218 | tp107 219 | Rp108 220 | ag3 221 | (g7 222 | S'|\x99\x99\x99\x99\xf5\x9b\xc0' 223 | p109 224 | tp110 225 | Rp111 226 | ag3 227 | (g7 228 | S'\xb3\xcc\xcc\xcc\xcc\xec\x9c\xc0' 229 | p112 230 | tp113 231 | Rp114 232 | ag3 233 | (g7 234 | S'\x7f\x99\x99\x99\x99%\x97\xc0' 235 | p115 236 | tp116 237 | Rp117 238 | ag3 239 | (g7 240 | S'Lffff\xd6\xa1\xc0' 241 | p118 242 | tp119 243 | Rp120 244 | ag3 245 | (g7 246 | S'\x153333\xfd\xa1\xc0' 247 | p121 248 | tp122 249 | Rp123 250 | ag3 251 | (g7 252 | S'\xa1\xcc\xcc\xcc\xccP\x9d\xc0' 253 | p124 254 | tp125 255 | Rp126 256 | ag3 257 | (g7 258 | S'\xcf\xff\xff\xff\xff_\x9f\xc0' 259 | p127 260 | tp128 261 | Rp129 262 | ag3 263 | (g7 264 | S'Sffffr\x98\xc0' 265 | p130 266 | tp131 267 | Rp132 268 | ag3 269 | (g7 270 | S'\xb2\xcc\xcc\xcc\xcc\xb8\xa1\xc0' 271 | p133 272 | tp134 273 | Rp135 274 | ag3 275 | (g7 276 | S'\x9e\xcc\xcc\xcc\xcc\x80\x9b\xc0' 277 | p136 278 | tp137 279 | Rp138 280 | ag3 281 | (g7 282 | S'~\x99\x99\x99\x99\xa7\xa1\xc0' 283 | p139 284 | tp140 285 | Rp141 286 | asS'jList' 287 | p142 288 | (lp143 289 | I299 290 | aI299 291 | aI299 292 | aI299 293 | aI299 294 | aI299 295 | aI299 296 | aI299 297 | aI299 298 | aI299 299 | aI299 300 | aI299 301 | aI299 302 | aI299 303 | aI299 304 | aI299 305 | aI299 306 | aI299 307 | aI299 308 | aI299 309 | aI299 310 | aI299 311 | aI299 312 | aI299 313 | aI299 314 | aI299 315 | aI299 316 | aI299 317 | aI299 318 | aI299 319 | aI299 320 | aI299 321 | aI299 322 | aI299 323 | aI299 324 | aI299 325 | aI299 326 | aI299 327 | aI299 328 | aI299 329 | aI299 330 | aI299 331 | aI299 332 | aI299 333 | asS'lList' 334 | p144 335 | (lp145 336 | g3 337 | (g7 338 | S'\x00\x00\x00\x00\x00\x00\xf8\x7f' 339 | p146 340 | tp147 341 | Rp148 342 | ag3 343 | (g7 344 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 345 | p149 346 | tp150 347 | Rp151 348 | ag3 349 | (g7 350 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 351 | p152 352 | tp153 353 | Rp154 354 | ag3 355 | (g7 356 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 357 | p155 358 | tp156 359 | Rp157 360 | ag3 361 | (g7 362 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 363 | p158 364 | tp159 365 | Rp160 366 | ag3 367 | (g7 368 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 369 | p161 370 | tp162 371 | Rp163 372 | ag3 373 | (g7 374 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 375 | p164 376 | tp165 377 | Rp166 378 | ag3 379 | (g7 380 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 381 | p167 382 | tp168 383 | Rp169 384 | ag3 385 | (g7 386 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 387 | p170 388 | tp171 389 | Rp172 390 | ag3 391 | (g7 392 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 393 | p173 394 | tp174 395 | Rp175 396 | ag3 397 | (g7 398 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 399 | p176 400 | tp177 401 | Rp178 402 | ag3 403 | (g7 404 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 405 | p179 406 | tp180 407 | Rp181 408 | ag3 409 | (g7 410 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 411 | p182 412 | tp183 413 | Rp184 414 | ag3 415 | (g7 416 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 417 | p185 418 | tp186 419 | Rp187 420 | ag3 421 | (g7 422 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 423 | p188 424 | tp189 425 | Rp190 426 | ag3 427 | (g7 428 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 429 | p191 430 | tp192 431 | Rp193 432 | ag3 433 | (g7 434 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 435 | p194 436 | tp195 437 | Rp196 438 | ag3 439 | (g7 440 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 441 | p197 442 | tp198 443 | Rp199 444 | ag3 445 | (g7 446 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 447 | p200 448 | tp201 449 | Rp202 450 | ag3 451 | (g7 452 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 453 | p203 454 | tp204 455 | Rp205 456 | ag3 457 | (g7 458 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 459 | p206 460 | tp207 461 | Rp208 462 | ag3 463 | (g7 464 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 465 | p209 466 | tp210 467 | Rp211 468 | ag3 469 | (g7 470 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 471 | p212 472 | tp213 473 | Rp214 474 | ag3 475 | (g7 476 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 477 | p215 478 | tp216 479 | Rp217 480 | ag3 481 | (g7 482 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 483 | p218 484 | tp219 485 | Rp220 486 | ag3 487 | (g7 488 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 489 | p221 490 | tp222 491 | Rp223 492 | ag3 493 | (g7 494 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 495 | p224 496 | tp225 497 | Rp226 498 | ag3 499 | (g7 500 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 501 | p227 502 | tp228 503 | Rp229 504 | ag3 505 | (g7 506 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 507 | p230 508 | tp231 509 | Rp232 510 | ag3 511 | (g7 512 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 513 | p233 514 | tp234 515 | Rp235 516 | ag3 517 | (g7 518 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 519 | p236 520 | tp237 521 | Rp238 522 | ag3 523 | (g7 524 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 525 | p239 526 | tp240 527 | Rp241 528 | ag3 529 | (g7 530 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 531 | p242 532 | tp243 533 | Rp244 534 | ag3 535 | (g7 536 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 537 | p245 538 | tp246 539 | Rp247 540 | ag3 541 | (g7 542 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 543 | p248 544 | tp249 545 | Rp250 546 | ag3 547 | (g7 548 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 549 | p251 550 | tp252 551 | Rp253 552 | ag3 553 | (g7 554 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 555 | p254 556 | tp255 557 | Rp256 558 | ag3 559 | (g7 560 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 561 | p257 562 | tp258 563 | Rp259 564 | ag3 565 | (g7 566 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 567 | p260 568 | tp261 569 | Rp262 570 | ag3 571 | (g7 572 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 573 | p263 574 | tp264 575 | Rp265 576 | ag3 577 | (g7 578 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 579 | p266 580 | tp267 581 | Rp268 582 | ag3 583 | (g7 584 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 585 | p269 586 | tp270 587 | Rp271 588 | ag3 589 | (g7 590 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 591 | p272 592 | tp273 593 | Rp274 594 | ag3 595 | (g7 596 | S'\x00\x00\x00\x00\x00\x00\xf8\xff' 597 | p275 598 | tp276 599 | Rp277 600 | as. -------------------------------------------------------------------------------- /src/ir/vrepConst.py: -------------------------------------------------------------------------------- 1 | # This file is part of the REMOTE API 2 | # 3 | # Copyright 2006-2017 Coppelia Robotics GmbH. All rights reserved. 4 | # marc@coppeliarobotics.com 5 | # www.coppeliarobotics.com 6 | # 7 | # The REMOTE API is licensed under the terms of GNU GPL: 8 | # 9 | # ------------------------------------------------------------------- 10 | # The REMOTE API is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # THE REMOTE API IS DISTRIBUTED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED 16 | # WARRANTY. THE USER WILL USE IT AT HIS/HER OWN RISK. THE ORIGINAL 17 | # AUTHORS AND COPPELIA ROBOTICS GMBH WILL NOT BE LIABLE FOR DATA LOSS, 18 | # DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR 19 | # MISUSING THIS SOFTWARE. 20 | # 21 | # See the GNU General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU General Public License 24 | # along with the REMOTE API. If not, see . 25 | # ------------------------------------------------------------------- 26 | # 27 | # This file was automatically created for V-REP release V3.4.0 rev. 1 on April 5th 2017 28 | 29 | #constants 30 | #Scene object types. Values are serialized 31 | sim_object_shape_type =0 32 | sim_object_joint_type =1 33 | sim_object_graph_type =2 34 | sim_object_camera_type =3 35 | sim_object_dummy_type =4 36 | sim_object_proximitysensor_type =5 37 | sim_object_reserved1 =6 38 | sim_object_reserved2 =7 39 | sim_object_path_type =8 40 | sim_object_visionsensor_type =9 41 | sim_object_volume_type =10 42 | sim_object_mill_type =11 43 | sim_object_forcesensor_type =12 44 | sim_object_light_type =13 45 | sim_object_mirror_type =14 46 | 47 | #General object types. Values are serialized 48 | sim_appobj_object_type =109 49 | sim_appobj_collision_type =110 50 | sim_appobj_distance_type =111 51 | sim_appobj_simulation_type =112 52 | sim_appobj_ik_type =113 53 | sim_appobj_constraintsolver_type=114 54 | sim_appobj_collection_type =115 55 | sim_appobj_ui_type =116 56 | sim_appobj_script_type =117 57 | sim_appobj_pathplanning_type =118 58 | sim_appobj_RESERVED_type =119 59 | sim_appobj_texture_type =120 60 | 61 | # Ik calculation methods. Values are serialized 62 | sim_ik_pseudo_inverse_method =0 63 | sim_ik_damped_least_squares_method =1 64 | sim_ik_jacobian_transpose_method =2 65 | 66 | # Ik constraints. Values are serialized 67 | sim_ik_x_constraint =1 68 | sim_ik_y_constraint =2 69 | sim_ik_z_constraint =4 70 | sim_ik_alpha_beta_constraint=8 71 | sim_ik_gamma_constraint =16 72 | sim_ik_avoidance_constraint =64 73 | 74 | # Ik calculation results 75 | sim_ikresult_not_performed =0 76 | sim_ikresult_success =1 77 | sim_ikresult_fail =2 78 | 79 | # Scene object sub-types. Values are serialized 80 | # Light sub-types 81 | sim_light_omnidirectional_subtype =1 82 | sim_light_spot_subtype =2 83 | sim_light_directional_subtype =3 84 | # Joint sub-types 85 | sim_joint_revolute_subtype =10 86 | sim_joint_prismatic_subtype =11 87 | sim_joint_spherical_subtype =12 88 | # Shape sub-types 89 | sim_shape_simpleshape_subtype =20 90 | sim_shape_multishape_subtype =21 91 | # Proximity sensor sub-types 92 | sim_proximitysensor_pyramid_subtype =30 93 | sim_proximitysensor_cylinder_subtype=31 94 | sim_proximitysensor_disc_subtype =32 95 | sim_proximitysensor_cone_subtype =33 96 | sim_proximitysensor_ray_subtype =34 97 | # Mill sub-types 98 | sim_mill_pyramid_subtype =40 99 | sim_mill_cylinder_subtype =41 100 | sim_mill_disc_subtype =42 101 | sim_mill_cone_subtype =42 102 | # No sub-type 103 | sim_object_no_subtype =200 104 | 105 | 106 | #Scene object main properties (serialized) 107 | sim_objectspecialproperty_collidable =0x0001 108 | sim_objectspecialproperty_measurable =0x0002 109 | #reserved =0x0004 110 | #reserved =0x0008 111 | sim_objectspecialproperty_detectable_ultrasonic =0x0010 112 | sim_objectspecialproperty_detectable_infrared =0x0020 113 | sim_objectspecialproperty_detectable_laser =0x0040 114 | sim_objectspecialproperty_detectable_inductive =0x0080 115 | sim_objectspecialproperty_detectable_capacitive =0x0100 116 | sim_objectspecialproperty_renderable =0x0200 117 | sim_objectspecialproperty_detectable_all =sim_objectspecialproperty_detectable_ultrasonic|sim_objectspecialproperty_detectable_infrared|sim_objectspecialproperty_detectable_laser|sim_objectspecialproperty_detectable_inductive|sim_objectspecialproperty_detectable_capacitive 118 | sim_objectspecialproperty_cuttable =0x0400 119 | sim_objectspecialproperty_pathplanning_ignored =0x0800 120 | 121 | # Model properties (serialized) 122 | sim_modelproperty_not_collidable =0x0001 123 | sim_modelproperty_not_measurable =0x0002 124 | sim_modelproperty_not_renderable =0x0004 125 | sim_modelproperty_not_detectable =0x0008 126 | sim_modelproperty_not_cuttable =0x0010 127 | sim_modelproperty_not_dynamic =0x0020 128 | sim_modelproperty_not_respondable =0x0040 # cannot be selected if sim_modelproperty_not_dynamic is not selected 129 | sim_modelproperty_not_reset =0x0080 # Model is not reset at simulation end. This flag is cleared at simulation end 130 | sim_modelproperty_not_visible =0x0100 # Whole model is invisible independent of local visibility settings 131 | sim_modelproperty_not_model =0xf000 # object is not a model 132 | 133 | 134 | # Check the documentation instead of comments below!! 135 | # Following messages are dispatched to the Lua-message container 136 | sim_message_ui_button_state_change =0 # a UI button slider etc. changed (due to a user's action). aux[0]=UI handle aux[1]=button handle aux[2]=button attributes aux[3]=slider position (if slider) 137 | sim_message_reserved9 =1 # Do not use 138 | sim_message_object_selection_changed=2 139 | sim_message_reserved10 =3 # do not use 140 | sim_message_model_loaded =4 141 | sim_message_reserved11 =5 # do not use 142 | sim_message_keypress =6 # a key was pressed while the focus was on a page (aux[0]=key aux[1]=ctrl and shift key state) 143 | sim_message_bannerclicked =7 # a banner was clicked (aux[0]=banner ID) 144 | 145 | 146 | # Following messages are dispatched only to the C-API (not available from Lua) 147 | sim_message_for_c_api_only_start =0x100 # Do not use 148 | sim_message_reserved1 =0x101 # Do not use 149 | sim_message_reserved2 =0x102 # Do not use 150 | sim_message_reserved3 =0x103 # Do not use 151 | sim_message_eventcallback_scenesave =0x104 # about to save a scene 152 | sim_message_eventcallback_modelsave =0x105 # about to save a model (current selection will be saved) 153 | sim_message_eventcallback_moduleopen =0x106 # called when simOpenModule in Lua is called 154 | sim_message_eventcallback_modulehandle =0x107 # called when simHandleModule in Lua is called with argument false 155 | sim_message_eventcallback_moduleclose =0x108 # called when simCloseModule in Lua is called 156 | sim_message_reserved4 =0x109 # Do not use 157 | sim_message_reserved5 =0x10a # Do not use 158 | sim_message_reserved6 =0x10b # Do not use 159 | sim_message_reserved7 =0x10c # Do not use 160 | sim_message_eventcallback_instancepass =0x10d # Called once every main application loop pass. auxiliaryData[0] contains event flags of events that happened since last time 161 | sim_message_eventcallback_broadcast =0x10e 162 | sim_message_eventcallback_imagefilter_enumreset =0x10f 163 | sim_message_eventcallback_imagefilter_enumerate =0x110 164 | sim_message_eventcallback_imagefilter_adjustparams =0x111 165 | sim_message_eventcallback_imagefilter_reserved =0x112 166 | sim_message_eventcallback_imagefilter_process =0x113 167 | sim_message_eventcallback_reserved1 =0x114 # do not use 168 | sim_message_eventcallback_reserved2 =0x115 # do not use 169 | sim_message_eventcallback_reserved3 =0x116 # do not use 170 | sim_message_eventcallback_reserved4 =0x117 # do not use 171 | sim_message_eventcallback_abouttoundo =0x118 # the undo button was hit and a previous state is about to be restored 172 | sim_message_eventcallback_undoperformed =0x119 # the undo button was hit and a previous state restored 173 | sim_message_eventcallback_abouttoredo =0x11a # the redo button was hit and a future state is about to be restored 174 | sim_message_eventcallback_redoperformed =0x11b # the redo button was hit and a future state restored 175 | sim_message_eventcallback_scripticondblclick =0x11c # scipt icon was double clicked. (aux[0]=object handle associated with script set replyData[0] to 1 if script should not be opened) 176 | sim_message_eventcallback_simulationabouttostart =0x11d 177 | sim_message_eventcallback_simulationended =0x11e 178 | sim_message_eventcallback_reserved5 =0x11f # do not use 179 | sim_message_eventcallback_keypress =0x120 # a key was pressed while the focus was on a page (aux[0]=key aux[1]=ctrl and shift key state) 180 | sim_message_eventcallback_modulehandleinsensingpart =0x121 # called when simHandleModule in Lua is called with argument true 181 | sim_message_eventcallback_renderingpass =0x122 # called just before the scene is rendered 182 | sim_message_eventcallback_bannerclicked =0x123 # called when a banner was clicked (aux[0]=banner ID) 183 | sim_message_eventcallback_menuitemselected =0x124 # auxiliaryData[0] indicates the handle of the item auxiliaryData[1] indicates the state of the item 184 | sim_message_eventcallback_refreshdialogs =0x125 # aux[0]=refresh degree (0=light 1=medium 2=full) 185 | sim_message_eventcallback_sceneloaded =0x126 186 | sim_message_eventcallback_modelloaded =0x127 187 | sim_message_eventcallback_instanceswitch =0x128 188 | sim_message_eventcallback_guipass =0x129 189 | sim_message_eventcallback_mainscriptabouttobecalled =0x12a 190 | sim_message_eventcallback_rmlposition =0x12b #the command simRMLPosition was called. The appropriate plugin should handle the call 191 | sim_message_eventcallback_rmlvelocity =0x12c # the command simRMLVelocity was called. The appropriate plugin should handle the call 192 | sim_message_simulation_start_resume_request =0x1000 193 | sim_message_simulation_pause_request =0x1001 194 | sim_message_simulation_stop_request =0x1002 195 | 196 | # Scene object properties. Combine with the | operator 197 | sim_objectproperty_reserved1 =0x0000 198 | sim_objectproperty_reserved2 =0x0001 199 | sim_objectproperty_reserved3 =0x0002 200 | sim_objectproperty_reserved4 =0x0003 201 | sim_objectproperty_reserved5 =0x0004 # formely sim_objectproperty_visible 202 | sim_objectproperty_reserved6 =0x0008 # formely sim_objectproperty_wireframe 203 | sim_objectproperty_collapsed =0x0010 204 | sim_objectproperty_selectable =0x0020 205 | sim_objectproperty_reserved7 =0x0040 206 | sim_objectproperty_selectmodelbaseinstead =0x0080 207 | sim_objectproperty_dontshowasinsidemodel =0x0100 208 | # reserved =0x0200 209 | sim_objectproperty_canupdatedna =0x0400 210 | sim_objectproperty_selectinvisible =0x0800 211 | sim_objectproperty_depthinvisible =0x1000 212 | 213 | 214 | # type of arguments (input and output) for custom lua commands 215 | sim_lua_arg_nil =0 216 | sim_lua_arg_bool =1 217 | sim_lua_arg_int =2 218 | sim_lua_arg_float =3 219 | sim_lua_arg_string =4 220 | sim_lua_arg_invalid =5 221 | sim_lua_arg_table =8 222 | 223 | # custom user interface properties. Values are serialized. 224 | sim_ui_property_visible =0x0001 225 | sim_ui_property_visibleduringsimulationonly =0x0002 226 | sim_ui_property_moveable =0x0004 227 | sim_ui_property_relativetoleftborder =0x0008 228 | sim_ui_property_relativetotopborder =0x0010 229 | sim_ui_property_fixedwidthfont =0x0020 230 | sim_ui_property_systemblock =0x0040 231 | sim_ui_property_settocenter =0x0080 232 | sim_ui_property_rolledup =0x0100 233 | sim_ui_property_selectassociatedobject =0x0200 234 | sim_ui_property_visiblewhenobjectselected =0x0400 235 | 236 | 237 | # button properties. Values are serialized. 238 | sim_buttonproperty_button =0x0000 239 | sim_buttonproperty_label =0x0001 240 | sim_buttonproperty_slider =0x0002 241 | sim_buttonproperty_editbox =0x0003 242 | sim_buttonproperty_staydown =0x0008 243 | sim_buttonproperty_enabled =0x0010 244 | sim_buttonproperty_borderless =0x0020 245 | sim_buttonproperty_horizontallycentered =0x0040 246 | sim_buttonproperty_ignoremouse =0x0080 247 | sim_buttonproperty_isdown =0x0100 248 | sim_buttonproperty_transparent =0x0200 249 | sim_buttonproperty_nobackgroundcolor =0x0400 250 | sim_buttonproperty_rollupaction =0x0800 251 | sim_buttonproperty_closeaction =0x1000 252 | sim_buttonproperty_verticallycentered =0x2000 253 | sim_buttonproperty_downupevent =0x4000 254 | 255 | 256 | # Simulation status 257 | sim_simulation_stopped =0x00 # Simulation is stopped 258 | sim_simulation_paused =0x08 # Simulation is paused 259 | sim_simulation_advancing =0x10 # Simulation is advancing 260 | sim_simulation_advancing_firstafterstop =sim_simulation_advancing|0x00 # First simulation pass (1x) 261 | sim_simulation_advancing_running =sim_simulation_advancing|0x01 # Normal simulation pass (>=1x) 262 | # reserved =sim_simulation_advancing|0x02 263 | sim_simulation_advancing_lastbeforepause =sim_simulation_advancing|0x03 # Last simulation pass before pause (1x) 264 | sim_simulation_advancing_firstafterpause =sim_simulation_advancing|0x04 # First simulation pass after pause (1x) 265 | sim_simulation_advancing_abouttostop =sim_simulation_advancing|0x05 # "Trying to stop" simulation pass (>=1x) 266 | sim_simulation_advancing_lastbeforestop =sim_simulation_advancing|0x06 # Last simulation pass (1x) 267 | 268 | 269 | # Script execution result (first return value) 270 | sim_script_no_error =0 271 | sim_script_main_script_nonexistent =1 272 | sim_script_main_script_not_called =2 273 | sim_script_reentrance_error =4 274 | sim_script_lua_error =8 275 | sim_script_call_error =16 276 | 277 | 278 | # Script types (serialized!) 279 | sim_scripttype_mainscript =0 280 | sim_scripttype_childscript =1 281 | sim_scripttype_jointctrlcallback =4 282 | sim_scripttype_contactcallback =5 283 | sim_scripttype_customizationscript =6 284 | sim_scripttype_generalcallback =7 285 | 286 | # API call error messages 287 | sim_api_errormessage_ignore =0 # does not memorize nor output errors 288 | sim_api_errormessage_report =1 # memorizes errors (default for C-API calls) 289 | sim_api_errormessage_output =2 # memorizes and outputs errors (default for Lua-API calls) 290 | 291 | 292 | # special argument of some functions 293 | sim_handle_all =-2 294 | sim_handle_all_except_explicit =-3 295 | sim_handle_self =-4 296 | sim_handle_main_script =-5 297 | sim_handle_tree =-6 298 | sim_handle_chain =-7 299 | sim_handle_single =-8 300 | sim_handle_default =-9 301 | sim_handle_all_except_self =-10 302 | sim_handle_parent =-11 303 | 304 | 305 | # special handle flags 306 | sim_handleflag_assembly =0x400000 307 | sim_handleflag_model =0x800000 308 | 309 | 310 | # distance calculation methods (serialized) 311 | sim_distcalcmethod_dl =0 312 | sim_distcalcmethod_dac =1 313 | sim_distcalcmethod_max_dl_dac =2 314 | sim_distcalcmethod_dl_and_dac =3 315 | sim_distcalcmethod_sqrt_dl2_and_dac2=4 316 | sim_distcalcmethod_dl_if_nonzero =5 317 | sim_distcalcmethod_dac_if_nonzero =6 318 | 319 | 320 | # Generic dialog styles 321 | sim_dlgstyle_message =0 322 | sim_dlgstyle_input =1 323 | sim_dlgstyle_ok =2 324 | sim_dlgstyle_ok_cancel =3 325 | sim_dlgstyle_yes_no =4 326 | sim_dlgstyle_dont_center =32# can be combined with one of above values. Only with this flag can the position of the related UI be set just after dialog creation 327 | 328 | # Generic dialog return values 329 | sim_dlgret_still_open =0 330 | sim_dlgret_ok =1 331 | sim_dlgret_cancel =2 332 | sim_dlgret_yes =3 333 | sim_dlgret_no =4 334 | 335 | 336 | # Path properties 337 | sim_pathproperty_show_line =0x0001 338 | sim_pathproperty_show_orientation =0x0002 339 | sim_pathproperty_closed_path =0x0004 340 | sim_pathproperty_automatic_orientation =0x0008 341 | sim_pathproperty_invert_velocity =0x0010 342 | sim_pathproperty_infinite_acceleration =0x0020 343 | sim_pathproperty_flat_path =0x0040 344 | sim_pathproperty_show_position =0x0080 345 | sim_pathproperty_auto_velocity_profile_translation =0x0100 346 | sim_pathproperty_auto_velocity_profile_rotation =0x0200 347 | sim_pathproperty_endpoints_at_zero =0x0400 348 | sim_pathproperty_keep_x_up =0x0800 349 | 350 | 351 | # drawing objects 352 | # following are mutually exclusive 353 | sim_drawing_points =0 # 3 values per point (point size in pixels) 354 | sim_drawing_lines =1 # 6 values per line (line size in pixels) 355 | sim_drawing_triangles =2 # 9 values per triangle 356 | sim_drawing_trianglepoints =3 # 6 values per point (3 for triangle position 3 for triangle normal vector) (triangle size in meters) 357 | sim_drawing_quadpoints =4 # 6 values per point (3 for quad position 3 for quad normal vector) (quad size in meters) 358 | sim_drawing_discpoints =5 # 6 values per point (3 for disc position 3 for disc normal vector) (disc size in meters) 359 | sim_drawing_cubepoints =6 # 6 values per point (3 for cube position 3 for cube normal vector) (cube size in meters) 360 | sim_drawing_spherepoints =7 # 3 values per point (sphere size in meters) 361 | 362 | # following can be or-combined 363 | sim_drawing_itemcolors =0x00020 # +3 values per item (each item has its own ambient color (rgb values)). 364 | # Mutually exclusive with sim_drawing_vertexcolors 365 | sim_drawing_vertexcolors =0x00040 # +3 values per vertex (each vertex has its own ambient color (rgb values). Only for sim_drawing_lines (+6) and for sim_drawing_triangles(+9)). Mutually exclusive with sim_drawing_itemcolors 366 | sim_drawing_itemsizes =0x00080 # +1 value per item (each item has its own size). Not for sim_drawing_triangles 367 | sim_drawing_backfaceculling =0x00100 # back faces are not displayed for all items 368 | sim_drawing_wireframe =0x00200 # all items displayed in wireframe 369 | sim_drawing_painttag =0x00400 # all items are tagged as paint (for additinal processing at a later stage) 370 | sim_drawing_followparentvisibility =0x00800 # if the object is associated with a scene object then it follows that visibility otherwise it is always visible 371 | sim_drawing_cyclic =0x01000 # if the max item count was reached then the first items are overwritten. 372 | sim_drawing_50percenttransparency =0x02000 # the drawing object will be 50% transparent 373 | sim_drawing_25percenttransparency =0x04000 # the drawing object will be 25% transparent 374 | sim_drawing_12percenttransparency =0x08000 # the drawing object will be 12.5% transparent 375 | sim_drawing_emissioncolor =0x10000 # When used in combination with sim_drawing_itemcolors or sim_drawing_vertexcolors then the specified colors will be for the emissive component 376 | sim_drawing_facingcamera =0x20000 # Only for trianglepoints quadpoints discpoints and cubepoints. If specified the normal verctor is calculated to face the camera (each item data requires 3 values less) 377 | sim_drawing_overlay =0x40000 # When specified objects are always drawn on top of "regular objects" 378 | sim_drawing_itemtransparency =0x80000 # +1 value per item (each item has its own transparency value (0-1)). Not compatible with sim_drawing_vertexcolors 379 | 380 | # banner values 381 | # following can be or-combined 382 | sim_banner_left =0x00001 # Banners display on the left of the specified point 383 | sim_banner_right =0x00002 # Banners display on the right of the specified point 384 | sim_banner_nobackground =0x00004 # Banners have no background rectangle 385 | sim_banner_overlay =0x00008 # When specified banners are always drawn on top of "regular objects" 386 | sim_banner_followparentvisibility =0x00010 # if the object is associated with a scene object then it follows that visibility otherwise it is always visible 387 | sim_banner_clickselectsparent =0x00020 # if the object is associated with a scene object then clicking the banner will select the scene object 388 | sim_banner_clicktriggersevent =0x00040 # if the banner is clicked an event is triggered (sim_message_eventcallback_bannerclicked and sim_message_bannerclicked are generated) 389 | sim_banner_facingcamera =0x00080 # If specified the banner will always face the camera by rotating around the banner's vertical axis (y-axis) 390 | sim_banner_fullyfacingcamera =0x00100 # If specified the banner will always fully face the camera (the banner's orientation is same as the camera looking at it) 391 | sim_banner_backfaceculling =0x00200 # If specified the banner will only be visible from one side 392 | sim_banner_keepsamesize =0x00400 # If specified the banner will always appear in the same size. In that case size represents the character height in pixels 393 | sim_banner_bitmapfont =0x00800 # If specified a fixed-size bitmap font is used. The text will also always fully face the camera and be right 394 | # to the specified position. Bitmap fonts are not clickable 395 | 396 | 397 | # particle objects following are mutually exclusive 398 | sim_particle_points1 =0 # 6 values per point (pt1 and pt2. Pt1 is start position pt2-pt1 is the initial velocity vector). i 399 | #Point is 1 pixel big. Only appearance is a point internally handled as a perfect sphere 400 | sim_particle_points2 =1 # 6 values per point. Point is 2 pixel big. Only appearance is a point internally handled as a perfect sphere 401 | sim_particle_points4 =2 # 6 values per point. Point is 4 pixel big. Only appearance is a point internally handled as a perfect sphere 402 | sim_particle_roughspheres =3 # 6 values per sphere. Only appearance is rough. Internally a perfect sphere 403 | sim_particle_spheres =4 # 6 values per sphere. Internally a perfect sphere 404 | 405 | 406 | 407 | 408 | # following can be or-combined 409 | sim_particle_respondable1to4 =0x0020 # the particles are respondable against shapes (against all objects that have at least one bit 1-4 activated in the global respondable mask) 410 | sim_particle_respondable5to8 =0x0040 # the particles are respondable against shapes (against all objects that have at least one bit 5-8 activated in the global respondable mask) 411 | sim_particle_particlerespondable =0x0080 # the particles are respondable against each other 412 | sim_particle_ignoresgravity =0x0100 # the particles ignore the effect of gravity. Not compatible with sim_particle_water 413 | sim_particle_invisible =0x0200 # the particles are invisible 414 | sim_particle_itemsizes =0x0400 # +1 value per particle (each particle can have a different size) 415 | sim_particle_itemdensities =0x0800 # +1 value per particle (each particle can have a different density) 416 | sim_particle_itemcolors =0x1000 # +3 values per particle (each particle can have a different color) 417 | sim_particle_cyclic =0x2000 # if the max item count was reached then the first items are overwritten. 418 | sim_particle_emissioncolor =0x4000 # When used in combination with sim_particle_itemcolors then the specified colors will be for the emissive component 419 | sim_particle_water =0x8000 # the particles are water particles (no weight in the water (i.e. when z<0)). Not compatible with sim_particle_ignoresgravity 420 | sim_particle_painttag =0x10000 # The particles can be seen by vision sensors (sim_particle_invisible must not be set) 421 | 422 | 423 | 424 | 425 | # custom user interface menu attributes 426 | sim_ui_menu_title =1 427 | sim_ui_menu_minimize =2 428 | sim_ui_menu_close =4 429 | sim_ui_menu_systemblock =8 430 | 431 | 432 | 433 | # Boolean parameters 434 | sim_boolparam_hierarchy_visible =0 435 | sim_boolparam_console_visible =1 436 | sim_boolparam_collision_handling_enabled =2 437 | sim_boolparam_distance_handling_enabled =3 438 | sim_boolparam_ik_handling_enabled =4 439 | sim_boolparam_gcs_handling_enabled =5 440 | sim_boolparam_dynamics_handling_enabled =6 441 | sim_boolparam_joint_motion_handling_enabled =7 442 | sim_boolparam_path_motion_handling_enabled =8 443 | sim_boolparam_proximity_sensor_handling_enabled =9 444 | sim_boolparam_vision_sensor_handling_enabled =10 445 | sim_boolparam_mill_handling_enabled =11 446 | sim_boolparam_browser_visible =12 447 | sim_boolparam_scene_and_model_load_messages =13 448 | sim_reserved0 =14 449 | sim_boolparam_shape_textures_are_visible =15 450 | sim_boolparam_display_enabled =16 451 | sim_boolparam_infotext_visible =17 452 | sim_boolparam_statustext_open =18 453 | sim_boolparam_fog_enabled =19 454 | sim_boolparam_rml2_available =20 455 | sim_boolparam_rml4_available =21 456 | sim_boolparam_mirrors_enabled =22 457 | sim_boolparam_aux_clip_planes_enabled =23 458 | sim_boolparam_full_model_copy_from_api =24 459 | sim_boolparam_realtime_simulation =25 460 | sim_boolparam_force_show_wireless_emission =27 461 | sim_boolparam_force_show_wireless_reception =28 462 | sim_boolparam_video_recording_triggered =29 463 | sim_boolparam_threaded_rendering_enabled =32 464 | sim_boolparam_fullscreen =33 465 | sim_boolparam_headless =34 466 | sim_boolparam_hierarchy_toolbarbutton_enabled =35 467 | sim_boolparam_browser_toolbarbutton_enabled =36 468 | sim_boolparam_objectshift_toolbarbutton_enabled =37 469 | sim_boolparam_objectrotate_toolbarbutton_enabled=38 470 | sim_boolparam_force_calcstruct_all_visible =39 471 | sim_boolparam_force_calcstruct_all =40 472 | sim_boolparam_exit_request =41 473 | sim_boolparam_play_toolbarbutton_enabled =42 474 | sim_boolparam_pause_toolbarbutton_enabled =43 475 | sim_boolparam_stop_toolbarbutton_enabled =44 476 | sim_boolparam_waiting_for_trigger =45 477 | 478 | 479 | # Integer parameters 480 | sim_intparam_error_report_mode =0 # Check sim_api_errormessage_... constants above for valid values 481 | sim_intparam_program_version =1 # e.g Version 2.1.4 --> 20104. Can only be read 482 | sim_intparam_instance_count =2 # do not use anymore (always returns 1 since V-REP 2.5.11) 483 | sim_intparam_custom_cmd_start_id =3 # can only be read 484 | sim_intparam_compilation_version =4 # 0=evaluation version 1=full version 2=player version. Can only be read 485 | sim_intparam_current_page =5 486 | sim_intparam_flymode_camera_handle =6 # can only be read 487 | sim_intparam_dynamic_step_divider =7 # can only be read 488 | sim_intparam_dynamic_engine =8 # 0=Bullet 1=ODE. 2=Vortex. 489 | sim_intparam_server_port_start =9 # can only be read 490 | sim_intparam_server_port_range =10 # can only be read 491 | sim_intparam_visible_layers =11 492 | sim_intparam_infotext_style =12 493 | sim_intparam_settings =13 494 | sim_intparam_edit_mode_type =14 # can only be read 495 | sim_intparam_server_port_next =15 # is initialized at sim_intparam_server_port_start 496 | sim_intparam_qt_version =16 # version of the used Qt framework 497 | sim_intparam_event_flags_read =17 # can only be read 498 | sim_intparam_event_flags_read_clear =18 # can only be read 499 | sim_intparam_platform =19 # can only be read 500 | sim_intparam_scene_unique_id =20 # can only be read 501 | sim_intparam_work_thread_count =21 502 | sim_intparam_mouse_x =22 503 | sim_intparam_mouse_y =23 504 | sim_intparam_core_count =24 505 | sim_intparam_work_thread_calc_time_ms =25 506 | sim_intparam_idle_fps =26 507 | sim_intparam_prox_sensor_select_down =27 508 | sim_intparam_prox_sensor_select_up =28 509 | sim_intparam_stop_request_counter =29 510 | sim_intparam_program_revision =30 511 | sim_intparam_mouse_buttons =31 512 | sim_intparam_dynamic_warning_disabled_mask =32 513 | sim_intparam_simulation_warning_disabled_mask =33 514 | sim_intparam_scene_index =34 515 | sim_intparam_motionplanning_seed =35 516 | sim_intparam_speedmodifier =36 517 | 518 | # Float parameters 519 | sim_floatparam_rand=0 # random value (0.0-1.0) 520 | sim_floatparam_simulation_time_step =1 521 | sim_floatparam_stereo_distance =2 522 | 523 | # String parameters 524 | sim_stringparam_application_path=0 # path of V-REP's executable 525 | sim_stringparam_video_filename=1 526 | sim_stringparam_app_arg1 =2 527 | sim_stringparam_app_arg2 =3 528 | sim_stringparam_app_arg3 =4 529 | sim_stringparam_app_arg4 =5 530 | sim_stringparam_app_arg5 =6 531 | sim_stringparam_app_arg6 =7 532 | sim_stringparam_app_arg7 =8 533 | sim_stringparam_app_arg8 =9 534 | sim_stringparam_app_arg9 =10 535 | sim_stringparam_scene_path_and_name =13 536 | 537 | # Array parameters 538 | sim_arrayparam_gravity =0 539 | sim_arrayparam_fog =1 540 | sim_arrayparam_fog_color =2 541 | sim_arrayparam_background_color1=3 542 | sim_arrayparam_background_color2=4 543 | sim_arrayparam_ambient_light =5 544 | sim_arrayparam_random_euler =6 545 | 546 | sim_objintparam_visibility_layer= 10 547 | sim_objfloatparam_abs_x_velocity= 11 548 | sim_objfloatparam_abs_y_velocity= 12 549 | sim_objfloatparam_abs_z_velocity= 13 550 | sim_objfloatparam_abs_rot_velocity= 14 551 | sim_objfloatparam_objbbox_min_x= 15 552 | sim_objfloatparam_objbbox_min_y= 16 553 | sim_objfloatparam_objbbox_min_z= 17 554 | sim_objfloatparam_objbbox_max_x= 18 555 | sim_objfloatparam_objbbox_max_y= 19 556 | sim_objfloatparam_objbbox_max_z= 20 557 | sim_objfloatparam_modelbbox_min_x= 21 558 | sim_objfloatparam_modelbbox_min_y= 22 559 | sim_objfloatparam_modelbbox_min_z= 23 560 | sim_objfloatparam_modelbbox_max_x= 24 561 | sim_objfloatparam_modelbbox_max_y= 25 562 | sim_objfloatparam_modelbbox_max_z= 26 563 | sim_objintparam_collection_self_collision_indicator= 27 564 | sim_objfloatparam_transparency_offset= 28 565 | sim_objintparam_child_role= 29 566 | sim_objintparam_parent_role= 30 567 | sim_objintparam_manipulation_permissions= 31 568 | sim_objintparam_illumination_handle= 32 569 | 570 | sim_visionfloatparam_near_clipping= 1000 571 | sim_visionfloatparam_far_clipping= 1001 572 | sim_visionintparam_resolution_x= 1002 573 | sim_visionintparam_resolution_y= 1003 574 | sim_visionfloatparam_perspective_angle= 1004 575 | sim_visionfloatparam_ortho_size= 1005 576 | sim_visionintparam_disabled_light_components= 1006 577 | sim_visionintparam_rendering_attributes= 1007 578 | sim_visionintparam_entity_to_render= 1008 579 | sim_visionintparam_windowed_size_x= 1009 580 | sim_visionintparam_windowed_size_y= 1010 581 | sim_visionintparam_windowed_pos_x= 1011 582 | sim_visionintparam_windowed_pos_y= 1012 583 | sim_visionintparam_pov_focal_blur= 1013 584 | sim_visionfloatparam_pov_blur_distance= 1014 585 | sim_visionfloatparam_pov_aperture= 1015 586 | sim_visionintparam_pov_blur_sampled= 1016 587 | sim_visionintparam_render_mode= 1017 588 | 589 | sim_jointintparam_motor_enabled= 2000 590 | sim_jointintparam_ctrl_enabled= 2001 591 | sim_jointfloatparam_pid_p= 2002 592 | sim_jointfloatparam_pid_i= 2003 593 | sim_jointfloatparam_pid_d= 2004 594 | sim_jointfloatparam_intrinsic_x= 2005 595 | sim_jointfloatparam_intrinsic_y= 2006 596 | sim_jointfloatparam_intrinsic_z= 2007 597 | sim_jointfloatparam_intrinsic_qx= 2008 598 | sim_jointfloatparam_intrinsic_qy= 2009 599 | sim_jointfloatparam_intrinsic_qz= 2010 600 | sim_jointfloatparam_intrinsic_qw= 2011 601 | sim_jointfloatparam_velocity= 2012 602 | sim_jointfloatparam_spherical_qx= 2013 603 | sim_jointfloatparam_spherical_qy= 2014 604 | sim_jointfloatparam_spherical_qz= 2015 605 | sim_jointfloatparam_spherical_qw= 2016 606 | sim_jointfloatparam_upper_limit= 2017 607 | sim_jointfloatparam_kc_k= 2018 608 | sim_jointfloatparam_kc_c= 2019 609 | sim_jointfloatparam_ik_weight= 2021 610 | sim_jointfloatparam_error_x= 2022 611 | sim_jointfloatparam_error_y= 2023 612 | sim_jointfloatparam_error_z= 2024 613 | sim_jointfloatparam_error_a= 2025 614 | sim_jointfloatparam_error_b= 2026 615 | sim_jointfloatparam_error_g= 2027 616 | sim_jointfloatparam_error_pos= 2028 617 | sim_jointfloatparam_error_angle= 2029 618 | sim_jointintparam_velocity_lock= 2030 619 | sim_jointintparam_vortex_dep_handle= 2031 620 | sim_jointfloatparam_vortex_dep_multiplication= 2032 621 | sim_jointfloatparam_vortex_dep_offset= 2033 622 | 623 | sim_shapefloatparam_init_velocity_x= 3000 624 | sim_shapefloatparam_init_velocity_y= 3001 625 | sim_shapefloatparam_init_velocity_z= 3002 626 | sim_shapeintparam_static= 3003 627 | sim_shapeintparam_respondable= 3004 628 | sim_shapefloatparam_mass= 3005 629 | sim_shapefloatparam_texture_x= 3006 630 | sim_shapefloatparam_texture_y= 3007 631 | sim_shapefloatparam_texture_z= 3008 632 | sim_shapefloatparam_texture_a= 3009 633 | sim_shapefloatparam_texture_b= 3010 634 | sim_shapefloatparam_texture_g= 3011 635 | sim_shapefloatparam_texture_scaling_x= 3012 636 | sim_shapefloatparam_texture_scaling_y= 3013 637 | sim_shapeintparam_culling= 3014 638 | sim_shapeintparam_wireframe= 3015 639 | sim_shapeintparam_compound= 3016 640 | sim_shapeintparam_convex= 3017 641 | sim_shapeintparam_convex_check= 3018 642 | sim_shapeintparam_respondable_mask= 3019 643 | sim_shapefloatparam_init_velocity_a= 3020 644 | sim_shapefloatparam_init_velocity_b= 3021 645 | sim_shapefloatparam_init_velocity_g= 3022 646 | sim_shapestringparam_color_name= 3023 647 | sim_shapeintparam_edge_visibility= 3024 648 | sim_shapefloatparam_shading_angle= 3025 649 | sim_shapefloatparam_edge_angle= 3026 650 | sim_shapeintparam_edge_borders_hidden= 3027 651 | 652 | sim_proxintparam_ray_invisibility= 4000 653 | 654 | sim_forcefloatparam_error_x= 5000 655 | sim_forcefloatparam_error_y= 5001 656 | sim_forcefloatparam_error_z= 5002 657 | sim_forcefloatparam_error_a= 5003 658 | sim_forcefloatparam_error_b= 5004 659 | sim_forcefloatparam_error_g= 5005 660 | sim_forcefloatparam_error_pos= 5006 661 | sim_forcefloatparam_error_angle= 5007 662 | 663 | sim_lightintparam_pov_casts_shadows= 8000 664 | 665 | sim_cameraintparam_disabled_light_components= 9000 666 | sim_camerafloatparam_perspective_angle= 9001 667 | sim_camerafloatparam_ortho_size= 9002 668 | sim_cameraintparam_rendering_attributes= 9003 669 | sim_cameraintparam_pov_focal_blur= 9004 670 | sim_camerafloatparam_pov_blur_distance= 9005 671 | sim_camerafloatparam_pov_aperture= 9006 672 | sim_cameraintparam_pov_blur_samples= 9007 673 | 674 | sim_dummyintparam_link_type= 10000 675 | 676 | sim_mirrorfloatparam_width= 12000 677 | sim_mirrorfloatparam_height= 12001 678 | sim_mirrorfloatparam_reflectance= 12002 679 | sim_mirrorintparam_enable= 12003 680 | 681 | sim_pplanfloatparam_x_min= 20000 682 | sim_pplanfloatparam_x_range= 20001 683 | sim_pplanfloatparam_y_min= 20002 684 | sim_pplanfloatparam_y_range= 20003 685 | sim_pplanfloatparam_z_min= 20004 686 | sim_pplanfloatparam_z_range= 20005 687 | sim_pplanfloatparam_delta_min= 20006 688 | sim_pplanfloatparam_delta_range= 20007 689 | 690 | sim_mplanintparam_nodes_computed= 25000 691 | sim_mplanintparam_prepare_nodes= 25001 692 | sim_mplanintparam_clear_nodes= 25002 693 | 694 | # User interface elements 695 | sim_gui_menubar =0x0001 696 | sim_gui_popups =0x0002 697 | sim_gui_toolbar1 =0x0004 698 | sim_gui_toolbar2 =0x0008 699 | sim_gui_hierarchy =0x0010 700 | sim_gui_infobar =0x0020 701 | sim_gui_statusbar =0x0040 702 | sim_gui_scripteditor =0x0080 703 | sim_gui_scriptsimulationparameters =0x0100 704 | sim_gui_dialogs =0x0200 705 | sim_gui_browser =0x0400 706 | sim_gui_all =0xffff 707 | 708 | 709 | # Joint modes 710 | sim_jointmode_passive =0 711 | sim_jointmode_motion =1 712 | sim_jointmode_ik =2 713 | sim_jointmode_ikdependent =3 714 | sim_jointmode_dependent =4 715 | sim_jointmode_force =5 716 | 717 | 718 | # Navigation and selection modes with the mouse. Lower byte values are mutually exclusive upper byte bits can be combined 719 | sim_navigation_passive =0x0000 720 | sim_navigation_camerashift =0x0001 721 | sim_navigation_camerarotate =0x0002 722 | sim_navigation_camerazoom =0x0003 723 | sim_navigation_cameratilt =0x0004 724 | sim_navigation_cameraangle =0x0005 725 | sim_navigation_camerafly =0x0006 726 | sim_navigation_objectshift =0x0007 727 | sim_navigation_objectrotate =0x0008 728 | sim_navigation_reserved2 =0x0009 729 | sim_navigation_reserved3 =0x000A 730 | sim_navigation_jointpathtest =0x000B 731 | sim_navigation_ikmanip =0x000C 732 | sim_navigation_objectmultipleselection =0x000D 733 | # Bit-combine following values and add them to one of above's values for a valid navigation mode 734 | sim_navigation_reserved4 =0x0100 735 | sim_navigation_clickselection =0x0200 736 | sim_navigation_ctrlselection =0x0400 737 | sim_navigation_shiftselection =0x0800 738 | sim_navigation_camerazoomwheel =0x1000 739 | sim_navigation_camerarotaterightbutton =0x2000 740 | 741 | 742 | 743 | #Remote API constants 744 | SIMX_VERSION =0 745 | # Remote API message header structure 746 | SIMX_HEADER_SIZE =18 747 | simx_headeroffset_crc =0 # 1 simxUShort. Generated by the client or server. The CRC for the message 748 | simx_headeroffset_version =2 # 1 byte. Generated by the client or server. The version of the remote API software 749 | simx_headeroffset_message_id =3 # 1 simxInt. Generated by the client (and used in a reply by the server) 750 | simx_headeroffset_client_time =7 # 1 simxInt. Client time stamp generated by the client (and sent back by the server) 751 | simx_headeroffset_server_time =11 # 1 simxInt. Generated by the server when a reply is generated. The server timestamp 752 | simx_headeroffset_scene_id =15 # 1 simxUShort. Generated by the server. A unique ID identifying the scene currently displayed 753 | simx_headeroffset_server_state =17 # 1 byte. Generated by the server. Bit coded 0 set --> simulation not stopped 1 set --> simulation paused 2 set --> real-time switch on 3-5 edit mode type (0=no edit mode 1=triangle 2=vertex 3=edge 4=path 5=UI) 754 | 755 | # Remote API command header 756 | SIMX_SUBHEADER_SIZE =26 757 | simx_cmdheaderoffset_mem_size =0 # 1 simxInt. Generated by the client or server. The buffer size of the command. 758 | simx_cmdheaderoffset_full_mem_size =4 # 1 simxInt. Generated by the client or server. The full buffer size of the command (applies to split chunks). 759 | simx_cmdheaderoffset_pdata_offset0 =8 # 1 simxUShort. Generated by the client or server. The amount of data that is part of the command identification. 760 | simx_cmdheaderoffset_pdata_offset1 =10 # 1 simxInt. Generated by the client or server. The amount of shift of the pure data buffer (applies to split chunks). 761 | simx_cmdheaderoffset_cmd=14 # 1 simxInt. Generated by the client (and used in a reply by the server). The command combined with the operation mode of the command. 762 | simx_cmdheaderoffset_delay_or_split =18 # 1 simxUShort. Generated by the client or server. The amount of delay in ms of a continuous command or the max. pure data size to send at once (applies to split commands). 763 | simx_cmdheaderoffset_sim_time =20 # 1 simxInt. Generated by the server. The simulation time (in ms) when the command was executed (or 0 if simulation is not running) 764 | simx_cmdheaderoffset_status =24 # 1 byte. Generated by the server. (1 bit 0 is set --> error in function execution on server side). The client writes bit 1 if command cannot be overwritten 765 | simx_cmdheaderoffset_reserved =25 # 1 byte. Not yet used 766 | 767 | 768 | 769 | 770 | 771 | # Regular operation modes 772 | simx_opmode_oneshot =0x000000 # sends command as one chunk. Reply will also come as one chunk. Doesn't wait for the reply. 773 | simx_opmode_blocking =0x010000 # sends command as one chunk. Reply will also come as one chunk. Waits for the reply (_REPLY_WAIT_TIMEOUT_IN_MS is the timeout). 774 | simx_opmode_oneshot_wait =0x010000 # sends command as one chunk. Reply will also come as one chunk. Waits for the reply (_REPLY_WAIT_TIMEOUT_IN_MS is the timeout). 775 | simx_opmode_continuous =0x020000 776 | simx_opmode_streaming =0x020000 # sends command as one chunk. Command will be stored on the server and always executed 777 | #(every x ms (as far as possible) where x can be 0-65535. just add x to opmode_continuous). 778 | # A reply will be sent continuously each time as one chunk. Doesn't wait for the reply. 779 | 780 | # Operation modes for heavy data 781 | simx_opmode_oneshot_split =0x030000 # sends command as several chunks (max chunk size is x bytes where x can be _MIN_SPLIT_AMOUNT_IN_BYTES-65535. Just add x to opmode_oneshot_split). Reply will also come as several chunks. Doesn't wait for the reply. 782 | simx_opmode_continuous_split =0x040000 783 | simx_opmode_streaming_split =0x040000 # sends command as several chunks (max chunk size is x bytes where x can be _MIN_SPLIT_AMOUNT_IN_BYTES-65535. Just add x to opmode_continuous_split). Command will be stored on the server and always executed. A reply will be sent continuously each time as several chunks. Doesn't wait for the reply. 784 | 785 | # Special operation modes 786 | simx_opmode_discontinue =0x050000 # removes and cancels all commands stored on the client or server side (also continuous commands) 787 | simx_opmode_buffer =0x060000 # doesn't send anything but checks if a reply for the given command is available in the input buffer (i.e. previously received from the server) 788 | simx_opmode_remove =0x070000 # doesn't send anything and doesn't return any specific value. It just erases a similar command reply in the inbox (to free some memory) 789 | 790 | 791 | # Command return codes 792 | simx_return_ok =0x000000 793 | simx_return_novalue_flag =0x000001 # input buffer doesn't contain the specified command 794 | simx_return_timeout_flag =0x000002 # command reply not received in time for opmode_oneshot_wait operation mode 795 | simx_return_illegal_opmode_flag =0x000004 # command doesn't support the specified operation mode 796 | simx_return_remote_error_flag =0x000008 # command caused an error on the server side 797 | simx_return_split_progress_flag =0x000010 # previous similar command not yet fully processed (applies to opmode_oneshot_split operation modes) 798 | simx_return_local_error_flag =0x000020 # command caused an error on the client side 799 | simx_return_initialize_error_flag =0x000040 # simxStart was not yet called 800 | 801 | # Following for backward compatibility (same as above) 802 | simx_error_noerror =0x000000 803 | simx_error_novalue_flag =0x000001 # input buffer doesn't contain the specified command 804 | simx_error_timeout_flag =0x000002 # command reply not received in time for opmode_oneshot_wait operation mode 805 | simx_error_illegal_opmode_flag =0x000004 # command doesn't support the specified operation mode 806 | simx_error_remote_error_flag =0x000008 # command caused an error on the server side 807 | simx_error_split_progress_flag =0x000010 # previous similar command not yet fully processed (applies to opmode_oneshot_split operation modes) 808 | simx_error_local_error_flag =0x000020 # command caused an error on the client side 809 | simx_error_initialize_error_flag =0x000040 # simxStart was not yet called 810 | 811 | 812 | -------------------------------------------------------------------------------- /src/vrep/vrepConst.py: -------------------------------------------------------------------------------- 1 | # This file is part of the REMOTE API 2 | # 3 | # Copyright 2006-2017 Coppelia Robotics GmbH. All rights reserved. 4 | # marc@coppeliarobotics.com 5 | # www.coppeliarobotics.com 6 | # 7 | # The REMOTE API is licensed under the terms of GNU GPL: 8 | # 9 | # ------------------------------------------------------------------- 10 | # The REMOTE API is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # THE REMOTE API IS DISTRIBUTED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED 16 | # WARRANTY. THE USER WILL USE IT AT HIS/HER OWN RISK. THE ORIGINAL 17 | # AUTHORS AND COPPELIA ROBOTICS GMBH WILL NOT BE LIABLE FOR DATA LOSS, 18 | # DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR 19 | # MISUSING THIS SOFTWARE. 20 | # 21 | # See the GNU General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU General Public License 24 | # along with the REMOTE API. If not, see . 25 | # ------------------------------------------------------------------- 26 | # 27 | # This file was automatically created for V-REP release V3.4.0 rev. 1 on April 5th 2017 28 | 29 | #constants 30 | #Scene object types. Values are serialized 31 | sim_object_shape_type =0 32 | sim_object_joint_type =1 33 | sim_object_graph_type =2 34 | sim_object_camera_type =3 35 | sim_object_dummy_type =4 36 | sim_object_proximitysensor_type =5 37 | sim_object_reserved1 =6 38 | sim_object_reserved2 =7 39 | sim_object_path_type =8 40 | sim_object_visionsensor_type =9 41 | sim_object_volume_type =10 42 | sim_object_mill_type =11 43 | sim_object_forcesensor_type =12 44 | sim_object_light_type =13 45 | sim_object_mirror_type =14 46 | 47 | #General object types. Values are serialized 48 | sim_appobj_object_type =109 49 | sim_appobj_collision_type =110 50 | sim_appobj_distance_type =111 51 | sim_appobj_simulation_type =112 52 | sim_appobj_ik_type =113 53 | sim_appobj_constraintsolver_type=114 54 | sim_appobj_collection_type =115 55 | sim_appobj_ui_type =116 56 | sim_appobj_script_type =117 57 | sim_appobj_pathplanning_type =118 58 | sim_appobj_RESERVED_type =119 59 | sim_appobj_texture_type =120 60 | 61 | # Ik calculation methods. Values are serialized 62 | sim_ik_pseudo_inverse_method =0 63 | sim_ik_damped_least_squares_method =1 64 | sim_ik_jacobian_transpose_method =2 65 | 66 | # Ik constraints. Values are serialized 67 | sim_ik_x_constraint =1 68 | sim_ik_y_constraint =2 69 | sim_ik_z_constraint =4 70 | sim_ik_alpha_beta_constraint=8 71 | sim_ik_gamma_constraint =16 72 | sim_ik_avoidance_constraint =64 73 | 74 | # Ik calculation results 75 | sim_ikresult_not_performed =0 76 | sim_ikresult_success =1 77 | sim_ikresult_fail =2 78 | 79 | # Scene object sub-types. Values are serialized 80 | # Light sub-types 81 | sim_light_omnidirectional_subtype =1 82 | sim_light_spot_subtype =2 83 | sim_light_directional_subtype =3 84 | # Joint sub-types 85 | sim_joint_revolute_subtype =10 86 | sim_joint_prismatic_subtype =11 87 | sim_joint_spherical_subtype =12 88 | # Shape sub-types 89 | sim_shape_simpleshape_subtype =20 90 | sim_shape_multishape_subtype =21 91 | # Proximity sensor sub-types 92 | sim_proximitysensor_pyramid_subtype =30 93 | sim_proximitysensor_cylinder_subtype=31 94 | sim_proximitysensor_disc_subtype =32 95 | sim_proximitysensor_cone_subtype =33 96 | sim_proximitysensor_ray_subtype =34 97 | # Mill sub-types 98 | sim_mill_pyramid_subtype =40 99 | sim_mill_cylinder_subtype =41 100 | sim_mill_disc_subtype =42 101 | sim_mill_cone_subtype =42 102 | # No sub-type 103 | sim_object_no_subtype =200 104 | 105 | 106 | #Scene object main properties (serialized) 107 | sim_objectspecialproperty_collidable =0x0001 108 | sim_objectspecialproperty_measurable =0x0002 109 | #reserved =0x0004 110 | #reserved =0x0008 111 | sim_objectspecialproperty_detectable_ultrasonic =0x0010 112 | sim_objectspecialproperty_detectable_infrared =0x0020 113 | sim_objectspecialproperty_detectable_laser =0x0040 114 | sim_objectspecialproperty_detectable_inductive =0x0080 115 | sim_objectspecialproperty_detectable_capacitive =0x0100 116 | sim_objectspecialproperty_renderable =0x0200 117 | sim_objectspecialproperty_detectable_all =sim_objectspecialproperty_detectable_ultrasonic|sim_objectspecialproperty_detectable_infrared|sim_objectspecialproperty_detectable_laser|sim_objectspecialproperty_detectable_inductive|sim_objectspecialproperty_detectable_capacitive 118 | sim_objectspecialproperty_cuttable =0x0400 119 | sim_objectspecialproperty_pathplanning_ignored =0x0800 120 | 121 | # Model properties (serialized) 122 | sim_modelproperty_not_collidable =0x0001 123 | sim_modelproperty_not_measurable =0x0002 124 | sim_modelproperty_not_renderable =0x0004 125 | sim_modelproperty_not_detectable =0x0008 126 | sim_modelproperty_not_cuttable =0x0010 127 | sim_modelproperty_not_dynamic =0x0020 128 | sim_modelproperty_not_respondable =0x0040 # cannot be selected if sim_modelproperty_not_dynamic is not selected 129 | sim_modelproperty_not_reset =0x0080 # Model is not reset at simulation end. This flag is cleared at simulation end 130 | sim_modelproperty_not_visible =0x0100 # Whole model is invisible independent of local visibility settings 131 | sim_modelproperty_not_model =0xf000 # object is not a model 132 | 133 | 134 | # Check the documentation instead of comments below!! 135 | # Following messages are dispatched to the Lua-message container 136 | sim_message_ui_button_state_change =0 # a UI button slider etc. changed (due to a user's action). aux[0]=UI handle aux[1]=button handle aux[2]=button attributes aux[3]=slider position (if slider) 137 | sim_message_reserved9 =1 # Do not use 138 | sim_message_object_selection_changed=2 139 | sim_message_reserved10 =3 # do not use 140 | sim_message_model_loaded =4 141 | sim_message_reserved11 =5 # do not use 142 | sim_message_keypress =6 # a key was pressed while the focus was on a page (aux[0]=key aux[1]=ctrl and shift key state) 143 | sim_message_bannerclicked =7 # a banner was clicked (aux[0]=banner ID) 144 | 145 | 146 | # Following messages are dispatched only to the C-API (not available from Lua) 147 | sim_message_for_c_api_only_start =0x100 # Do not use 148 | sim_message_reserved1 =0x101 # Do not use 149 | sim_message_reserved2 =0x102 # Do not use 150 | sim_message_reserved3 =0x103 # Do not use 151 | sim_message_eventcallback_scenesave =0x104 # about to save a scene 152 | sim_message_eventcallback_modelsave =0x105 # about to save a model (current selection will be saved) 153 | sim_message_eventcallback_moduleopen =0x106 # called when simOpenModule in Lua is called 154 | sim_message_eventcallback_modulehandle =0x107 # called when simHandleModule in Lua is called with argument false 155 | sim_message_eventcallback_moduleclose =0x108 # called when simCloseModule in Lua is called 156 | sim_message_reserved4 =0x109 # Do not use 157 | sim_message_reserved5 =0x10a # Do not use 158 | sim_message_reserved6 =0x10b # Do not use 159 | sim_message_reserved7 =0x10c # Do not use 160 | sim_message_eventcallback_instancepass =0x10d # Called once every main application loop pass. auxiliaryData[0] contains event flags of events that happened since last time 161 | sim_message_eventcallback_broadcast =0x10e 162 | sim_message_eventcallback_imagefilter_enumreset =0x10f 163 | sim_message_eventcallback_imagefilter_enumerate =0x110 164 | sim_message_eventcallback_imagefilter_adjustparams =0x111 165 | sim_message_eventcallback_imagefilter_reserved =0x112 166 | sim_message_eventcallback_imagefilter_process =0x113 167 | sim_message_eventcallback_reserved1 =0x114 # do not use 168 | sim_message_eventcallback_reserved2 =0x115 # do not use 169 | sim_message_eventcallback_reserved3 =0x116 # do not use 170 | sim_message_eventcallback_reserved4 =0x117 # do not use 171 | sim_message_eventcallback_abouttoundo =0x118 # the undo button was hit and a previous state is about to be restored 172 | sim_message_eventcallback_undoperformed =0x119 # the undo button was hit and a previous state restored 173 | sim_message_eventcallback_abouttoredo =0x11a # the redo button was hit and a future state is about to be restored 174 | sim_message_eventcallback_redoperformed =0x11b # the redo button was hit and a future state restored 175 | sim_message_eventcallback_scripticondblclick =0x11c # scipt icon was double clicked. (aux[0]=object handle associated with script set replyData[0] to 1 if script should not be opened) 176 | sim_message_eventcallback_simulationabouttostart =0x11d 177 | sim_message_eventcallback_simulationended =0x11e 178 | sim_message_eventcallback_reserved5 =0x11f # do not use 179 | sim_message_eventcallback_keypress =0x120 # a key was pressed while the focus was on a page (aux[0]=key aux[1]=ctrl and shift key state) 180 | sim_message_eventcallback_modulehandleinsensingpart =0x121 # called when simHandleModule in Lua is called with argument true 181 | sim_message_eventcallback_renderingpass =0x122 # called just before the scene is rendered 182 | sim_message_eventcallback_bannerclicked =0x123 # called when a banner was clicked (aux[0]=banner ID) 183 | sim_message_eventcallback_menuitemselected =0x124 # auxiliaryData[0] indicates the handle of the item auxiliaryData[1] indicates the state of the item 184 | sim_message_eventcallback_refreshdialogs =0x125 # aux[0]=refresh degree (0=light 1=medium 2=full) 185 | sim_message_eventcallback_sceneloaded =0x126 186 | sim_message_eventcallback_modelloaded =0x127 187 | sim_message_eventcallback_instanceswitch =0x128 188 | sim_message_eventcallback_guipass =0x129 189 | sim_message_eventcallback_mainscriptabouttobecalled =0x12a 190 | sim_message_eventcallback_rmlposition =0x12b #the command simRMLPosition was called. The appropriate plugin should handle the call 191 | sim_message_eventcallback_rmlvelocity =0x12c # the command simRMLVelocity was called. The appropriate plugin should handle the call 192 | sim_message_simulation_start_resume_request =0x1000 193 | sim_message_simulation_pause_request =0x1001 194 | sim_message_simulation_stop_request =0x1002 195 | 196 | # Scene object properties. Combine with the | operator 197 | sim_objectproperty_reserved1 =0x0000 198 | sim_objectproperty_reserved2 =0x0001 199 | sim_objectproperty_reserved3 =0x0002 200 | sim_objectproperty_reserved4 =0x0003 201 | sim_objectproperty_reserved5 =0x0004 # formely sim_objectproperty_visible 202 | sim_objectproperty_reserved6 =0x0008 # formely sim_objectproperty_wireframe 203 | sim_objectproperty_collapsed =0x0010 204 | sim_objectproperty_selectable =0x0020 205 | sim_objectproperty_reserved7 =0x0040 206 | sim_objectproperty_selectmodelbaseinstead =0x0080 207 | sim_objectproperty_dontshowasinsidemodel =0x0100 208 | # reserved =0x0200 209 | sim_objectproperty_canupdatedna =0x0400 210 | sim_objectproperty_selectinvisible =0x0800 211 | sim_objectproperty_depthinvisible =0x1000 212 | 213 | 214 | # type of arguments (input and output) for custom lua commands 215 | sim_lua_arg_nil =0 216 | sim_lua_arg_bool =1 217 | sim_lua_arg_int =2 218 | sim_lua_arg_float =3 219 | sim_lua_arg_string =4 220 | sim_lua_arg_invalid =5 221 | sim_lua_arg_table =8 222 | 223 | # custom user interface properties. Values are serialized. 224 | sim_ui_property_visible =0x0001 225 | sim_ui_property_visibleduringsimulationonly =0x0002 226 | sim_ui_property_moveable =0x0004 227 | sim_ui_property_relativetoleftborder =0x0008 228 | sim_ui_property_relativetotopborder =0x0010 229 | sim_ui_property_fixedwidthfont =0x0020 230 | sim_ui_property_systemblock =0x0040 231 | sim_ui_property_settocenter =0x0080 232 | sim_ui_property_rolledup =0x0100 233 | sim_ui_property_selectassociatedobject =0x0200 234 | sim_ui_property_visiblewhenobjectselected =0x0400 235 | 236 | 237 | # button properties. Values are serialized. 238 | sim_buttonproperty_button =0x0000 239 | sim_buttonproperty_label =0x0001 240 | sim_buttonproperty_slider =0x0002 241 | sim_buttonproperty_editbox =0x0003 242 | sim_buttonproperty_staydown =0x0008 243 | sim_buttonproperty_enabled =0x0010 244 | sim_buttonproperty_borderless =0x0020 245 | sim_buttonproperty_horizontallycentered =0x0040 246 | sim_buttonproperty_ignoremouse =0x0080 247 | sim_buttonproperty_isdown =0x0100 248 | sim_buttonproperty_transparent =0x0200 249 | sim_buttonproperty_nobackgroundcolor =0x0400 250 | sim_buttonproperty_rollupaction =0x0800 251 | sim_buttonproperty_closeaction =0x1000 252 | sim_buttonproperty_verticallycentered =0x2000 253 | sim_buttonproperty_downupevent =0x4000 254 | 255 | 256 | # Simulation status 257 | sim_simulation_stopped =0x00 # Simulation is stopped 258 | sim_simulation_paused =0x08 # Simulation is paused 259 | sim_simulation_advancing =0x10 # Simulation is advancing 260 | sim_simulation_advancing_firstafterstop =sim_simulation_advancing|0x00 # First simulation pass (1x) 261 | sim_simulation_advancing_running =sim_simulation_advancing|0x01 # Normal simulation pass (>=1x) 262 | # reserved =sim_simulation_advancing|0x02 263 | sim_simulation_advancing_lastbeforepause =sim_simulation_advancing|0x03 # Last simulation pass before pause (1x) 264 | sim_simulation_advancing_firstafterpause =sim_simulation_advancing|0x04 # First simulation pass after pause (1x) 265 | sim_simulation_advancing_abouttostop =sim_simulation_advancing|0x05 # "Trying to stop" simulation pass (>=1x) 266 | sim_simulation_advancing_lastbeforestop =sim_simulation_advancing|0x06 # Last simulation pass (1x) 267 | 268 | 269 | # Script execution result (first return value) 270 | sim_script_no_error =0 271 | sim_script_main_script_nonexistent =1 272 | sim_script_main_script_not_called =2 273 | sim_script_reentrance_error =4 274 | sim_script_lua_error =8 275 | sim_script_call_error =16 276 | 277 | 278 | # Script types (serialized!) 279 | sim_scripttype_mainscript =0 280 | sim_scripttype_childscript =1 281 | sim_scripttype_jointctrlcallback =4 282 | sim_scripttype_contactcallback =5 283 | sim_scripttype_customizationscript =6 284 | sim_scripttype_generalcallback =7 285 | 286 | # API call error messages 287 | sim_api_errormessage_ignore =0 # does not memorize nor output errors 288 | sim_api_errormessage_report =1 # memorizes errors (default for C-API calls) 289 | sim_api_errormessage_output =2 # memorizes and outputs errors (default for Lua-API calls) 290 | 291 | 292 | # special argument of some functions 293 | sim_handle_all =-2 294 | sim_handle_all_except_explicit =-3 295 | sim_handle_self =-4 296 | sim_handle_main_script =-5 297 | sim_handle_tree =-6 298 | sim_handle_chain =-7 299 | sim_handle_single =-8 300 | sim_handle_default =-9 301 | sim_handle_all_except_self =-10 302 | sim_handle_parent =-11 303 | 304 | 305 | # special handle flags 306 | sim_handleflag_assembly =0x400000 307 | sim_handleflag_model =0x800000 308 | 309 | 310 | # distance calculation methods (serialized) 311 | sim_distcalcmethod_dl =0 312 | sim_distcalcmethod_dac =1 313 | sim_distcalcmethod_max_dl_dac =2 314 | sim_distcalcmethod_dl_and_dac =3 315 | sim_distcalcmethod_sqrt_dl2_and_dac2=4 316 | sim_distcalcmethod_dl_if_nonzero =5 317 | sim_distcalcmethod_dac_if_nonzero =6 318 | 319 | 320 | # Generic dialog styles 321 | sim_dlgstyle_message =0 322 | sim_dlgstyle_input =1 323 | sim_dlgstyle_ok =2 324 | sim_dlgstyle_ok_cancel =3 325 | sim_dlgstyle_yes_no =4 326 | sim_dlgstyle_dont_center =32# can be combined with one of above values. Only with this flag can the position of the related UI be set just after dialog creation 327 | 328 | # Generic dialog return values 329 | sim_dlgret_still_open =0 330 | sim_dlgret_ok =1 331 | sim_dlgret_cancel =2 332 | sim_dlgret_yes =3 333 | sim_dlgret_no =4 334 | 335 | 336 | # Path properties 337 | sim_pathproperty_show_line =0x0001 338 | sim_pathproperty_show_orientation =0x0002 339 | sim_pathproperty_closed_path =0x0004 340 | sim_pathproperty_automatic_orientation =0x0008 341 | sim_pathproperty_invert_velocity =0x0010 342 | sim_pathproperty_infinite_acceleration =0x0020 343 | sim_pathproperty_flat_path =0x0040 344 | sim_pathproperty_show_position =0x0080 345 | sim_pathproperty_auto_velocity_profile_translation =0x0100 346 | sim_pathproperty_auto_velocity_profile_rotation =0x0200 347 | sim_pathproperty_endpoints_at_zero =0x0400 348 | sim_pathproperty_keep_x_up =0x0800 349 | 350 | 351 | # drawing objects 352 | # following are mutually exclusive 353 | sim_drawing_points =0 # 3 values per point (point size in pixels) 354 | sim_drawing_lines =1 # 6 values per line (line size in pixels) 355 | sim_drawing_triangles =2 # 9 values per triangle 356 | sim_drawing_trianglepoints =3 # 6 values per point (3 for triangle position 3 for triangle normal vector) (triangle size in meters) 357 | sim_drawing_quadpoints =4 # 6 values per point (3 for quad position 3 for quad normal vector) (quad size in meters) 358 | sim_drawing_discpoints =5 # 6 values per point (3 for disc position 3 for disc normal vector) (disc size in meters) 359 | sim_drawing_cubepoints =6 # 6 values per point (3 for cube position 3 for cube normal vector) (cube size in meters) 360 | sim_drawing_spherepoints =7 # 3 values per point (sphere size in meters) 361 | 362 | # following can be or-combined 363 | sim_drawing_itemcolors =0x00020 # +3 values per item (each item has its own ambient color (rgb values)). 364 | # Mutually exclusive with sim_drawing_vertexcolors 365 | sim_drawing_vertexcolors =0x00040 # +3 values per vertex (each vertex has its own ambient color (rgb values). Only for sim_drawing_lines (+6) and for sim_drawing_triangles(+9)). Mutually exclusive with sim_drawing_itemcolors 366 | sim_drawing_itemsizes =0x00080 # +1 value per item (each item has its own size). Not for sim_drawing_triangles 367 | sim_drawing_backfaceculling =0x00100 # back faces are not displayed for all items 368 | sim_drawing_wireframe =0x00200 # all items displayed in wireframe 369 | sim_drawing_painttag =0x00400 # all items are tagged as paint (for additinal processing at a later stage) 370 | sim_drawing_followparentvisibility =0x00800 # if the object is associated with a scene object then it follows that visibility otherwise it is always visible 371 | sim_drawing_cyclic =0x01000 # if the max item count was reached then the first items are overwritten. 372 | sim_drawing_50percenttransparency =0x02000 # the drawing object will be 50% transparent 373 | sim_drawing_25percenttransparency =0x04000 # the drawing object will be 25% transparent 374 | sim_drawing_12percenttransparency =0x08000 # the drawing object will be 12.5% transparent 375 | sim_drawing_emissioncolor =0x10000 # When used in combination with sim_drawing_itemcolors or sim_drawing_vertexcolors then the specified colors will be for the emissive component 376 | sim_drawing_facingcamera =0x20000 # Only for trianglepoints quadpoints discpoints and cubepoints. If specified the normal verctor is calculated to face the camera (each item data requires 3 values less) 377 | sim_drawing_overlay =0x40000 # When specified objects are always drawn on top of "regular objects" 378 | sim_drawing_itemtransparency =0x80000 # +1 value per item (each item has its own transparency value (0-1)). Not compatible with sim_drawing_vertexcolors 379 | 380 | # banner values 381 | # following can be or-combined 382 | sim_banner_left =0x00001 # Banners display on the left of the specified point 383 | sim_banner_right =0x00002 # Banners display on the right of the specified point 384 | sim_banner_nobackground =0x00004 # Banners have no background rectangle 385 | sim_banner_overlay =0x00008 # When specified banners are always drawn on top of "regular objects" 386 | sim_banner_followparentvisibility =0x00010 # if the object is associated with a scene object then it follows that visibility otherwise it is always visible 387 | sim_banner_clickselectsparent =0x00020 # if the object is associated with a scene object then clicking the banner will select the scene object 388 | sim_banner_clicktriggersevent =0x00040 # if the banner is clicked an event is triggered (sim_message_eventcallback_bannerclicked and sim_message_bannerclicked are generated) 389 | sim_banner_facingcamera =0x00080 # If specified the banner will always face the camera by rotating around the banner's vertical axis (y-axis) 390 | sim_banner_fullyfacingcamera =0x00100 # If specified the banner will always fully face the camera (the banner's orientation is same as the camera looking at it) 391 | sim_banner_backfaceculling =0x00200 # If specified the banner will only be visible from one side 392 | sim_banner_keepsamesize =0x00400 # If specified the banner will always appear in the same size. In that case size represents the character height in pixels 393 | sim_banner_bitmapfont =0x00800 # If specified a fixed-size bitmap font is used. The text will also always fully face the camera and be right 394 | # to the specified position. Bitmap fonts are not clickable 395 | 396 | 397 | # particle objects following are mutually exclusive 398 | sim_particle_points1 =0 # 6 values per point (pt1 and pt2. Pt1 is start position pt2-pt1 is the initial velocity vector). i 399 | #Point is 1 pixel big. Only appearance is a point internally handled as a perfect sphere 400 | sim_particle_points2 =1 # 6 values per point. Point is 2 pixel big. Only appearance is a point internally handled as a perfect sphere 401 | sim_particle_points4 =2 # 6 values per point. Point is 4 pixel big. Only appearance is a point internally handled as a perfect sphere 402 | sim_particle_roughspheres =3 # 6 values per sphere. Only appearance is rough. Internally a perfect sphere 403 | sim_particle_spheres =4 # 6 values per sphere. Internally a perfect sphere 404 | 405 | 406 | 407 | 408 | # following can be or-combined 409 | sim_particle_respondable1to4 =0x0020 # the particles are respondable against shapes (against all objects that have at least one bit 1-4 activated in the global respondable mask) 410 | sim_particle_respondable5to8 =0x0040 # the particles are respondable against shapes (against all objects that have at least one bit 5-8 activated in the global respondable mask) 411 | sim_particle_particlerespondable =0x0080 # the particles are respondable against each other 412 | sim_particle_ignoresgravity =0x0100 # the particles ignore the effect of gravity. Not compatible with sim_particle_water 413 | sim_particle_invisible =0x0200 # the particles are invisible 414 | sim_particle_itemsizes =0x0400 # +1 value per particle (each particle can have a different size) 415 | sim_particle_itemdensities =0x0800 # +1 value per particle (each particle can have a different density) 416 | sim_particle_itemcolors =0x1000 # +3 values per particle (each particle can have a different color) 417 | sim_particle_cyclic =0x2000 # if the max item count was reached then the first items are overwritten. 418 | sim_particle_emissioncolor =0x4000 # When used in combination with sim_particle_itemcolors then the specified colors will be for the emissive component 419 | sim_particle_water =0x8000 # the particles are water particles (no weight in the water (i.e. when z<0)). Not compatible with sim_particle_ignoresgravity 420 | sim_particle_painttag =0x10000 # The particles can be seen by vision sensors (sim_particle_invisible must not be set) 421 | 422 | 423 | 424 | 425 | # custom user interface menu attributes 426 | sim_ui_menu_title =1 427 | sim_ui_menu_minimize =2 428 | sim_ui_menu_close =4 429 | sim_ui_menu_systemblock =8 430 | 431 | 432 | 433 | # Boolean parameters 434 | sim_boolparam_hierarchy_visible =0 435 | sim_boolparam_console_visible =1 436 | sim_boolparam_collision_handling_enabled =2 437 | sim_boolparam_distance_handling_enabled =3 438 | sim_boolparam_ik_handling_enabled =4 439 | sim_boolparam_gcs_handling_enabled =5 440 | sim_boolparam_dynamics_handling_enabled =6 441 | sim_boolparam_joint_motion_handling_enabled =7 442 | sim_boolparam_path_motion_handling_enabled =8 443 | sim_boolparam_proximity_sensor_handling_enabled =9 444 | sim_boolparam_vision_sensor_handling_enabled =10 445 | sim_boolparam_mill_handling_enabled =11 446 | sim_boolparam_browser_visible =12 447 | sim_boolparam_scene_and_model_load_messages =13 448 | sim_reserved0 =14 449 | sim_boolparam_shape_textures_are_visible =15 450 | sim_boolparam_display_enabled =16 451 | sim_boolparam_infotext_visible =17 452 | sim_boolparam_statustext_open =18 453 | sim_boolparam_fog_enabled =19 454 | sim_boolparam_rml2_available =20 455 | sim_boolparam_rml4_available =21 456 | sim_boolparam_mirrors_enabled =22 457 | sim_boolparam_aux_clip_planes_enabled =23 458 | sim_boolparam_full_model_copy_from_api =24 459 | sim_boolparam_realtime_simulation =25 460 | sim_boolparam_force_show_wireless_emission =27 461 | sim_boolparam_force_show_wireless_reception =28 462 | sim_boolparam_video_recording_triggered =29 463 | sim_boolparam_threaded_rendering_enabled =32 464 | sim_boolparam_fullscreen =33 465 | sim_boolparam_headless =34 466 | sim_boolparam_hierarchy_toolbarbutton_enabled =35 467 | sim_boolparam_browser_toolbarbutton_enabled =36 468 | sim_boolparam_objectshift_toolbarbutton_enabled =37 469 | sim_boolparam_objectrotate_toolbarbutton_enabled=38 470 | sim_boolparam_force_calcstruct_all_visible =39 471 | sim_boolparam_force_calcstruct_all =40 472 | sim_boolparam_exit_request =41 473 | sim_boolparam_play_toolbarbutton_enabled =42 474 | sim_boolparam_pause_toolbarbutton_enabled =43 475 | sim_boolparam_stop_toolbarbutton_enabled =44 476 | sim_boolparam_waiting_for_trigger =45 477 | 478 | 479 | # Integer parameters 480 | sim_intparam_error_report_mode =0 # Check sim_api_errormessage_... constants above for valid values 481 | sim_intparam_program_version =1 # e.g Version 2.1.4 --> 20104. Can only be read 482 | sim_intparam_instance_count =2 # do not use anymore (always returns 1 since V-REP 2.5.11) 483 | sim_intparam_custom_cmd_start_id =3 # can only be read 484 | sim_intparam_compilation_version =4 # 0=evaluation version 1=full version 2=player version. Can only be read 485 | sim_intparam_current_page =5 486 | sim_intparam_flymode_camera_handle =6 # can only be read 487 | sim_intparam_dynamic_step_divider =7 # can only be read 488 | sim_intparam_dynamic_engine =8 # 0=Bullet 1=ODE. 2=Vortex. 489 | sim_intparam_server_port_start =9 # can only be read 490 | sim_intparam_server_port_range =10 # can only be read 491 | sim_intparam_visible_layers =11 492 | sim_intparam_infotext_style =12 493 | sim_intparam_settings =13 494 | sim_intparam_edit_mode_type =14 # can only be read 495 | sim_intparam_server_port_next =15 # is initialized at sim_intparam_server_port_start 496 | sim_intparam_qt_version =16 # version of the used Qt framework 497 | sim_intparam_event_flags_read =17 # can only be read 498 | sim_intparam_event_flags_read_clear =18 # can only be read 499 | sim_intparam_platform =19 # can only be read 500 | sim_intparam_scene_unique_id =20 # can only be read 501 | sim_intparam_work_thread_count =21 502 | sim_intparam_mouse_x =22 503 | sim_intparam_mouse_y =23 504 | sim_intparam_core_count =24 505 | sim_intparam_work_thread_calc_time_ms =25 506 | sim_intparam_idle_fps =26 507 | sim_intparam_prox_sensor_select_down =27 508 | sim_intparam_prox_sensor_select_up =28 509 | sim_intparam_stop_request_counter =29 510 | sim_intparam_program_revision =30 511 | sim_intparam_mouse_buttons =31 512 | sim_intparam_dynamic_warning_disabled_mask =32 513 | sim_intparam_simulation_warning_disabled_mask =33 514 | sim_intparam_scene_index =34 515 | sim_intparam_motionplanning_seed =35 516 | sim_intparam_speedmodifier =36 517 | 518 | # Float parameters 519 | sim_floatparam_rand=0 # random value (0.0-1.0) 520 | sim_floatparam_simulation_time_step =1 521 | sim_floatparam_stereo_distance =2 522 | 523 | # String parameters 524 | sim_stringparam_application_path=0 # path of V-REP's executable 525 | sim_stringparam_video_filename=1 526 | sim_stringparam_app_arg1 =2 527 | sim_stringparam_app_arg2 =3 528 | sim_stringparam_app_arg3 =4 529 | sim_stringparam_app_arg4 =5 530 | sim_stringparam_app_arg5 =6 531 | sim_stringparam_app_arg6 =7 532 | sim_stringparam_app_arg7 =8 533 | sim_stringparam_app_arg8 =9 534 | sim_stringparam_app_arg9 =10 535 | sim_stringparam_scene_path_and_name =13 536 | 537 | # Array parameters 538 | sim_arrayparam_gravity =0 539 | sim_arrayparam_fog =1 540 | sim_arrayparam_fog_color =2 541 | sim_arrayparam_background_color1=3 542 | sim_arrayparam_background_color2=4 543 | sim_arrayparam_ambient_light =5 544 | sim_arrayparam_random_euler =6 545 | 546 | sim_objintparam_visibility_layer= 10 547 | sim_objfloatparam_abs_x_velocity= 11 548 | sim_objfloatparam_abs_y_velocity= 12 549 | sim_objfloatparam_abs_z_velocity= 13 550 | sim_objfloatparam_abs_rot_velocity= 14 551 | sim_objfloatparam_objbbox_min_x= 15 552 | sim_objfloatparam_objbbox_min_y= 16 553 | sim_objfloatparam_objbbox_min_z= 17 554 | sim_objfloatparam_objbbox_max_x= 18 555 | sim_objfloatparam_objbbox_max_y= 19 556 | sim_objfloatparam_objbbox_max_z= 20 557 | sim_objfloatparam_modelbbox_min_x= 21 558 | sim_objfloatparam_modelbbox_min_y= 22 559 | sim_objfloatparam_modelbbox_min_z= 23 560 | sim_objfloatparam_modelbbox_max_x= 24 561 | sim_objfloatparam_modelbbox_max_y= 25 562 | sim_objfloatparam_modelbbox_max_z= 26 563 | sim_objintparam_collection_self_collision_indicator= 27 564 | sim_objfloatparam_transparency_offset= 28 565 | sim_objintparam_child_role= 29 566 | sim_objintparam_parent_role= 30 567 | sim_objintparam_manipulation_permissions= 31 568 | sim_objintparam_illumination_handle= 32 569 | 570 | sim_visionfloatparam_near_clipping= 1000 571 | sim_visionfloatparam_far_clipping= 1001 572 | sim_visionintparam_resolution_x= 1002 573 | sim_visionintparam_resolution_y= 1003 574 | sim_visionfloatparam_perspective_angle= 1004 575 | sim_visionfloatparam_ortho_size= 1005 576 | sim_visionintparam_disabled_light_components= 1006 577 | sim_visionintparam_rendering_attributes= 1007 578 | sim_visionintparam_entity_to_render= 1008 579 | sim_visionintparam_windowed_size_x= 1009 580 | sim_visionintparam_windowed_size_y= 1010 581 | sim_visionintparam_windowed_pos_x= 1011 582 | sim_visionintparam_windowed_pos_y= 1012 583 | sim_visionintparam_pov_focal_blur= 1013 584 | sim_visionfloatparam_pov_blur_distance= 1014 585 | sim_visionfloatparam_pov_aperture= 1015 586 | sim_visionintparam_pov_blur_sampled= 1016 587 | sim_visionintparam_render_mode= 1017 588 | 589 | sim_jointintparam_motor_enabled= 2000 590 | sim_jointintparam_ctrl_enabled= 2001 591 | sim_jointfloatparam_pid_p= 2002 592 | sim_jointfloatparam_pid_i= 2003 593 | sim_jointfloatparam_pid_d= 2004 594 | sim_jointfloatparam_intrinsic_x= 2005 595 | sim_jointfloatparam_intrinsic_y= 2006 596 | sim_jointfloatparam_intrinsic_z= 2007 597 | sim_jointfloatparam_intrinsic_qx= 2008 598 | sim_jointfloatparam_intrinsic_qy= 2009 599 | sim_jointfloatparam_intrinsic_qz= 2010 600 | sim_jointfloatparam_intrinsic_qw= 2011 601 | sim_jointfloatparam_velocity= 2012 602 | sim_jointfloatparam_spherical_qx= 2013 603 | sim_jointfloatparam_spherical_qy= 2014 604 | sim_jointfloatparam_spherical_qz= 2015 605 | sim_jointfloatparam_spherical_qw= 2016 606 | sim_jointfloatparam_upper_limit= 2017 607 | sim_jointfloatparam_kc_k= 2018 608 | sim_jointfloatparam_kc_c= 2019 609 | sim_jointfloatparam_ik_weight= 2021 610 | sim_jointfloatparam_error_x= 2022 611 | sim_jointfloatparam_error_y= 2023 612 | sim_jointfloatparam_error_z= 2024 613 | sim_jointfloatparam_error_a= 2025 614 | sim_jointfloatparam_error_b= 2026 615 | sim_jointfloatparam_error_g= 2027 616 | sim_jointfloatparam_error_pos= 2028 617 | sim_jointfloatparam_error_angle= 2029 618 | sim_jointintparam_velocity_lock= 2030 619 | sim_jointintparam_vortex_dep_handle= 2031 620 | sim_jointfloatparam_vortex_dep_multiplication= 2032 621 | sim_jointfloatparam_vortex_dep_offset= 2033 622 | 623 | sim_shapefloatparam_init_velocity_x= 3000 624 | sim_shapefloatparam_init_velocity_y= 3001 625 | sim_shapefloatparam_init_velocity_z= 3002 626 | sim_shapeintparam_static= 3003 627 | sim_shapeintparam_respondable= 3004 628 | sim_shapefloatparam_mass= 3005 629 | sim_shapefloatparam_texture_x= 3006 630 | sim_shapefloatparam_texture_y= 3007 631 | sim_shapefloatparam_texture_z= 3008 632 | sim_shapefloatparam_texture_a= 3009 633 | sim_shapefloatparam_texture_b= 3010 634 | sim_shapefloatparam_texture_g= 3011 635 | sim_shapefloatparam_texture_scaling_x= 3012 636 | sim_shapefloatparam_texture_scaling_y= 3013 637 | sim_shapeintparam_culling= 3014 638 | sim_shapeintparam_wireframe= 3015 639 | sim_shapeintparam_compound= 3016 640 | sim_shapeintparam_convex= 3017 641 | sim_shapeintparam_convex_check= 3018 642 | sim_shapeintparam_respondable_mask= 3019 643 | sim_shapefloatparam_init_velocity_a= 3020 644 | sim_shapefloatparam_init_velocity_b= 3021 645 | sim_shapefloatparam_init_velocity_g= 3022 646 | sim_shapestringparam_color_name= 3023 647 | sim_shapeintparam_edge_visibility= 3024 648 | sim_shapefloatparam_shading_angle= 3025 649 | sim_shapefloatparam_edge_angle= 3026 650 | sim_shapeintparam_edge_borders_hidden= 3027 651 | 652 | sim_proxintparam_ray_invisibility= 4000 653 | 654 | sim_forcefloatparam_error_x= 5000 655 | sim_forcefloatparam_error_y= 5001 656 | sim_forcefloatparam_error_z= 5002 657 | sim_forcefloatparam_error_a= 5003 658 | sim_forcefloatparam_error_b= 5004 659 | sim_forcefloatparam_error_g= 5005 660 | sim_forcefloatparam_error_pos= 5006 661 | sim_forcefloatparam_error_angle= 5007 662 | 663 | sim_lightintparam_pov_casts_shadows= 8000 664 | 665 | sim_cameraintparam_disabled_light_components= 9000 666 | sim_camerafloatparam_perspective_angle= 9001 667 | sim_camerafloatparam_ortho_size= 9002 668 | sim_cameraintparam_rendering_attributes= 9003 669 | sim_cameraintparam_pov_focal_blur= 9004 670 | sim_camerafloatparam_pov_blur_distance= 9005 671 | sim_camerafloatparam_pov_aperture= 9006 672 | sim_cameraintparam_pov_blur_samples= 9007 673 | 674 | sim_dummyintparam_link_type= 10000 675 | 676 | sim_mirrorfloatparam_width= 12000 677 | sim_mirrorfloatparam_height= 12001 678 | sim_mirrorfloatparam_reflectance= 12002 679 | sim_mirrorintparam_enable= 12003 680 | 681 | sim_pplanfloatparam_x_min= 20000 682 | sim_pplanfloatparam_x_range= 20001 683 | sim_pplanfloatparam_y_min= 20002 684 | sim_pplanfloatparam_y_range= 20003 685 | sim_pplanfloatparam_z_min= 20004 686 | sim_pplanfloatparam_z_range= 20005 687 | sim_pplanfloatparam_delta_min= 20006 688 | sim_pplanfloatparam_delta_range= 20007 689 | 690 | sim_mplanintparam_nodes_computed= 25000 691 | sim_mplanintparam_prepare_nodes= 25001 692 | sim_mplanintparam_clear_nodes= 25002 693 | 694 | # User interface elements 695 | sim_gui_menubar =0x0001 696 | sim_gui_popups =0x0002 697 | sim_gui_toolbar1 =0x0004 698 | sim_gui_toolbar2 =0x0008 699 | sim_gui_hierarchy =0x0010 700 | sim_gui_infobar =0x0020 701 | sim_gui_statusbar =0x0040 702 | sim_gui_scripteditor =0x0080 703 | sim_gui_scriptsimulationparameters =0x0100 704 | sim_gui_dialogs =0x0200 705 | sim_gui_browser =0x0400 706 | sim_gui_all =0xffff 707 | 708 | 709 | # Joint modes 710 | sim_jointmode_passive =0 711 | sim_jointmode_motion =1 712 | sim_jointmode_ik =2 713 | sim_jointmode_ikdependent =3 714 | sim_jointmode_dependent =4 715 | sim_jointmode_force =5 716 | 717 | 718 | # Navigation and selection modes with the mouse. Lower byte values are mutually exclusive upper byte bits can be combined 719 | sim_navigation_passive =0x0000 720 | sim_navigation_camerashift =0x0001 721 | sim_navigation_camerarotate =0x0002 722 | sim_navigation_camerazoom =0x0003 723 | sim_navigation_cameratilt =0x0004 724 | sim_navigation_cameraangle =0x0005 725 | sim_navigation_camerafly =0x0006 726 | sim_navigation_objectshift =0x0007 727 | sim_navigation_objectrotate =0x0008 728 | sim_navigation_reserved2 =0x0009 729 | sim_navigation_reserved3 =0x000A 730 | sim_navigation_jointpathtest =0x000B 731 | sim_navigation_ikmanip =0x000C 732 | sim_navigation_objectmultipleselection =0x000D 733 | # Bit-combine following values and add them to one of above's values for a valid navigation mode 734 | sim_navigation_reserved4 =0x0100 735 | sim_navigation_clickselection =0x0200 736 | sim_navigation_ctrlselection =0x0400 737 | sim_navigation_shiftselection =0x0800 738 | sim_navigation_camerazoomwheel =0x1000 739 | sim_navigation_camerarotaterightbutton =0x2000 740 | 741 | 742 | 743 | #Remote API constants 744 | SIMX_VERSION =0 745 | # Remote API message header structure 746 | SIMX_HEADER_SIZE =18 747 | simx_headeroffset_crc =0 # 1 simxUShort. Generated by the client or server. The CRC for the message 748 | simx_headeroffset_version =2 # 1 byte. Generated by the client or server. The version of the remote API software 749 | simx_headeroffset_message_id =3 # 1 simxInt. Generated by the client (and used in a reply by the server) 750 | simx_headeroffset_client_time =7 # 1 simxInt. Client time stamp generated by the client (and sent back by the server) 751 | simx_headeroffset_server_time =11 # 1 simxInt. Generated by the server when a reply is generated. The server timestamp 752 | simx_headeroffset_scene_id =15 # 1 simxUShort. Generated by the server. A unique ID identifying the scene currently displayed 753 | simx_headeroffset_server_state =17 # 1 byte. Generated by the server. Bit coded 0 set --> simulation not stopped 1 set --> simulation paused 2 set --> real-time switch on 3-5 edit mode type (0=no edit mode 1=triangle 2=vertex 3=edge 4=path 5=UI) 754 | 755 | # Remote API command header 756 | SIMX_SUBHEADER_SIZE =26 757 | simx_cmdheaderoffset_mem_size =0 # 1 simxInt. Generated by the client or server. The buffer size of the command. 758 | simx_cmdheaderoffset_full_mem_size =4 # 1 simxInt. Generated by the client or server. The full buffer size of the command (applies to split chunks). 759 | simx_cmdheaderoffset_pdata_offset0 =8 # 1 simxUShort. Generated by the client or server. The amount of data that is part of the command identification. 760 | simx_cmdheaderoffset_pdata_offset1 =10 # 1 simxInt. Generated by the client or server. The amount of shift of the pure data buffer (applies to split chunks). 761 | simx_cmdheaderoffset_cmd=14 # 1 simxInt. Generated by the client (and used in a reply by the server). The command combined with the operation mode of the command. 762 | simx_cmdheaderoffset_delay_or_split =18 # 1 simxUShort. Generated by the client or server. The amount of delay in ms of a continuous command or the max. pure data size to send at once (applies to split commands). 763 | simx_cmdheaderoffset_sim_time =20 # 1 simxInt. Generated by the server. The simulation time (in ms) when the command was executed (or 0 if simulation is not running) 764 | simx_cmdheaderoffset_status =24 # 1 byte. Generated by the server. (1 bit 0 is set --> error in function execution on server side). The client writes bit 1 if command cannot be overwritten 765 | simx_cmdheaderoffset_reserved =25 # 1 byte. Not yet used 766 | 767 | 768 | 769 | 770 | 771 | # Regular operation modes 772 | simx_opmode_oneshot =0x000000 # sends command as one chunk. Reply will also come as one chunk. Doesn't wait for the reply. 773 | simx_opmode_blocking =0x010000 # sends command as one chunk. Reply will also come as one chunk. Waits for the reply (_REPLY_WAIT_TIMEOUT_IN_MS is the timeout). 774 | simx_opmode_oneshot_wait =0x010000 # sends command as one chunk. Reply will also come as one chunk. Waits for the reply (_REPLY_WAIT_TIMEOUT_IN_MS is the timeout). 775 | simx_opmode_continuous =0x020000 776 | simx_opmode_streaming =0x020000 # sends command as one chunk. Command will be stored on the server and always executed 777 | #(every x ms (as far as possible) where x can be 0-65535. just add x to opmode_continuous). 778 | # A reply will be sent continuously each time as one chunk. Doesn't wait for the reply. 779 | 780 | # Operation modes for heavy data 781 | simx_opmode_oneshot_split =0x030000 # sends command as several chunks (max chunk size is x bytes where x can be _MIN_SPLIT_AMOUNT_IN_BYTES-65535. Just add x to opmode_oneshot_split). Reply will also come as several chunks. Doesn't wait for the reply. 782 | simx_opmode_continuous_split =0x040000 783 | simx_opmode_streaming_split =0x040000 # sends command as several chunks (max chunk size is x bytes where x can be _MIN_SPLIT_AMOUNT_IN_BYTES-65535. Just add x to opmode_continuous_split). Command will be stored on the server and always executed. A reply will be sent continuously each time as several chunks. Doesn't wait for the reply. 784 | 785 | # Special operation modes 786 | simx_opmode_discontinue =0x050000 # removes and cancels all commands stored on the client or server side (also continuous commands) 787 | simx_opmode_buffer =0x060000 # doesn't send anything but checks if a reply for the given command is available in the input buffer (i.e. previously received from the server) 788 | simx_opmode_remove =0x070000 # doesn't send anything and doesn't return any specific value. It just erases a similar command reply in the inbox (to free some memory) 789 | 790 | 791 | # Command return codes 792 | simx_return_ok =0x000000 793 | simx_return_novalue_flag =0x000001 # input buffer doesn't contain the specified command 794 | simx_return_timeout_flag =0x000002 # command reply not received in time for opmode_oneshot_wait operation mode 795 | simx_return_illegal_opmode_flag =0x000004 # command doesn't support the specified operation mode 796 | simx_return_remote_error_flag =0x000008 # command caused an error on the server side 797 | simx_return_split_progress_flag =0x000010 # previous similar command not yet fully processed (applies to opmode_oneshot_split operation modes) 798 | simx_return_local_error_flag =0x000020 # command caused an error on the client side 799 | simx_return_initialize_error_flag =0x000040 # simxStart was not yet called 800 | 801 | # Following for backward compatibility (same as above) 802 | simx_error_noerror =0x000000 803 | simx_error_novalue_flag =0x000001 # input buffer doesn't contain the specified command 804 | simx_error_timeout_flag =0x000002 # command reply not received in time for opmode_oneshot_wait operation mode 805 | simx_error_illegal_opmode_flag =0x000004 # command doesn't support the specified operation mode 806 | simx_error_remote_error_flag =0x000008 # command caused an error on the server side 807 | simx_error_split_progress_flag =0x000010 # previous similar command not yet fully processed (applies to opmode_oneshot_split operation modes) 808 | simx_error_local_error_flag =0x000020 # command caused an error on the client side 809 | simx_error_initialize_error_flag =0x000040 # simxStart was not yet called 810 | 811 | 812 | -------------------------------------------------------------------------------- /src/ir/vrep.py: -------------------------------------------------------------------------------- 1 | # This file is part of the REMOTE API 2 | # 3 | # Copyright 2006-2017 Coppelia Robotics GmbH. All rights reserved. 4 | # marc@coppeliarobotics.com 5 | # www.coppeliarobotics.com 6 | # 7 | # The REMOTE API is licensed under the terms of GNU GPL: 8 | # 9 | # ------------------------------------------------------------------- 10 | # The REMOTE API is free software: you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # THE REMOTE API IS DISTRIBUTED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED 16 | # WARRANTY. THE USER WILL USE IT AT HIS/HER OWN RISK. THE ORIGINAL 17 | # AUTHORS AND COPPELIA ROBOTICS GMBH WILL NOT BE LIABLE FOR DATA LOSS, 18 | # DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR 19 | # MISUSING THIS SOFTWARE. 20 | # 21 | # See the GNU General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU General Public License 24 | # along with the REMOTE API. If not, see . 25 | # ------------------------------------------------------------------- 26 | # 27 | # This file was automatically created for V-REP release V3.4.0 rev. 1 on April 5th 2017 28 | 29 | import platform 30 | import struct 31 | import sys 32 | import os 33 | import ctypes as ct 34 | from vrepConst import * 35 | 36 | #load library 37 | libsimx = None 38 | try: 39 | file_extension = '.so' 40 | if platform.system() =='cli': 41 | file_extension = '.dll' 42 | elif platform.system() =='Windows': 43 | file_extension = '.dll' 44 | elif platform.system() == 'Darwin': 45 | file_extension = '.dylib' 46 | else: 47 | file_extension = '.so' 48 | libfullpath = os.path.join(os.path.dirname(__file__), 'remoteApi' + file_extension) 49 | libsimx = ct.CDLL(libfullpath) 50 | except: 51 | print ('----------------------------------------------------') 52 | print ('The remoteApi library could not be loaded. Make sure') 53 | print ('it is located in the same folder as "vrep.py", or') 54 | print ('appropriately adjust the file "vrep.py"') 55 | print ('----------------------------------------------------') 56 | print ('') 57 | 58 | #ctypes wrapper prototypes 59 | c_GetJointPosition = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetJointPosition", libsimx)) 60 | c_SetJointPosition = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_float, ct.c_int32)(("simxSetJointPosition", libsimx)) 61 | c_GetJointMatrix = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetJointMatrix", libsimx)) 62 | c_SetSphericalJointMatrix = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxSetSphericalJointMatrix", libsimx)) 63 | c_SetJointTargetVelocity = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_float, ct.c_int32)(("simxSetJointTargetVelocity", libsimx)) 64 | c_SetJointTargetPosition = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_float, ct.c_int32)(("simxSetJointTargetPosition", libsimx)) 65 | c_GetJointForce = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetJointForce", libsimx)) 66 | c_SetJointForce = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_float, ct.c_int32)(("simxSetJointForce", libsimx)) 67 | c_ReadForceSensor = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_ubyte), ct.POINTER(ct.c_float), ct.POINTER(ct.c_float), ct.c_int32)(("simxReadForceSensor", libsimx)) 68 | c_BreakForceSensor = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32)(("simxBreakForceSensor", libsimx)) 69 | c_ReadVisionSensor = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_ubyte), ct.POINTER(ct.POINTER(ct.c_float)), ct.POINTER(ct.POINTER(ct.c_int32)), ct.c_int32)(("simxReadVisionSensor", libsimx)) 70 | c_GetObjectHandle = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetObjectHandle", libsimx)) 71 | c_GetVisionSensorImage = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_byte)), ct.c_ubyte, ct.c_int32)(("simxGetVisionSensorImage", libsimx)) 72 | c_SetVisionSensorImage = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_byte), ct.c_int32, ct.c_ubyte, ct.c_int32)(("simxSetVisionSensorImage", libsimx)) 73 | c_GetVisionSensorDepthBuffer= ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_float)), ct.c_int32)(("simxGetVisionSensorDepthBuffer", libsimx)) 74 | c_GetObjectChild = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetObjectChild", libsimx)) 75 | c_GetObjectParent = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetObjectParent", libsimx)) 76 | c_ReadProximitySensor = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_ubyte), ct.POINTER(ct.c_float), ct.POINTER(ct.c_int32), ct.POINTER(ct.c_float), ct.c_int32)(("simxReadProximitySensor", libsimx)) 77 | c_LoadModel = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_ubyte, ct.POINTER(ct.c_int32), ct.c_int32)(("simxLoadModel", libsimx)) 78 | c_LoadUI = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_ubyte, ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_int32)), ct.c_int32)(("simxLoadUI", libsimx)) 79 | c_LoadScene = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_ubyte, ct.c_int32)(("simxLoadScene", libsimx)) 80 | c_StartSimulation = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32)(("simxStartSimulation", libsimx)) 81 | c_PauseSimulation = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32)(("simxPauseSimulation", libsimx)) 82 | c_StopSimulation = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32)(("simxStopSimulation", libsimx)) 83 | c_GetUIHandle = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetUIHandle", libsimx)) 84 | c_GetUISlider = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetUISlider", libsimx)) 85 | c_SetUISlider = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32)(("simxSetUISlider", libsimx)) 86 | c_GetUIEventButton = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetUIEventButton", libsimx)) 87 | c_GetUIButtonProperty = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetUIButtonProperty", libsimx)) 88 | c_SetUIButtonProperty = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32)(("simxSetUIButtonProperty", libsimx)) 89 | c_AddStatusbarMessage = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32)(("simxAddStatusbarMessage", libsimx)) 90 | c_AuxiliaryConsoleOpen = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.POINTER(ct.c_int32), ct.POINTER(ct.c_float), ct.POINTER(ct.c_float), ct.POINTER(ct.c_int32), ct.c_int32)(("simxAuxiliaryConsoleOpen", libsimx)) 91 | c_AuxiliaryConsoleClose = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32)(("simxAuxiliaryConsoleClose", libsimx)) 92 | c_AuxiliaryConsolePrint = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32)(("simxAuxiliaryConsolePrint", libsimx)) 93 | c_AuxiliaryConsoleShow = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_ubyte, ct.c_int32)(("simxAuxiliaryConsoleShow", libsimx)) 94 | c_GetObjectOrientation = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetObjectOrientation", libsimx)) 95 | c_GetObjectPosition = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetObjectPosition", libsimx)) 96 | c_SetObjectOrientation = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxSetObjectOrientation", libsimx)) 97 | c_SetObjectPosition = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxSetObjectPosition", libsimx)) 98 | c_SetObjectParent = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.c_ubyte, ct.c_int32)(("simxSetObjectParent", libsimx)) 99 | c_SetUIButtonLabel = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_char), ct.c_int32)(("simxSetUIButtonLabel", libsimx)) 100 | c_GetLastErrors = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_char)), ct.c_int32)(("simxGetLastErrors", libsimx)) 101 | c_GetArrayParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetArrayParameter", libsimx)) 102 | c_SetArrayParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxSetArrayParameter", libsimx)) 103 | c_GetBooleanParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_ubyte), ct.c_int32)(("simxGetBooleanParameter", libsimx)) 104 | c_SetBooleanParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_ubyte, ct.c_int32)(("simxSetBooleanParameter", libsimx)) 105 | c_GetIntegerParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetIntegerParameter", libsimx)) 106 | c_SetIntegerParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32)(("simxSetIntegerParameter", libsimx)) 107 | c_GetFloatingParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetFloatingParameter", libsimx)) 108 | c_SetFloatingParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_float, ct.c_int32)(("simxSetFloatingParameter", libsimx)) 109 | c_GetStringParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.POINTER(ct.c_char)), ct.c_int32)(("simxGetStringParameter", libsimx)) 110 | c_GetCollisionHandle = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetCollisionHandle", libsimx)) 111 | c_GetDistanceHandle = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetDistanceHandle", libsimx)) 112 | c_GetCollectionHandle = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetCollectionHandle", libsimx)) 113 | c_ReadCollision = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_ubyte), ct.c_int32)(("simxReadCollision", libsimx)) 114 | c_ReadDistance = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxReadDistance", libsimx)) 115 | c_RemoveObject = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32)(("simxRemoveObject", libsimx)) 116 | c_RemoveModel = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32)(("simxRemoveModel", libsimx)) 117 | c_RemoveUI = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32)(("simxRemoveUI", libsimx)) 118 | c_CloseScene = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32)(("simxCloseScene", libsimx)) 119 | c_GetObjects = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_int32)), ct.c_int32)(("simxGetObjects", libsimx)) 120 | c_DisplayDialog = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_char), ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_float), ct.POINTER(ct.c_float), ct.POINTER(ct.c_int32), ct.POINTER(ct.c_int32), ct.c_int32)(("simxDisplayDialog", libsimx)) 121 | c_EndDialog = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32)(("simxEndDialog", libsimx)) 122 | c_GetDialogInput = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.POINTER(ct.c_char)), ct.c_int32)(("simxGetDialogInput", libsimx)) 123 | c_GetDialogResult = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetDialogResult", libsimx)) 124 | c_CopyPasteObjects = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32, ct.POINTER(ct.POINTER(ct.c_int32)), ct.POINTER(ct.c_int32), ct.c_int32)(("simxCopyPasteObjects", libsimx)) 125 | c_GetObjectSelection = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.POINTER(ct.c_int32)), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetObjectSelection", libsimx)) 126 | c_SetObjectSelection = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32, ct.c_int32)(("simxSetObjectSelection", libsimx)) 127 | c_ClearFloatSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32)(("simxClearFloatSignal", libsimx)) 128 | c_ClearIntegerSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32)(("simxClearIntegerSignal", libsimx)) 129 | c_ClearStringSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32)(("simxClearStringSignal", libsimx)) 130 | c_GetFloatSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_float), ct.c_int32)(("simxGetFloatSignal", libsimx)) 131 | c_GetIntegerSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetIntegerSignal", libsimx)) 132 | c_GetStringSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.POINTER(ct.c_ubyte)), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetStringSignal", libsimx)) 133 | c_SetFloatSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_float, ct.c_int32)(("simxSetFloatSignal", libsimx)) 134 | c_SetIntegerSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32, ct.c_int32)(("simxSetIntegerSignal", libsimx)) 135 | c_SetStringSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_ubyte), ct.c_int32, ct.c_int32)(("simxSetStringSignal", libsimx)) 136 | c_AppendStringSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_ubyte), ct.c_int32, ct.c_int32)(("simxAppendStringSignal", libsimx)) 137 | c_WriteStringStream = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_ubyte), ct.c_int32, ct.c_int32)(("simxWriteStringStream", libsimx)) 138 | c_GetObjectFloatParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.c_int32)(("simxGetObjectFloatParameter", libsimx)) 139 | c_SetObjectFloatParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.c_float, ct.c_int32)(("simxSetObjectFloatParameter", libsimx)) 140 | c_GetObjectIntParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetObjectIntParameter", libsimx)) 141 | c_SetObjectIntParameter = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32)(("simxSetObjectIntParameter", libsimx)) 142 | c_GetModelProperty = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetModelProperty", libsimx)) 143 | c_SetModelProperty = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.c_int32)(("simxSetModelProperty", libsimx)) 144 | c_Start = ct.CFUNCTYPE(ct.c_int32,ct.POINTER(ct.c_char), ct.c_int32, ct.c_ubyte, ct.c_ubyte, ct.c_int32, ct.c_int32)(("simxStart", libsimx)) 145 | c_Finish = ct.CFUNCTYPE(None, ct.c_int32)(("simxFinish", libsimx)) 146 | c_GetPingTime = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_int32))(("simxGetPingTime", libsimx)) 147 | c_GetLastCmdTime = ct.CFUNCTYPE(ct.c_int32,ct.c_int32)(("simxGetLastCmdTime", libsimx)) 148 | c_SynchronousTrigger = ct.CFUNCTYPE(ct.c_int32,ct.c_int32)(("simxSynchronousTrigger", libsimx)) 149 | c_Synchronous = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_ubyte)(("simxSynchronous", libsimx)) 150 | c_PauseCommunication = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_ubyte)(("simxPauseCommunication", libsimx)) 151 | c_GetInMessageInfo = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32))(("simxGetInMessageInfo", libsimx)) 152 | c_GetOutMessageInfo = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32))(("simxGetOutMessageInfo", libsimx)) 153 | c_GetConnectionId = ct.CFUNCTYPE(ct.c_int32,ct.c_int32)(("simxGetConnectionId", libsimx)) 154 | c_CreateBuffer = ct.CFUNCTYPE(ct.POINTER(ct.c_ubyte), ct.c_int32)(("simxCreateBuffer", libsimx)) 155 | c_ReleaseBuffer = ct.CFUNCTYPE(None, ct.c_void_p)(("simxReleaseBuffer", libsimx)) 156 | c_TransferFile = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_char), ct.c_int32, ct.c_int32)(("simxTransferFile", libsimx)) 157 | c_EraseFile = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.c_int32)(("simxEraseFile", libsimx)) 158 | c_GetAndClearStringSignal = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.POINTER(ct.c_ubyte)), ct.POINTER(ct.c_int32), ct.c_int32)(("simxGetAndClearStringSignal", libsimx)) 159 | c_ReadStringStream = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.POINTER(ct.c_ubyte)), ct.POINTER(ct.c_int32), ct.c_int32)(("simxReadStringStream", libsimx)) 160 | c_CreateDummy = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_float, ct.POINTER(ct.c_ubyte), ct.POINTER(ct.c_int32), ct.c_int32)(("simxCreateDummy", libsimx)) 161 | c_Query = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.c_ubyte), ct.c_int32, ct.POINTER(ct.c_char), ct.POINTER(ct.POINTER(ct.c_ubyte)), ct.POINTER(ct.c_int32), ct.c_int32)(("simxQuery", libsimx)) 162 | c_GetObjectGroupData = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.c_int32, ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_int32)), ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_int32)), ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_float)), ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_char)), ct.c_int32)(("simxGetObjectGroupData", libsimx)) 163 | c_GetObjectVelocity = ct.CFUNCTYPE(ct.c_int32,ct.c_int32, ct.c_int32, ct.POINTER(ct.c_float), ct.POINTER(ct.c_float), ct.c_int32)(("simxGetObjectVelocity", libsimx)) 164 | c_CallScriptFunction = ct.CFUNCTYPE(ct.c_int32,ct.c_int32,ct.POINTER(ct.c_char),ct.c_int32,ct.POINTER(ct.c_char),ct.c_int32,ct.POINTER(ct.c_int32),ct.c_int32,ct.POINTER(ct.c_float),ct.c_int32,ct.POINTER(ct.c_char),ct.c_int32,ct.POINTER(ct.c_ubyte),ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_int32)),ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_float)),ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_char)),ct.POINTER(ct.c_int32), ct.POINTER(ct.POINTER(ct.c_ubyte)),ct.c_int32)(("simxCallScriptFunction", libsimx)) 165 | 166 | #API functions 167 | def simxGetJointPosition(clientID, jointHandle, operationMode): 168 | ''' 169 | Please have a look at the function description/documentation in the V-REP user manual 170 | ''' 171 | position = ct.c_float() 172 | return c_GetJointPosition(clientID, jointHandle, ct.byref(position), operationMode), position.value 173 | 174 | def simxSetJointPosition(clientID, jointHandle, position, operationMode): 175 | ''' 176 | Please have a look at the function description/documentation in the V-REP user manual 177 | ''' 178 | 179 | return c_SetJointPosition(clientID, jointHandle, position, operationMode) 180 | 181 | def simxGetJointMatrix(clientID, jointHandle, operationMode): 182 | ''' 183 | Please have a look at the function description/documentation in the V-REP user manual 184 | ''' 185 | matrix = (ct.c_float*12)() 186 | ret = c_GetJointMatrix(clientID, jointHandle, matrix, operationMode) 187 | arr = [] 188 | for i in range(12): 189 | arr.append(matrix[i]) 190 | return ret, arr 191 | 192 | def simxSetSphericalJointMatrix(clientID, jointHandle, matrix, operationMode): 193 | ''' 194 | Please have a look at the function description/documentation in the V-REP user manual 195 | ''' 196 | matrix = (ct.c_float*12)(*matrix) 197 | return c_SetSphericalJointMatrix(clientID, jointHandle, matrix, operationMode) 198 | 199 | def simxSetJointTargetVelocity(clientID, jointHandle, targetVelocity, operationMode): 200 | ''' 201 | Please have a look at the function description/documentation in the V-REP user manual 202 | ''' 203 | 204 | return c_SetJointTargetVelocity(clientID, jointHandle, targetVelocity, operationMode) 205 | 206 | def simxSetJointTargetPosition(clientID, jointHandle, targetPosition, operationMode): 207 | ''' 208 | Please have a look at the function description/documentation in the V-REP user manual 209 | ''' 210 | 211 | return c_SetJointTargetPosition(clientID, jointHandle, targetPosition, operationMode) 212 | 213 | def simxJointGetForce(clientID, jointHandle, operationMode): 214 | ''' 215 | Please have a look at the function description/documentation in the V-REP user manual 216 | ''' 217 | force = ct.c_float() 218 | return c_GetJointForce(clientID, jointHandle, ct.byref(force), operationMode), force.value 219 | 220 | def simxGetJointForce(clientID, jointHandle, operationMode): 221 | ''' 222 | Please have a look at the function description/documentation in the V-REP user manual 223 | ''' 224 | force = ct.c_float() 225 | return c_GetJointForce(clientID, jointHandle, ct.byref(force), operationMode), force.value 226 | 227 | def simxSetJointForce(clientID, jointHandle, force, operationMode): 228 | ''' 229 | Please have a look at the function description/documentation in the V-REP user manual 230 | ''' 231 | return c_SetJointForce(clientID, jointHandle, force, operationMode) 232 | 233 | def simxReadForceSensor(clientID, forceSensorHandle, operationMode): 234 | ''' 235 | Please have a look at the function description/documentation in the V-REP user manual 236 | ''' 237 | state = ct.c_ubyte() 238 | forceVector = (ct.c_float*3)() 239 | torqueVector = (ct.c_float*3)() 240 | ret = c_ReadForceSensor(clientID, forceSensorHandle, ct.byref(state), forceVector, torqueVector, operationMode) 241 | arr1 = [] 242 | for i in range(3): 243 | arr1.append(forceVector[i]) 244 | arr2 = [] 245 | for i in range(3): 246 | arr2.append(torqueVector[i]) 247 | #if sys.version_info[0] == 3: 248 | # state=state.value 249 | #else: 250 | # state=ord(state.value) 251 | return ret, state.value, arr1, arr2 252 | 253 | def simxBreakForceSensor(clientID, forceSensorHandle, operationMode): 254 | ''' 255 | Please have a look at the function description/documentation in the V-REP user manual 256 | ''' 257 | return c_BreakForceSensor(clientID, forceSensorHandle, operationMode) 258 | 259 | def simxReadVisionSensor(clientID, sensorHandle, operationMode): 260 | ''' 261 | Please have a look at the function description/documentation in the V-REP user manual 262 | ''' 263 | 264 | detectionState = ct.c_ubyte() 265 | auxValues = ct.POINTER(ct.c_float)() 266 | auxValuesCount = ct.POINTER(ct.c_int)() 267 | ret = c_ReadVisionSensor(clientID, sensorHandle, ct.byref(detectionState), ct.byref(auxValues), ct.byref(auxValuesCount), operationMode) 268 | 269 | auxValues2 = [] 270 | if ret == 0: 271 | s = 0 272 | for i in range(auxValuesCount[0]): 273 | auxValues2.append(auxValues[s:s+auxValuesCount[i+1]]) 274 | s += auxValuesCount[i+1] 275 | 276 | #free C buffers 277 | c_ReleaseBuffer(auxValues) 278 | c_ReleaseBuffer(auxValuesCount) 279 | 280 | return ret, bool(detectionState.value!=0), auxValues2 281 | 282 | def simxGetObjectHandle(clientID, objectName, operationMode): 283 | ''' 284 | Please have a look at the function description/documentation in the V-REP user manual 285 | ''' 286 | handle = ct.c_int() 287 | if (sys.version_info[0] == 3) and (type(objectName) is str): 288 | objectName=objectName.encode('utf-8') 289 | return c_GetObjectHandle(clientID, objectName, ct.byref(handle), operationMode), handle.value 290 | 291 | def simxGetVisionSensorImage(clientID, sensorHandle, options, operationMode): 292 | ''' 293 | Please have a look at the function description/documentation in the V-REP user manual 294 | ''' 295 | 296 | resolution = (ct.c_int*2)() 297 | c_image = ct.POINTER(ct.c_byte)() 298 | bytesPerPixel = 3 299 | if (options and 1) != 0: 300 | bytesPerPixel = 1 301 | ret = c_GetVisionSensorImage(clientID, sensorHandle, resolution, ct.byref(c_image), options, operationMode) 302 | 303 | reso = [] 304 | image = [] 305 | if (ret == 0): 306 | image = [None]*resolution[0]*resolution[1]*bytesPerPixel 307 | for i in range(resolution[0] * resolution[1] * bytesPerPixel): 308 | image[i] = c_image[i] 309 | for i in range(2): 310 | reso.append(resolution[i]) 311 | return ret, reso, image 312 | 313 | def simxSetVisionSensorImage(clientID, sensorHandle, image, options, operationMode): 314 | ''' 315 | Please have a look at the function description/documentation in the V-REP user manual 316 | ''' 317 | size = len(image) 318 | image_bytes = (ct.c_byte*size)(*image) 319 | return c_SetVisionSensorImage(clientID, sensorHandle, image_bytes, size, options, operationMode) 320 | 321 | def simxGetVisionSensorDepthBuffer(clientID, sensorHandle, operationMode): 322 | ''' 323 | Please have a look at the function description/documentation in the V-REP user manual 324 | ''' 325 | c_buffer = ct.POINTER(ct.c_float)() 326 | resolution = (ct.c_int*2)() 327 | ret = c_GetVisionSensorDepthBuffer(clientID, sensorHandle, resolution, ct.byref(c_buffer), operationMode) 328 | reso = [] 329 | buffer = [] 330 | if (ret == 0): 331 | buffer = [None]*resolution[0]*resolution[1] 332 | for i in range(resolution[0] * resolution[1]): 333 | buffer[i] = c_buffer[i] 334 | for i in range(2): 335 | reso.append(resolution[i]) 336 | return ret, reso, buffer 337 | 338 | def simxGetObjectChild(clientID, parentObjectHandle, childIndex, operationMode): 339 | ''' 340 | Please have a look at the function description/documentation in the V-REP user manual 341 | ''' 342 | childObjectHandle = ct.c_int() 343 | return c_GetObjectChild(clientID, parentObjectHandle, childIndex, ct.byref(childObjectHandle), operationMode), childObjectHandle.value 344 | 345 | def simxGetObjectParent(clientID, childObjectHandle, operationMode): 346 | ''' 347 | Please have a look at the function description/documentation in the V-REP user manual 348 | ''' 349 | 350 | parentObjectHandle = ct.c_int() 351 | return c_GetObjectParent(clientID, childObjectHandle, ct.byref(parentObjectHandle), operationMode), parentObjectHandle.value 352 | 353 | def simxReadProximitySensor(clientID, sensorHandle, operationMode): 354 | ''' 355 | Please have a look at the function description/documentation in the V-REP user manual 356 | ''' 357 | 358 | detectionState = ct.c_ubyte() 359 | detectedObjectHandle = ct.c_int() 360 | detectedPoint = (ct.c_float*3)() 361 | detectedSurfaceNormalVector = (ct.c_float*3)() 362 | ret = c_ReadProximitySensor(clientID, sensorHandle, ct.byref(detectionState), detectedPoint, ct.byref(detectedObjectHandle), detectedSurfaceNormalVector, operationMode) 363 | arr1 = [] 364 | for i in range(3): 365 | arr1.append(detectedPoint[i]) 366 | arr2 = [] 367 | for i in range(3): 368 | arr2.append(detectedSurfaceNormalVector[i]) 369 | return ret, bool(detectionState.value!=0), arr1, detectedObjectHandle.value, arr2 370 | 371 | def simxLoadModel(clientID, modelPathAndName, options, operationMode): 372 | ''' 373 | Please have a look at the function description/documentation in the V-REP user manual 374 | ''' 375 | baseHandle = ct.c_int() 376 | if (sys.version_info[0] == 3) and (type(modelPathAndName) is str): 377 | modelPathAndName=modelPathAndName.encode('utf-8') 378 | return c_LoadModel(clientID, modelPathAndName, options, ct.byref(baseHandle), operationMode), baseHandle.value 379 | 380 | def simxLoadUI(clientID, uiPathAndName, options, operationMode): 381 | ''' 382 | Please have a look at the function description/documentation in the V-REP user manual 383 | ''' 384 | 385 | count = ct.c_int() 386 | uiHandles = ct.POINTER(ct.c_int)() 387 | if (sys.version_info[0] == 3) and (type(uiPathAndName) is str): 388 | uiPathAndName=uiPathAndName.encode('utf-8') 389 | ret = c_LoadUI(clientID, uiPathAndName, options, ct.byref(count), ct.byref(uiHandles), operationMode) 390 | 391 | handles = [] 392 | if ret == 0: 393 | for i in range(count.value): 394 | handles.append(uiHandles[i]) 395 | #free C buffers 396 | c_ReleaseBuffer(uiHandles) 397 | 398 | return ret, handles 399 | 400 | def simxLoadScene(clientID, scenePathAndName, options, operationMode): 401 | ''' 402 | Please have a look at the function description/documentation in the V-REP user manual 403 | ''' 404 | 405 | if (sys.version_info[0] == 3) and (type(scenePathAndName) is str): 406 | scenePathAndName=scenePathAndName.encode('utf-8') 407 | return c_LoadScene(clientID, scenePathAndName, options, operationMode) 408 | 409 | def simxStartSimulation(clientID, operationMode): 410 | ''' 411 | Please have a look at the function description/documentation in the V-REP user manual 412 | ''' 413 | 414 | return c_StartSimulation(clientID, operationMode) 415 | 416 | def simxPauseSimulation(clientID, operationMode): 417 | ''' 418 | Please have a look at the function description/documentation in the V-REP user manual 419 | ''' 420 | 421 | return c_PauseSimulation(clientID, operationMode) 422 | 423 | def simxStopSimulation(clientID, operationMode): 424 | ''' 425 | Please have a look at the function description/documentation in the V-REP user manual 426 | ''' 427 | 428 | return c_StopSimulation(clientID, operationMode) 429 | 430 | def simxGetUIHandle(clientID, uiName, operationMode): 431 | ''' 432 | Please have a look at the function description/documentation in the V-REP user manual 433 | ''' 434 | 435 | handle = ct.c_int() 436 | if (sys.version_info[0] == 3) and (type(uiName) is str): 437 | uiName=uiName.encode('utf-8') 438 | return c_GetUIHandle(clientID, uiName, ct.byref(handle), operationMode), handle.value 439 | 440 | def simxGetUISlider(clientID, uiHandle, uiButtonID, operationMode): 441 | ''' 442 | Please have a look at the function description/documentation in the V-REP user manual 443 | ''' 444 | 445 | position = ct.c_int() 446 | return c_GetUISlider(clientID, uiHandle, uiButtonID, ct.byref(position), operationMode), position.value 447 | 448 | def simxSetUISlider(clientID, uiHandle, uiButtonID, position, operationMode): 449 | ''' 450 | Please have a look at the function description/documentation in the V-REP user manual 451 | ''' 452 | 453 | return c_SetUISlider(clientID, uiHandle, uiButtonID, position, operationMode) 454 | 455 | def simxGetUIEventButton(clientID, uiHandle, operationMode): 456 | ''' 457 | Please have a look at the function description/documentation in the V-REP user manual 458 | ''' 459 | 460 | uiEventButtonID = ct.c_int() 461 | auxValues = (ct.c_int*2)() 462 | ret = c_GetUIEventButton(clientID, uiHandle, ct.byref(uiEventButtonID), auxValues, operationMode) 463 | arr = [] 464 | for i in range(2): 465 | arr.append(auxValues[i]) 466 | return ret, uiEventButtonID.value, arr 467 | 468 | def simxGetUIButtonProperty(clientID, uiHandle, uiButtonID, operationMode): 469 | ''' 470 | Please have a look at the function description/documentation in the V-REP user manual 471 | ''' 472 | 473 | prop = ct.c_int() 474 | return c_GetUIButtonProperty(clientID, uiHandle, uiButtonID, ct.byref(prop), operationMode), prop.value 475 | 476 | def simxSetUIButtonProperty(clientID, uiHandle, uiButtonID, prop, operationMode): 477 | ''' 478 | Please have a look at the function description/documentation in the V-REP user manual 479 | ''' 480 | 481 | return c_SetUIButtonProperty(clientID, uiHandle, uiButtonID, prop, operationMode) 482 | 483 | def simxAddStatusbarMessage(clientID, message, operationMode): 484 | ''' 485 | Please have a look at the function description/documentation in the V-REP user manual 486 | ''' 487 | 488 | if (sys.version_info[0] == 3) and (type(message) is str): 489 | message=message.encode('utf-8') 490 | return c_AddStatusbarMessage(clientID, message, operationMode) 491 | 492 | def simxAuxiliaryConsoleOpen(clientID, title, maxLines, mode, position, size, textColor, backgroundColor, operationMode): 493 | ''' 494 | Please have a look at the function description/documentation in the V-REP user manual 495 | ''' 496 | 497 | consoleHandle = ct.c_int() 498 | if (sys.version_info[0] == 3) and (type(title) is str): 499 | title=title.encode('utf-8') 500 | if position != None: 501 | c_position = (ct.c_int*2)(*position) 502 | else: 503 | c_position = None 504 | if size != None: 505 | c_size = (ct.c_int*2)(*size) 506 | else: 507 | c_size = None 508 | if textColor != None: 509 | c_textColor = (ct.c_float*3)(*textColor) 510 | else: 511 | c_textColor = None 512 | if backgroundColor != None: 513 | c_backgroundColor = (ct.c_float*3)(*backgroundColor) 514 | else: 515 | c_backgroundColor = None 516 | return c_AuxiliaryConsoleOpen(clientID, title, maxLines, mode, c_position, c_size, c_textColor, c_backgroundColor, ct.byref(consoleHandle), operationMode), consoleHandle.value 517 | 518 | def simxAuxiliaryConsoleClose(clientID, consoleHandle, operationMode): 519 | ''' 520 | Please have a look at the function description/documentation in the V-REP user manual 521 | ''' 522 | 523 | return c_AuxiliaryConsoleClose(clientID, consoleHandle, operationMode) 524 | 525 | def simxAuxiliaryConsolePrint(clientID, consoleHandle, txt, operationMode): 526 | ''' 527 | Please have a look at the function description/documentation in the V-REP user manual 528 | ''' 529 | 530 | if (sys.version_info[0] == 3) and (type(txt) is str): 531 | txt=txt.encode('utf-8') 532 | return c_AuxiliaryConsolePrint(clientID, consoleHandle, txt, operationMode) 533 | 534 | def simxAuxiliaryConsoleShow(clientID, consoleHandle, showState, operationMode): 535 | ''' 536 | Please have a look at the function description/documentation in the V-REP user manual 537 | ''' 538 | 539 | return c_AuxiliaryConsoleShow(clientID, consoleHandle, showState, operationMode) 540 | 541 | def simxGetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, operationMode): 542 | ''' 543 | Please have a look at the function description/documentation in the V-REP user manual 544 | ''' 545 | eulerAngles = (ct.c_float*3)() 546 | ret = c_GetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, eulerAngles, operationMode) 547 | arr = [] 548 | for i in range(3): 549 | arr.append(eulerAngles[i]) 550 | return ret, arr 551 | 552 | def simxGetObjectPosition(clientID, objectHandle, relativeToObjectHandle, operationMode): 553 | ''' 554 | Please have a look at the function description/documentation in the V-REP user manual 555 | ''' 556 | position = (ct.c_float*3)() 557 | ret = c_GetObjectPosition(clientID, objectHandle, relativeToObjectHandle, position, operationMode) 558 | arr = [] 559 | for i in range(3): 560 | arr.append(position[i]) 561 | return ret, arr 562 | 563 | def simxSetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, eulerAngles, operationMode): 564 | ''' 565 | Please have a look at the function description/documentation in the V-REP user manual 566 | ''' 567 | 568 | angles = (ct.c_float*3)(*eulerAngles) 569 | return c_SetObjectOrientation(clientID, objectHandle, relativeToObjectHandle, angles, operationMode) 570 | 571 | def simxSetObjectPosition(clientID, objectHandle, relativeToObjectHandle, position, operationMode): 572 | ''' 573 | Please have a look at the function description/documentation in the V-REP user manual 574 | ''' 575 | 576 | c_position = (ct.c_float*3)(*position) 577 | return c_SetObjectPosition(clientID, objectHandle, relativeToObjectHandle, c_position, operationMode) 578 | 579 | def simxSetObjectParent(clientID, objectHandle, parentObject, keepInPlace, operationMode): 580 | ''' 581 | Please have a look at the function description/documentation in the V-REP user manual 582 | ''' 583 | 584 | return c_SetObjectParent(clientID, objectHandle, parentObject, keepInPlace, operationMode) 585 | 586 | def simxSetUIButtonLabel(clientID, uiHandle, uiButtonID, upStateLabel, downStateLabel, operationMode): 587 | ''' 588 | Please have a look at the function description/documentation in the V-REP user manual 589 | ''' 590 | 591 | if sys.version_info[0] == 3: 592 | if type(upStateLabel) is str: 593 | upStateLabel=upStateLabel.encode('utf-8') 594 | if type(downStateLabel) is str: 595 | downStateLabel=downStateLabel.encode('utf-8') 596 | return c_SetUIButtonLabel(clientID, uiHandle, uiButtonID, upStateLabel, downStateLabel, operationMode) 597 | 598 | def simxGetLastErrors(clientID, operationMode): 599 | ''' 600 | Please have a look at the function description/documentation in the V-REP user manual 601 | ''' 602 | errors =[] 603 | errorCnt = ct.c_int() 604 | errorStrings = ct.POINTER(ct.c_char)() 605 | ret = c_GetLastErrors(clientID, ct.byref(errorCnt), ct.byref(errorStrings), operationMode) 606 | if ret == 0: 607 | s = 0 608 | for i in range(errorCnt.value): 609 | a = bytearray() 610 | while errorStrings[s] != b'\0': 611 | if sys.version_info[0] == 3: 612 | a.append(int.from_bytes(errorStrings[s],'big')) 613 | else: 614 | a.append(errorStrings[s]) 615 | s += 1 616 | s += 1 #skip null 617 | if sys.version_info[0] == 3: 618 | errors.append(str(a,'utf-8')) 619 | else: 620 | errors.append(str(a)) 621 | 622 | return ret, errors 623 | 624 | def simxGetArrayParameter(clientID, paramIdentifier, operationMode): 625 | ''' 626 | Please have a look at the function description/documentation in the V-REP user manual 627 | ''' 628 | paramValues = (ct.c_float*3)() 629 | ret = c_GetArrayParameter(clientID, paramIdentifier, paramValues, operationMode) 630 | arr = [] 631 | for i in range(3): 632 | arr.append(paramValues[i]) 633 | return ret, arr 634 | 635 | def simxSetArrayParameter(clientID, paramIdentifier, paramValues, operationMode): 636 | ''' 637 | Please have a look at the function description/documentation in the V-REP user manual 638 | ''' 639 | 640 | c_paramValues = (ct.c_float*3)(*paramValues) 641 | return c_SetArrayParameter(clientID, paramIdentifier, c_paramValues, operationMode) 642 | 643 | def simxGetBooleanParameter(clientID, paramIdentifier, operationMode): 644 | ''' 645 | Please have a look at the function description/documentation in the V-REP user manual 646 | ''' 647 | 648 | paramValue = ct.c_ubyte() 649 | return c_GetBooleanParameter(clientID, paramIdentifier, ct.byref(paramValue), operationMode), bool(paramValue.value!=0) 650 | 651 | def simxSetBooleanParameter(clientID, paramIdentifier, paramValue, operationMode): 652 | ''' 653 | Please have a look at the function description/documentation in the V-REP user manual 654 | ''' 655 | 656 | return c_SetBooleanParameter(clientID, paramIdentifier, paramValue, operationMode) 657 | 658 | def simxGetIntegerParameter(clientID, paramIdentifier, operationMode): 659 | ''' 660 | Please have a look at the function description/documentation in the V-REP user manual 661 | ''' 662 | 663 | paramValue = ct.c_int() 664 | return c_GetIntegerParameter(clientID, paramIdentifier, ct.byref(paramValue), operationMode), paramValue.value 665 | 666 | def simxSetIntegerParameter(clientID, paramIdentifier, paramValue, operationMode): 667 | ''' 668 | Please have a look at the function description/documentation in the V-REP user manual 669 | ''' 670 | 671 | return c_SetIntegerParameter(clientID, paramIdentifier, paramValue, operationMode) 672 | 673 | def simxGetFloatingParameter(clientID, paramIdentifier, operationMode): 674 | ''' 675 | Please have a look at the function description/documentation in the V-REP user manual 676 | ''' 677 | 678 | paramValue = ct.c_float() 679 | return c_GetFloatingParameter(clientID, paramIdentifier, ct.byref(paramValue), operationMode), paramValue.value 680 | 681 | def simxSetFloatingParameter(clientID, paramIdentifier, paramValue, operationMode): 682 | ''' 683 | Please have a look at the function description/documentation in the V-REP user manual 684 | ''' 685 | 686 | return c_SetFloatingParameter(clientID, paramIdentifier, paramValue, operationMode) 687 | 688 | def simxGetStringParameter(clientID, paramIdentifier, operationMode): 689 | ''' 690 | Please have a look at the function description/documentation in the V-REP user manual 691 | ''' 692 | paramValue = ct.POINTER(ct.c_char)() 693 | ret = c_GetStringParameter(clientID, paramIdentifier, ct.byref(paramValue), operationMode) 694 | 695 | a = bytearray() 696 | if ret == 0: 697 | i = 0 698 | while paramValue[i] != b'\0': 699 | if sys.version_info[0] == 3: 700 | a.append(int.from_bytes(paramValue[i],'big')) 701 | else: 702 | a.append(paramValue[i]) 703 | i=i+1 704 | if sys.version_info[0] == 3: 705 | a=str(a,'utf-8') 706 | else: 707 | a=str(a) 708 | return ret, a 709 | 710 | def simxGetCollisionHandle(clientID, collisionObjectName, operationMode): 711 | ''' 712 | Please have a look at the function description/documentation in the V-REP user manual 713 | ''' 714 | 715 | handle = ct.c_int() 716 | if (sys.version_info[0] == 3) and (type(collisionObjectName) is str): 717 | collisionObjectName=collisionObjectName.encode('utf-8') 718 | return c_GetCollisionHandle(clientID, collisionObjectName, ct.byref(handle), operationMode), handle.value 719 | 720 | def simxGetCollectionHandle(clientID, collectionName, operationMode): 721 | ''' 722 | Please have a look at the function description/documentation in the V-REP user manual 723 | ''' 724 | 725 | handle = ct.c_int() 726 | if (sys.version_info[0] == 3) and (type(collectionName) is str): 727 | collectionName=collectionName.encode('utf-8') 728 | return c_GetCollectionHandle(clientID, collectionName, ct.byref(handle), operationMode), handle.value 729 | 730 | def simxGetDistanceHandle(clientID, distanceObjectName, operationMode): 731 | ''' 732 | Please have a look at the function description/documentation in the V-REP user manual 733 | ''' 734 | 735 | handle = ct.c_int() 736 | if (sys.version_info[0] == 3) and (type(distanceObjectName) is str): 737 | distanceObjectName=distanceObjectName.encode('utf-8') 738 | return c_GetDistanceHandle(clientID, distanceObjectName, ct.byref(handle), operationMode), handle.value 739 | 740 | def simxReadCollision(clientID, collisionObjectHandle, operationMode): 741 | ''' 742 | Please have a look at the function description/documentation in the V-REP user manual 743 | ''' 744 | collisionState = ct.c_ubyte() 745 | return c_ReadCollision(clientID, collisionObjectHandle, ct.byref(collisionState), operationMode), bool(collisionState.value!=0) 746 | 747 | def simxReadDistance(clientID, distanceObjectHandle, operationMode): 748 | ''' 749 | Please have a look at the function description/documentation in the V-REP user manual 750 | ''' 751 | 752 | minimumDistance = ct.c_float() 753 | return c_ReadDistance(clientID, distanceObjectHandle, ct.byref(minimumDistance), operationMode), minimumDistance.value 754 | 755 | def simxRemoveObject(clientID, objectHandle, operationMode): 756 | ''' 757 | Please have a look at the function description/documentation in the V-REP user manual 758 | ''' 759 | 760 | return c_RemoveObject(clientID, objectHandle, operationMode) 761 | 762 | def simxRemoveModel(clientID, objectHandle, operationMode): 763 | ''' 764 | Please have a look at the function description/documentation in the V-REP user manual 765 | ''' 766 | 767 | return c_RemoveModel(clientID, objectHandle, operationMode) 768 | 769 | def simxRemoveUI(clientID, uiHandle, operationMode): 770 | ''' 771 | Please have a look at the function description/documentation in the V-REP user manual 772 | ''' 773 | 774 | return c_RemoveUI(clientID, uiHandle, operationMode) 775 | 776 | def simxCloseScene(clientID, operationMode): 777 | ''' 778 | Please have a look at the function description/documentation in the V-REP user manual 779 | ''' 780 | 781 | return c_CloseScene(clientID, operationMode) 782 | 783 | def simxGetObjects(clientID, objectType, operationMode): 784 | ''' 785 | Please have a look at the function description/documentation in the V-REP user manual 786 | ''' 787 | 788 | objectCount = ct.c_int() 789 | objectHandles = ct.POINTER(ct.c_int)() 790 | 791 | ret = c_GetObjects(clientID, objectType, ct.byref(objectCount), ct.byref(objectHandles), operationMode) 792 | handles = [] 793 | if ret == 0: 794 | for i in range(objectCount.value): 795 | handles.append(objectHandles[i]) 796 | 797 | return ret, handles 798 | 799 | 800 | def simxDisplayDialog(clientID, titleText, mainText, dialogType, initialText, titleColors, dialogColors, operationMode): 801 | ''' 802 | Please have a look at the function description/documentation in the V-REP user manual 803 | ''' 804 | if titleColors != None: 805 | c_titleColors = (ct.c_float*6)(*titleColors) 806 | else: 807 | c_titleColors = None 808 | if dialogColors != None: 809 | c_dialogColors = (ct.c_float*6)(*dialogColors) 810 | else: 811 | c_dialogColors = None 812 | 813 | c_dialogHandle = ct.c_int() 814 | c_uiHandle = ct.c_int() 815 | if sys.version_info[0] == 3: 816 | if type(titleText) is str: 817 | titleText=titleText.encode('utf-8') 818 | if type(mainText) is str: 819 | mainText=mainText.encode('utf-8') 820 | if type(initialText) is str: 821 | initialText=initialText.encode('utf-8') 822 | return c_DisplayDialog(clientID, titleText, mainText, dialogType, initialText, c_titleColors, c_dialogColors, ct.byref(c_dialogHandle), ct.byref(c_uiHandle), operationMode), c_dialogHandle.value, c_uiHandle.value 823 | 824 | def simxEndDialog(clientID, dialogHandle, operationMode): 825 | ''' 826 | Please have a look at the function description/documentation in the V-REP user manual 827 | ''' 828 | 829 | return c_EndDialog(clientID, dialogHandle, operationMode) 830 | 831 | def simxGetDialogInput(clientID, dialogHandle, operationMode): 832 | ''' 833 | Please have a look at the function description/documentation in the V-REP user manual 834 | ''' 835 | inputText = ct.POINTER(ct.c_char)() 836 | ret = c_GetDialogInput(clientID, dialogHandle, ct.byref(inputText), operationMode) 837 | 838 | a = bytearray() 839 | if ret == 0: 840 | i = 0 841 | while inputText[i] != b'\0': 842 | if sys.version_info[0] == 3: 843 | a.append(int.from_bytes(inputText[i],'big')) 844 | else: 845 | a.append(inputText[i]) 846 | i = i+1 847 | 848 | if sys.version_info[0] == 3: 849 | a=str(a,'utf-8') 850 | else: 851 | a=str(a) 852 | return ret, a 853 | 854 | 855 | def simxGetDialogResult(clientID, dialogHandle, operationMode): 856 | ''' 857 | Please have a look at the function description/documentation in the V-REP user manual 858 | ''' 859 | result = ct.c_int() 860 | return c_GetDialogResult(clientID, dialogHandle, ct.byref(result), operationMode), result.value 861 | 862 | def simxCopyPasteObjects(clientID, objectHandles, operationMode): 863 | ''' 864 | Please have a look at the function description/documentation in the V-REP user manual 865 | ''' 866 | c_objectHandles = (ct.c_int*len(objectHandles))(*objectHandles) 867 | c_objectHandles = ct.cast(c_objectHandles,ct.POINTER(ct.c_int)) # IronPython needs this 868 | newObjectCount = ct.c_int() 869 | newObjectHandles = ct.POINTER(ct.c_int)() 870 | ret = c_CopyPasteObjects(clientID, c_objectHandles, len(objectHandles), ct.byref(newObjectHandles), ct.byref(newObjectCount), operationMode) 871 | 872 | newobj = [] 873 | if ret == 0: 874 | for i in range(newObjectCount.value): 875 | newobj.append(newObjectHandles[i]) 876 | 877 | return ret, newobj 878 | 879 | 880 | def simxGetObjectSelection(clientID, operationMode): 881 | ''' 882 | Please have a look at the function description/documentation in the V-REP user manual 883 | ''' 884 | objectCount = ct.c_int() 885 | objectHandles = ct.POINTER(ct.c_int)() 886 | ret = c_GetObjectSelection(clientID, ct.byref(objectHandles), ct.byref(objectCount), operationMode) 887 | 888 | newobj = [] 889 | if ret == 0: 890 | for i in range(objectCount.value): 891 | newobj.append(objectHandles[i]) 892 | 893 | return ret, newobj 894 | 895 | 896 | 897 | def simxSetObjectSelection(clientID, objectHandles, operationMode): 898 | ''' 899 | Please have a look at the function description/documentation in the V-REP user manual 900 | ''' 901 | 902 | c_objectHandles = (ct.c_int*len(objectHandles))(*objectHandles) 903 | return c_SetObjectSelection(clientID, c_objectHandles, len(objectHandles), operationMode) 904 | 905 | def simxClearFloatSignal(clientID, signalName, operationMode): 906 | ''' 907 | Please have a look at the function description/documentation in the V-REP user manual 908 | ''' 909 | 910 | if (sys.version_info[0] == 3) and (type(signalName) is str): 911 | signalName=signalName.encode('utf-8') 912 | return c_ClearFloatSignal(clientID, signalName, operationMode) 913 | 914 | def simxClearIntegerSignal(clientID, signalName, operationMode): 915 | ''' 916 | Please have a look at the function description/documentation in the V-REP user manual 917 | ''' 918 | 919 | if (sys.version_info[0] == 3) and (type(signalName) is str): 920 | signalName=signalName.encode('utf-8') 921 | return c_ClearIntegerSignal(clientID, signalName, operationMode) 922 | 923 | def simxClearStringSignal(clientID, signalName, operationMode): 924 | ''' 925 | Please have a look at the function description/documentation in the V-REP user manual 926 | ''' 927 | 928 | if (sys.version_info[0] == 3) and (type(signalName) is str): 929 | signalName=signalName.encode('utf-8') 930 | return c_ClearStringSignal(clientID, signalName, operationMode) 931 | 932 | def simxGetFloatSignal(clientID, signalName, operationMode): 933 | ''' 934 | Please have a look at the function description/documentation in the V-REP user manual 935 | ''' 936 | 937 | signalValue = ct.c_float() 938 | if (sys.version_info[0] == 3) and (type(signalName) is str): 939 | signalName=signalName.encode('utf-8') 940 | return c_GetFloatSignal(clientID, signalName, ct.byref(signalValue), operationMode), signalValue.value 941 | 942 | def simxGetIntegerSignal(clientID, signalName, operationMode): 943 | ''' 944 | Please have a look at the function description/documentation in the V-REP user manual 945 | ''' 946 | 947 | signalValue = ct.c_int() 948 | if (sys.version_info[0] == 3) and (type(signalName) is str): 949 | signalName=signalName.encode('utf-8') 950 | return c_GetIntegerSignal(clientID, signalName, ct.byref(signalValue), operationMode), signalValue.value 951 | 952 | def simxGetStringSignal(clientID, signalName, operationMode): 953 | ''' 954 | Please have a look at the function description/documentation in the V-REP user manual 955 | ''' 956 | 957 | signalLength = ct.c_int(); 958 | signalValue = ct.POINTER(ct.c_ubyte)() 959 | if (sys.version_info[0] == 3) and (type(signalName) is str): 960 | signalName=signalName.encode('utf-8') 961 | ret = c_GetStringSignal(clientID, signalName, ct.byref(signalValue), ct.byref(signalLength), operationMode) 962 | 963 | a = bytearray() 964 | if ret == 0: 965 | for i in range(signalLength.value): 966 | a.append(signalValue[i]) 967 | if sys.version_info[0] != 3: 968 | a=str(a) 969 | 970 | return ret, a 971 | 972 | def simxGetAndClearStringSignal(clientID, signalName, operationMode): 973 | ''' 974 | Please have a look at the function description/documentation in the V-REP user manual 975 | ''' 976 | 977 | signalLength = ct.c_int(); 978 | signalValue = ct.POINTER(ct.c_ubyte)() 979 | if (sys.version_info[0] == 3) and (type(signalName) is str): 980 | signalName=signalName.encode('utf-8') 981 | ret = c_GetAndClearStringSignal(clientID, signalName, ct.byref(signalValue), ct.byref(signalLength), operationMode) 982 | 983 | a = bytearray() 984 | if ret == 0: 985 | for i in range(signalLength.value): 986 | a.append(signalValue[i]) 987 | if sys.version_info[0] != 3: 988 | a=str(a) 989 | 990 | return ret, a 991 | 992 | def simxReadStringStream(clientID, signalName, operationMode): 993 | ''' 994 | Please have a look at the function description/documentation in the V-REP user manual 995 | ''' 996 | 997 | signalLength = ct.c_int(); 998 | signalValue = ct.POINTER(ct.c_ubyte)() 999 | if (sys.version_info[0] == 3) and (type(signalName) is str): 1000 | signalName=signalName.encode('utf-8') 1001 | ret = c_ReadStringStream(clientID, signalName, ct.byref(signalValue), ct.byref(signalLength), operationMode) 1002 | 1003 | a = bytearray() 1004 | if ret == 0: 1005 | for i in range(signalLength.value): 1006 | a.append(signalValue[i]) 1007 | if sys.version_info[0] != 3: 1008 | a=str(a) 1009 | 1010 | return ret, a 1011 | 1012 | def simxSetFloatSignal(clientID, signalName, signalValue, operationMode): 1013 | ''' 1014 | Please have a look at the function description/documentation in the V-REP user manual 1015 | ''' 1016 | 1017 | if (sys.version_info[0] == 3) and (type(signalName) is str): 1018 | signalName=signalName.encode('utf-8') 1019 | return c_SetFloatSignal(clientID, signalName, signalValue, operationMode) 1020 | 1021 | def simxSetIntegerSignal(clientID, signalName, signalValue, operationMode): 1022 | ''' 1023 | Please have a look at the function description/documentation in the V-REP user manual 1024 | ''' 1025 | 1026 | if (sys.version_info[0] == 3) and (type(signalName) is str): 1027 | signalName=signalName.encode('utf-8') 1028 | return c_SetIntegerSignal(clientID, signalName, signalValue, operationMode) 1029 | 1030 | def simxSetStringSignal(clientID, signalName, signalValue, operationMode): 1031 | ''' 1032 | Please have a look at the function description/documentation in the V-REP user manual 1033 | ''' 1034 | 1035 | sigV=signalValue 1036 | if sys.version_info[0] == 3: 1037 | if type(signalName) is str: 1038 | signalName=signalName.encode('utf-8') 1039 | if type(signalValue) is bytearray: 1040 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1041 | if type(signalValue) is str: 1042 | signalValue=signalValue.encode('utf-8') 1043 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1044 | else: 1045 | if type(signalValue) is bytearray: 1046 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1047 | if type(signalValue) is str: 1048 | signalValue=bytearray(signalValue) 1049 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1050 | sigV=ct.cast(sigV,ct.POINTER(ct.c_ubyte)) # IronPython needs this 1051 | return c_SetStringSignal(clientID, signalName, sigV, len(signalValue), operationMode) 1052 | 1053 | def simxAppendStringSignal(clientID, signalName, signalValue, operationMode): 1054 | ''' 1055 | Please have a look at the function description/documentation in the V-REP user manual 1056 | ''' 1057 | 1058 | sigV=signalValue 1059 | if sys.version_info[0] == 3: 1060 | if type(signalName) is str: 1061 | signalName=signalName.encode('utf-8') 1062 | if type(signalValue) is bytearray: 1063 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1064 | if type(signalValue) is str: 1065 | signalValue=signalValue.encode('utf-8') 1066 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1067 | else: 1068 | if type(signalValue) is bytearray: 1069 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1070 | if type(signalValue) is str: 1071 | signalValue=bytearray(signalValue) 1072 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1073 | sigV=ct.cast(sigV,ct.POINTER(ct.c_ubyte)) # IronPython needs this 1074 | return c_AppendStringSignal(clientID, signalName, sigV, len(signalValue), operationMode) 1075 | 1076 | def simxWriteStringStream(clientID, signalName, signalValue, operationMode): 1077 | ''' 1078 | Please have a look at the function description/documentation in the V-REP user manual 1079 | ''' 1080 | 1081 | sigV=signalValue 1082 | if sys.version_info[0] == 3: 1083 | if type(signalName) is str: 1084 | signalName=signalName.encode('utf-8') 1085 | if type(signalValue) is bytearray: 1086 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1087 | if type(signalValue) is str: 1088 | signalValue=signalValue.encode('utf-8') 1089 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1090 | else: 1091 | if type(signalValue) is bytearray: 1092 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1093 | if type(signalValue) is str: 1094 | signalValue=bytearray(signalValue) 1095 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1096 | sigV=ct.cast(sigV,ct.POINTER(ct.c_ubyte)) # IronPython needs this 1097 | return c_WriteStringStream(clientID, signalName, sigV, len(signalValue), operationMode) 1098 | 1099 | def simxGetObjectFloatParameter(clientID, objectHandle, parameterID, operationMode): 1100 | ''' 1101 | Please have a look at the function description/documentation in the V-REP user manual 1102 | ''' 1103 | 1104 | parameterValue = ct.c_float() 1105 | return c_GetObjectFloatParameter(clientID, objectHandle, parameterID, ct.byref(parameterValue), operationMode), parameterValue.value 1106 | 1107 | def simxSetObjectFloatParameter(clientID, objectHandle, parameterID, parameterValue, operationMode): 1108 | ''' 1109 | Please have a look at the function description/documentation in the V-REP user manual 1110 | ''' 1111 | 1112 | return c_SetObjectFloatParameter(clientID, objectHandle, parameterID, parameterValue, operationMode) 1113 | 1114 | def simxGetObjectIntParameter(clientID, objectHandle, parameterID, operationMode): 1115 | ''' 1116 | Please have a look at the function description/documentation in the V-REP user manual 1117 | ''' 1118 | 1119 | parameterValue = ct.c_int() 1120 | return c_GetObjectIntParameter(clientID, objectHandle, parameterID, ct.byref(parameterValue), operationMode), parameterValue.value 1121 | 1122 | def simxSetObjectIntParameter(clientID, objectHandle, parameterID, parameterValue, operationMode): 1123 | ''' 1124 | Please have a look at the function description/documentation in the V-REP user manual 1125 | ''' 1126 | 1127 | return c_SetObjectIntParameter(clientID, objectHandle, parameterID, parameterValue, operationMode) 1128 | 1129 | def simxGetModelProperty(clientID, objectHandle, operationMode): 1130 | ''' 1131 | Please have a look at the function description/documentation in the V-REP user manual 1132 | ''' 1133 | prop = ct.c_int() 1134 | return c_GetModelProperty(clientID, objectHandle, ct.byref(prop), operationMode), prop.value 1135 | 1136 | def simxSetModelProperty(clientID, objectHandle, prop, operationMode): 1137 | ''' 1138 | Please have a look at the function description/documentation in the V-REP user manual 1139 | ''' 1140 | 1141 | return c_SetModelProperty(clientID, objectHandle, prop, operationMode) 1142 | 1143 | def simxStart(connectionAddress, connectionPort, waitUntilConnected, doNotReconnectOnceDisconnected, timeOutInMs, commThreadCycleInMs): 1144 | ''' 1145 | Please have a look at the function description/documentation in the V-REP user manual 1146 | ''' 1147 | 1148 | if (sys.version_info[0] == 3) and (type(connectionAddress) is str): 1149 | connectionAddress=connectionAddress.encode('utf-8') 1150 | return c_Start(connectionAddress, connectionPort, waitUntilConnected, doNotReconnectOnceDisconnected, timeOutInMs, commThreadCycleInMs) 1151 | 1152 | def simxFinish(clientID): 1153 | ''' 1154 | Please have a look at the function description/documentation in the V-REP user manual 1155 | ''' 1156 | 1157 | return c_Finish(clientID) 1158 | 1159 | def simxGetPingTime(clientID): 1160 | ''' 1161 | Please have a look at the function description/documentation in the V-REP user manual 1162 | ''' 1163 | pingTime = ct.c_int() 1164 | return c_GetPingTime(clientID, ct.byref(pingTime)), pingTime.value 1165 | 1166 | def simxGetLastCmdTime(clientID): 1167 | ''' 1168 | Please have a look at the function description/documentation in the V-REP user manual 1169 | ''' 1170 | 1171 | return c_GetLastCmdTime(clientID) 1172 | 1173 | def simxSynchronousTrigger(clientID): 1174 | ''' 1175 | Please have a look at the function description/documentation in the V-REP user manual 1176 | ''' 1177 | 1178 | return c_SynchronousTrigger(clientID) 1179 | 1180 | def simxSynchronous(clientID, enable): 1181 | ''' 1182 | Please have a look at the function description/documentation in the V-REP user manual 1183 | ''' 1184 | 1185 | return c_Synchronous(clientID, enable) 1186 | 1187 | def simxPauseCommunication(clientID, enable): 1188 | ''' 1189 | Please have a look at the function description/documentation in the V-REP user manual 1190 | ''' 1191 | 1192 | return c_PauseCommunication(clientID, enable) 1193 | 1194 | def simxGetInMessageInfo(clientID, infoType): 1195 | ''' 1196 | Please have a look at the function description/documentation in the V-REP user manual 1197 | ''' 1198 | info = ct.c_int() 1199 | return c_GetInMessageInfo(clientID, infoType, ct.byref(info)), info.value 1200 | 1201 | def simxGetOutMessageInfo(clientID, infoType): 1202 | ''' 1203 | Please have a look at the function description/documentation in the V-REP user manual 1204 | ''' 1205 | info = ct.c_int() 1206 | return c_GetOutMessageInfo(clientID, infoType, ct.byref(info)), info.value 1207 | 1208 | def simxGetConnectionId(clientID): 1209 | ''' 1210 | Please have a look at the function description/documentation in the V-REP user manual 1211 | ''' 1212 | 1213 | return c_GetConnectionId(clientID) 1214 | 1215 | def simxCreateBuffer(bufferSize): 1216 | ''' 1217 | Please have a look at the function description/documentation in the V-REP user manual 1218 | ''' 1219 | 1220 | return c_CreateBuffer(bufferSize) 1221 | 1222 | def simxReleaseBuffer(buffer): 1223 | ''' 1224 | Please have a look at the function description/documentation in the V-REP user manual 1225 | ''' 1226 | 1227 | return c_ReleaseBuffer(buffer) 1228 | 1229 | def simxTransferFile(clientID, filePathAndName, fileName_serverSide, timeOut, operationMode): 1230 | ''' 1231 | Please have a look at the function description/documentation in the V-REP user manual 1232 | ''' 1233 | 1234 | if (sys.version_info[0] == 3) and (type(filePathAndName) is str): 1235 | filePathAndName=filePathAndName.encode('utf-8') 1236 | return c_TransferFile(clientID, filePathAndName, fileName_serverSide, timeOut, operationMode) 1237 | 1238 | def simxEraseFile(clientID, fileName_serverSide, operationMode): 1239 | ''' 1240 | Please have a look at the function description/documentation in the V-REP user manual 1241 | ''' 1242 | 1243 | if (sys.version_info[0] == 3) and (type(fileName_serverSide) is str): 1244 | fileName_serverSide=fileName_serverSide.encode('utf-8') 1245 | return c_EraseFile(clientID, fileName_serverSide, operationMode) 1246 | 1247 | def simxCreateDummy(clientID, size, color, operationMode): 1248 | ''' 1249 | Please have a look at the function description/documentation in the V-REP user manual 1250 | ''' 1251 | 1252 | handle = ct.c_int() 1253 | if color != None: 1254 | c_color = (ct.c_ubyte*12)(*color) 1255 | else: 1256 | c_color = None 1257 | return c_CreateDummy(clientID, size, c_color, ct.byref(handle), operationMode), handle.value 1258 | 1259 | def simxQuery(clientID, signalName, signalValue, retSignalName, timeOutInMs): 1260 | ''' 1261 | Please have a look at the function description/documentation in the V-REP user manual 1262 | ''' 1263 | 1264 | retSignalLength = ct.c_int(); 1265 | retSignalValue = ct.POINTER(ct.c_ubyte)() 1266 | 1267 | sigV=signalValue 1268 | if sys.version_info[0] == 3: 1269 | if type(signalName) is str: 1270 | signalName=signalName.encode('utf-8') 1271 | if type(retSignalName) is str: 1272 | retSignalName=retSignalName.encode('utf-8') 1273 | if type(signalValue) is bytearray: 1274 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1275 | if type(signalValue) is str: 1276 | signalValue=signalValue.encode('utf-8') 1277 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1278 | else: 1279 | if type(signalValue) is bytearray: 1280 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1281 | if type(signalValue) is str: 1282 | signalValue=bytearray(signalValue) 1283 | sigV = (ct.c_ubyte*len(signalValue))(*signalValue) 1284 | sigV=ct.cast(sigV,ct.POINTER(ct.c_ubyte)) # IronPython needs this 1285 | 1286 | ret = c_Query(clientID, signalName, sigV, len(signalValue), retSignalName, ct.byref(retSignalValue), ct.byref(retSignalLength), timeOutInMs) 1287 | 1288 | a = bytearray() 1289 | if ret == 0: 1290 | for i in range(retSignalLength.value): 1291 | a.append(retSignalValue[i]) 1292 | if sys.version_info[0] != 3: 1293 | a=str(a) 1294 | 1295 | return ret, a 1296 | 1297 | def simxGetObjectGroupData(clientID, objectType, dataType, operationMode): 1298 | ''' 1299 | Please have a look at the function description/documentation in the V-REP user manual 1300 | ''' 1301 | 1302 | handles =[] 1303 | intData =[] 1304 | floatData =[] 1305 | stringData =[] 1306 | handlesC = ct.c_int() 1307 | handlesP = ct.POINTER(ct.c_int)() 1308 | intDataC = ct.c_int() 1309 | intDataP = ct.POINTER(ct.c_int)() 1310 | floatDataC = ct.c_int() 1311 | floatDataP = ct.POINTER(ct.c_float)() 1312 | stringDataC = ct.c_int() 1313 | stringDataP = ct.POINTER(ct.c_char)() 1314 | ret = c_GetObjectGroupData(clientID, objectType, dataType, ct.byref(handlesC), ct.byref(handlesP), ct.byref(intDataC), ct.byref(intDataP), ct.byref(floatDataC), ct.byref(floatDataP), ct.byref(stringDataC), ct.byref(stringDataP), operationMode) 1315 | 1316 | if ret == 0: 1317 | for i in range(handlesC.value): 1318 | handles.append(handlesP[i]) 1319 | for i in range(intDataC.value): 1320 | intData.append(intDataP[i]) 1321 | for i in range(floatDataC.value): 1322 | floatData.append(floatDataP[i]) 1323 | s = 0 1324 | for i in range(stringDataC.value): 1325 | a = bytearray() 1326 | while stringDataP[s] != b'\0': 1327 | if sys.version_info[0] == 3: 1328 | a.append(int.from_bytes(stringDataP[s],'big')) 1329 | else: 1330 | a.append(stringDataP[s]) 1331 | s += 1 1332 | s += 1 #skip null 1333 | if sys.version_info[0] == 3: 1334 | a=str(a,'utf-8') 1335 | else: 1336 | a=str(a) 1337 | stringData.append(a) 1338 | 1339 | return ret, handles, intData, floatData, stringData 1340 | 1341 | def simxCallScriptFunction(clientID, scriptDescription, options, functionName, inputInts, inputFloats, inputStrings, inputBuffer, operationMode): 1342 | ''' 1343 | Please have a look at the function description/documentation in the V-REP user manual 1344 | ''' 1345 | 1346 | inputBufferV=inputBuffer 1347 | if sys.version_info[0] == 3: 1348 | if type(scriptDescription) is str: 1349 | scriptDescription=scriptDescription.encode('utf-8') 1350 | if type(functionName) is str: 1351 | functionName=functionName.encode('utf-8') 1352 | if type(inputBuffer) is bytearray: 1353 | inputBufferV = (ct.c_ubyte*len(inputBuffer))(*inputBuffer) 1354 | if type(inputBuffer) is str: 1355 | inputBuffer=inputBuffer.encode('utf-8') 1356 | inputBufferV = (ct.c_ubyte*len(inputBuffer))(*inputBuffer) 1357 | else: 1358 | if type(inputBuffer) is bytearray: 1359 | inputBufferV = (ct.c_ubyte*len(inputBuffer))(*inputBuffer) 1360 | if type(inputBuffer) is str: 1361 | inputBuffer=bytearray(inputBuffer) 1362 | inputBufferV = (ct.c_ubyte*len(inputBuffer))(*inputBuffer) 1363 | inputBufferV=ct.cast(inputBufferV,ct.POINTER(ct.c_ubyte)) # IronPython needs this 1364 | 1365 | c_inInts = (ct.c_int*len(inputInts))(*inputInts) 1366 | c_inInts = ct.cast(c_inInts,ct.POINTER(ct.c_int)) # IronPython needs this 1367 | c_inFloats = (ct.c_float*len(inputFloats))(*inputFloats) 1368 | c_inFloats = ct.cast(c_inFloats,ct.POINTER(ct.c_float)) # IronPython needs this 1369 | 1370 | concatStr=''.encode('utf-8') 1371 | for i in range(len(inputStrings)): 1372 | a=inputStrings[i] 1373 | a=a+'\0' 1374 | if type(a) is str: 1375 | a=a.encode('utf-8') 1376 | concatStr=concatStr+a 1377 | c_inStrings = (ct.c_char*len(concatStr))(*concatStr) 1378 | 1379 | intDataOut =[] 1380 | floatDataOut =[] 1381 | stringDataOut =[] 1382 | bufferOut =bytearray() 1383 | 1384 | intDataC = ct.c_int() 1385 | intDataP = ct.POINTER(ct.c_int)() 1386 | floatDataC = ct.c_int() 1387 | floatDataP = ct.POINTER(ct.c_float)() 1388 | stringDataC = ct.c_int() 1389 | stringDataP = ct.POINTER(ct.c_char)() 1390 | bufferS = ct.c_int() 1391 | bufferP = ct.POINTER(ct.c_ubyte)() 1392 | 1393 | ret = c_CallScriptFunction(clientID,scriptDescription,options,functionName,len(inputInts),c_inInts,len(inputFloats),c_inFloats,len(inputStrings),c_inStrings,len(inputBuffer),inputBufferV,ct.byref(intDataC),ct.byref(intDataP),ct.byref(floatDataC),ct.byref(floatDataP),ct.byref(stringDataC),ct.byref(stringDataP),ct.byref(bufferS),ct.byref(bufferP),operationMode) 1394 | 1395 | if ret == 0: 1396 | for i in range(intDataC.value): 1397 | intDataOut.append(intDataP[i]) 1398 | for i in range(floatDataC.value): 1399 | floatDataOut.append(floatDataP[i]) 1400 | s = 0 1401 | for i in range(stringDataC.value): 1402 | a = bytearray() 1403 | while stringDataP[s] != b'\0': 1404 | if sys.version_info[0] == 3: 1405 | a.append(int.from_bytes(stringDataP[s],'big')) 1406 | else: 1407 | a.append(stringDataP[s]) 1408 | s += 1 1409 | s += 1 #skip null 1410 | if sys.version_info[0] == 3: 1411 | a=str(a,'utf-8') 1412 | else: 1413 | a=str(a) 1414 | stringDataOut.append(a) 1415 | for i in range(bufferS.value): 1416 | bufferOut.append(bufferP[i]) 1417 | if sys.version_info[0] != 3: 1418 | bufferOut=str(bufferOut) 1419 | 1420 | return ret, intDataOut, floatDataOut, stringDataOut, bufferOut 1421 | 1422 | def simxGetObjectVelocity(clientID, objectHandle, operationMode): 1423 | ''' 1424 | Please have a look at the function description/documentation in the V-REP user manual 1425 | ''' 1426 | linearVel = (ct.c_float*3)() 1427 | angularVel = (ct.c_float*3)() 1428 | ret = c_GetObjectVelocity(clientID, objectHandle, linearVel, angularVel, operationMode) 1429 | arr1 = [] 1430 | for i in range(3): 1431 | arr1.append(linearVel[i]) 1432 | arr2 = [] 1433 | for i in range(3): 1434 | arr2.append(angularVel[i]) 1435 | return ret, arr1, arr2 1436 | 1437 | def simxPackInts(intList): 1438 | ''' 1439 | Please have a look at the function description/documentation in the V-REP user manual 1440 | ''' 1441 | 1442 | if sys.version_info[0] == 3: 1443 | s=bytes() 1444 | for i in range(len(intList)): 1445 | s=s+struct.pack('