jacobaustin123 / Titan

A high-performance CUDA-based physics simulation sandbox for soft robotics and reinforcement learning.
https://jacobaustin123.github.io/Titan
Other
96 stars 21 forks source link

Bouncing example error #3

Closed TK-21st closed 5 years ago

TK-21st commented 5 years ago

Example gives main.cpp have the following issues

#include <Titan/sim.h>
int main () {
  // need to add: static Simulation sim;   
  sim.createCube(Vec(0, 0, 10), Vec(2, 2, 2)); // not defined, see error message below
  sim.createPlane(Vec(0, 0, 1), 0);
  sim.setBreakpoint(10.0);
  sim.start();

 // need to have a for loop here otherwise the graphics driver will be constantly shutting down
}

createCube not defined

main.cpp:6:45: error: no matching function for call to ‘Simulation::createCube(Vec, Vec)’                    │
   sim.createCube(Vec(0, 0, 10), Vec(2, 2, 2));  

sim.start() need to have a for-loop afterwards

otherwise I got this:

GPUassert: driver shutting down /home/tingkai/vcpkg/buildtrees/titan/src/420888144f-fb31a06eb3/src/sim.cu 1490
GPUassert: driver shutting down /home/tingkai/vcpkg/buildtrees/titan/src/420888144f-fb31a06eb3/src/sim.cu 1492
GPUassert: driver shutting down /home/tingkai/vcpkg/buildtrees/titan/src/420888144f-fb31a06eb3/src/sim.cu 1490
GPUassert: driver shutting down /home/tingkai/vcpkg/buildtrees/titan/src/420888144f-fb31a06eb3/src/sim.cu 1492
Breakpoint set for time 10 reached at simulation time 10.0001!
terminate called after throwing an instance of 'thrust::system::system_error'
  what():  get_max_shared_memory_per_block :failed to cudaGetDevice: driver shutting down
Aborted (core dumped)
jacobaustin123 commented 5 years ago

Hi. The wiki entry was incorrect. sim.createCube takes a Vec and an int, i.e. sim.createCube(const Vec & v, float length). The length controls the side lengths for all sides. I've fixed the documentation. As for the sim.start() error, does that happen immediately, or after the simulation has run for 10 seconds?

TK-21st commented 5 years ago

@ja3067 that sim.start() error happens immediately after it starts running. And the simulation is broken in the sense that I don't see a cube bouncing but only the green ground.

jacobaustin123 commented 5 years ago

@TK-21st Thank you! We'll fix the issue tomorrow.

jacobaustin123 commented 5 years ago

I think we have fixed these issues, except perhaps the for loop issue (which we were not able to reproduce). Can you try any of the examples in the wiki and let us know if you still have the issue? In particular, the sample code

#include <Titan/sim.h>

int main() {
  Simulation sim;
  sim.createLattice(Vec(0, 0, 10), Vec(5, 5, 5), 5, 5, 5); // create lattice with center at (0, 0, 10) and given dimensions
  sim.createPlane(Vec(0, 0, 1), 0); // create constraint plane
  sim.start();
}

works correctly for us. We think we've updated all the documentation to reflect the current API, but let us know if there are still issues you encounter. Thank you!

TK-21st commented 5 years ago

@ja3067 Latest patch removes the error for the example shown above. Thanks!