Upgrading Existing APIs#
There have been several API changes in AutonomySim
v1.2 that we hope removes inconsistency, adds future extensibility and presents cleaner interface. Many of these changes are however breaking changes, which means that you will need to modify your client code that communicates with AutonomySim
.
A Faster Way#
While most changes you need to do in your client code are fairly easy, a faster way is to simply take a look at the example code, such as Hello Droneor Hello Car, to gain an understanding of the changes.
Importing AutonomySim
#
Instead of this:
use this:Above assumes you have installed AutonomySim module using,
If you are running you code from PythonClient folder in repo then you can also do this:
Here setup_path.py should exist in your folder and it will set the path of AutonomySim
package in PythonClient
repo folder. All examples in PythonClient folder uses this method.
Using AutonomySim Classes#
As we have everything now in package, you will need to use explicit namespace for AutonomySim classes like shown below.
Instead of this:
use this:
AutonomySim Types#
We have moved all types in AutonomySim
namespace.
Instead of this:
use this:
Getting Images#
Nothing new below, it's just combination of above. Note that all APIs that previously took camera_id
, now takes camera_name
instead. You can take a look at available cameras here.
Instead of this:
use this:
Utility Methods#
In earlier version, we provided several utility methods as part of AutonomySimClientBase
. These methods are now moved to AutonomySim
namespace for more pythonic interface.
Instead of this:
use this:
Camera Names#
AutonomySim now uses names to reference cameras instead of index numbers. However to retain backward compatibility, these names are aliased with old index numbers as string.
Instead of this:
use this:
Async Methods#
For multirotors, AutonomySim had various methods such as takeoff
or moveByVelocityZ
that would take long time to complete. All of such methods are now renamed by adding the suffix Async as shown below.
Instead of this:
use this:
Here .join()
is a call on Python's Future
class to wait for the async call to complete. You can also choose to do some other computation instead while the call is in progress.
Simulation-Only Methods#
Now we have clear distinction between methods that are only available in simulation from the ones that may be available on actual vehicle. The simulation only methods are prefixed with sim
as shown below.
getCollisionInfo() is renamed to simGetCollisionInfo()
getCameraInfo() is renamed to simGetCameraInfo()
setCameraOrientation() is renamed to simSetCameraOrientation()
State Information#
Previously CarState
mixed simulation-only information like kinematics_true
. Moving forward, CarState
will only contain information that can be obtained in real world.
use this: