segmentation fault while Storage::getData after SO

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mary K
Posts: 37
Joined: Mon Feb 24, 2014 9:15 am

segmentation fault while Storage::getData after SO

Post by Mary K » Sat Jun 04, 2016 7:49 am

Hello,
after implementing Static Optimization and trying to store activations to a vector, I get "Segmentation fault".

Here is the loop where I get this error:

Code: Select all

    vector<Vector> acts;                        // activations
    Storage *as = so.getActivationStorage();
    int na = model.getActuators().getSize();
    acts.resize(states.getSize());

    // Store activations to out vector
    for (int row = 0; row<states.getSize(); row++)
        for (int i = 0; i<na; i++)
            as->getData(row, i, acts[i]);     
I noticed that it runs the first loop without error (row=0 and i=0) and in second loop (row=0 and i=1) i get the Segmentation fault.

Any ideas?

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: segmentation fault while Storage::getData after SO

Post by jimmy d » Wed Jun 08, 2016 5:13 pm

are you sure you have the dimension of the matrix correct?

POST REPLY