GRID-playground icon indicating copy to clipboard operation
GRID-playground copied to clipboard

Issue with spawning objects.

Open tyler-naes opened this issue 10 months ago • 4 comments

I am trying to spawn a variety of objects in the environment but some of the object spawns are not working. In my simulation, I am using the agricultural drone in the "Blocks" environment

Below is the code I am trying to run to spawn the object "CVW_Forklift_Front". Nothing Spawns import airgen import time client = airgen.connect_airgen(robot_type="multirotor") gps_data = client.getGpsData() print("Current GPS:", gps_data) pose = client.simGetVehiclePose() print("Vehicle Pose:", pose) pose.position.x_val -= -10 pose.position.y_val -= 5 scale = airgen.Vector3r(1,1,1) object_type = "CVW_Forklift_Front" client.simSpawnObject("Forklift", object_type, pose, scale, physics_enabled=False) time.sleep(3.0) client.simDestroyObject("Forklift")

But it does work for "Cube" import airgen import time client = airgen.connect_airgen(robot_type="multirotor") gps_data = client.getGpsData() print("Current GPS:", gps_data) pose = client.simGetVehiclePose() print("Vehicle Pose:", pose) pose.position.x_val -= -10 pose.position.y_val -= 5 scale = airgen.Vector3r(1,1,1) object_type = "Cube" client.simSpawnObject("Cube_new", object_type, pose, scale, physics_enabled=False) time.sleep(3.0) client.simDestroyObject("Cube_new")

When I try to spawn "SM_OakTree", the simulation crashes. import airgen import time client = airgen.connect_airgen(robot_type="multirotor") gps_data = client.getGpsData() print("Current GPS:", gps_data) pose = client.simGetVehiclePose() print("Vehicle Pose:", pose) pose.position.x_val -= -10 pose.position.y_val -= 5 scale = airgen.Vector3r(1,1,1) object_type = "SM_OakTree" client.simSpawnObject("SM_OakTree_new", object_type, pose, scale, physics_enabled=False) time.sleep(3.0) client.simDestroyObject("SM_OakTree_new")

Am I doing something wrong?

tyler-naes avatar Jan 31 '25 19:01 tyler-naes

Hi, related question, how did you login? I followed the steps

conda create -n airgen python=3.11
conda activate airgen
pip install airgen

and get

(grid) robins@gpu04:~/git/grid_sim/airgen-samples$ python 01_hello_drone.py 
WARNING:msgpackrpc.tornado.general:Connect error on fd 6: ECONNREFUSED
WARNING:msgpackrpc.tornado.general:Connect error on fd 6: ECONNREFUSED

Thanks

robin271828 avatar Feb 01 '25 20:02 robin271828

@RobinSchmid7 The platform being discussed can be accessed at grid.scaledfoundations.ai. Local setup/access for the platform is available through GRID Enterprise.

@tyler-naes Where is the source of these objects you're trying to spawn? Did you get that name from simListAssets? Not all assets displayed in that list are 'spawnable', for instance some might be physics assets as well which are invisible. (Although SM_OakTree does sound like a static mesh that should be spawned.)

saihv avatar Feb 05 '25 06:02 saihv

@saihv, yes we extracted the list of objects using simListAssets(). It makes sense now that not all objects are spawnable but it would be nice to know which objects are spawnable. Are you able to provide a list of objects that are spawnable? And yeah the SM_OakTree seems like it should be spawnable but it just crashes the simulation every time we try to spawn it.

Additional Question: We are seeing an issue where all of the "cubes" that we are trying to spawn are not spawning. For example, we try to spawn 10 cubes in various locations but only 5 of them actually spawn. Do you have any insight on why this is happening? We can provide our code if it would be useful for diagnosing the issue.

tyler-naes avatar Feb 05 '25 19:02 tyler-naes

Hi @saihv, I thought I'd ping you to see if you have an update regarding my last comment. Essentially, I just need to know which objects in Open GRID are currently spawnable.

tyler-naes avatar Feb 25 '25 20:02 tyler-naes