problems encountered using python api "simSetVehiclePose" #4742
Unanswered
DarkKnightCyd
asked this question in
Support Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use api "simSetVehiclePose" to spawn the drone at certain position .It seems that the drone cannot reach to given pose after the function was called.To evaluate this, I wrote a while loop to find out ,here's the code:
while True:
self.drone.simSetVehiclePose(pose, False, self.drone_name)
time.sleep(1)
s_now=self.drone.simGetVehiclePose(self.drone_name)
col =self.drone.simGetCollisionInfo(self.drone_name)
if col.has_collided:
break
if np.linalg.norm(s_now.position.to_numpy_array() - pose.position.to_numpy_array()) < 1.e-2 and \ np.linalg.norm(s_now.orientation.to_numpy_array() - pose.orientation.to_numpy_array()) < 1.e-2:
break
i += 1
print(i)
And it turns out that it takes serveral times to get drone to given pose.And here's my settings.json:
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"PhysicsEngineName": "ExternalPhysicsEngine",
"ClockSpeed":1,
"Vehicles": {
"Drone1": {
"VehicleType": "simpleflight",
}
Can anyone help with this issue? Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions