krishauser / Klampt

Kris' Locomotion and Manipulation Planning Toolkit
BSD 3-Clause "New" or "Revised" License
378 stars 96 forks source link

Issues with kinematicSimulate of sensors #84

Closed smeng9 closed 2 years ago

smeng9 commented 3 years ago
krishauser commented 3 years ago

The problem is that you are calling sim.updateWorld(), which modifies all of the state (configurations and velocities) of robots and objects in the world model to match the simulation. Since you aren't moving anything in the simulation, everything gets reset to the initial values.

What's happening is

  1. You initialize the simulator
  2. You set the robot model's configuration
  3. You simulate the image, which should be correctly updated
  4. You DONT advance the simulation (actually nothing is really driving the simulated robot anyway)
  5. You ask the simulation to update the world model, which then changes the robot's configuration back to what it was in step 0
  6. You ask for the sensor transform, and the robot is back to where it was at step 0, so it doesn't change.

The simple solution is to take out step 4.

As for the integer bounds checking, yes, that's generally something that should be done more often when reading from files. Would you like to volunteer to add those checks?

smeng9 commented 3 years ago

I see. Dropping the updateWorld works, Thank you. That means if we are running pure kinematicSimulation without a controller it does not have anything to do with the world.

I will create a patch for all these checks.

krishauser commented 3 years ago

Not quite. Kinematicsimulate has nothing to do with the simulator (except when the simulator modifies the world)

krishauser commented 2 years ago

Closed due to inactivity -- issue seems to be fixed.