I am trying to move a Hexapod by providing all joint angles using Remote API in Python. All the 18 joints are already set to "Torque/Force Mode". "Motor enabled" is checked and Control loop is enabled. Below is the Python Code snippet-
Code: Select all
def move(self, joint_angles):
vrep.simxPauseCommunication(self.clientID, True)
for i in range(6):
index = 3 * i
vrep.simxSetJointTargetPosition(self.clientID, self.joint_handles[index + 0], joint_angles[index + 0], vrep.simx_opmode_oneshot)
vrep.simxSetJointTargetPosition(self.clientID, self.joint_handles[index + 1], joint_angles[index + 1], vrep.simx_opmode_oneshot)
vrep.simxSetJointTargetPosition(self.clientID, self.joint_handles[index + 2], joint_angles[index + 2], vrep.simx_opmode_oneshot)
vrep.simxPauseCommunication(self.clientID, False)
vrep.simxSynchronousTrigger(self.clientID) # move simulation ahead one time step
angles = [10, 0, -10, 0] # define a trajectory
for angle in angles:
joint_angles = [angle * pi / 180] * num_joints
spider.move(joint_angles)
Code: Select all
vrep.simxSetFloatingParameter(self.clientID, vrep.sim_floatparam_simulation_time_step, dt, vrep.simx_opmode_oneshot)