Python Regular API Joint Force is None
Posted: 28 Jan 2024, 14:01
Hi everyone,
I'm new to Coppeliasim. I am using Python and Regular API to train an RL agent to fly a quadcopter in Coppeliasim. I am able to connect to the simulator and set and get the Object positions using the sim.getObjectPosition method (which tells me that my python code is connected to the simulator). But when I am trying to set the Joint Force using the method sim.setJointTargetForce and use the method sim.getJointForce I am getting the output as None.
Another thing I tried is to set the joint target velocity using sim.setJointTargetVelocity method. Though the velocity is being set (checked using the method sim.getJointVelocity), the quadcopter does not seem to fly or lift off the ground.
Can anyone help me with this? Do I need to set any environment variable?
Following is the code which I am using:
I'm new to Coppeliasim. I am using Python and Regular API to train an RL agent to fly a quadcopter in Coppeliasim. I am able to connect to the simulator and set and get the Object positions using the sim.getObjectPosition method (which tells me that my python code is connected to the simulator). But when I am trying to set the Joint Force using the method sim.setJointTargetForce and use the method sim.getJointForce I am getting the output as None.
Another thing I tried is to set the joint target velocity using sim.setJointTargetVelocity method. Though the velocity is being set (checked using the method sim.getJointVelocity), the quadcopter does not seem to fly or lift off the ground.
Can anyone help me with this? Do I need to set any environment variable?
Following is the code which I am using:
Code: Select all
self.propellerHandle0 = self.sim.getObject("/Quadcopter/joint")
self.sim.setJointTargetVelocity(self.propellerHandle0, 100, [])
simStep()
print(self.sim.getJointVelocity(self.propellerHandle0))