JaciBrunning / Pathfinder

Cross-Platform, Multi-Use Motion Profiling and Trajectory Generation
MIT License
255 stars 78 forks source link

Seg fault when loading trajectories. #13

Closed icecube45 closed 7 years ago

icecube45 commented 7 years ago

Hello again, everything is working flawlessly in the c++ version, except loading of trajectories. I've tried loading both a csv and binary file, and each time, once pathfinder_deserialize (or pathfinder_deserialize_csv) is called, a segmentation fault occurs. This happens with the example code provided as well.

Any help would be appreciated for solving this issue

gbear605 commented 7 years ago

I also experience this with the Java version. On Sun, Feb 26, 2017 at 02:24 Cole Brinsfield notifications@github.com wrote:

Hello again, everything is working flawlessly in the c++ version, except loading of trajectories. I've tried loading both a csv and binary file, and each time, once pathfinder_deserialize (or pathfinder_deserialize_csv) is called, a segmentation fault occurs. This happens with the example code provided as well.

Any help would be appreciated for solving this issue

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JacisNonsense/Pathfinder/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqKHPQvyvXMoR2mm5cU1KLO854lz2Swks5rgSi2gaJpZM4MMR_G .

JaciBrunning commented 7 years ago

Can you send me the generated .csv file? A gist will do.

icecube45 commented 7 years ago

https://gist.github.com/icecube45/9b0d92e1c36b05a0c0b9fffd9c098245

JaciBrunning commented 7 years ago

@icecube45, What waypoints are you generating the trajectory with?

icecube45 commented 7 years ago

@JacisNonsense This was generated with the points of {15,0,0}, {69.32,49.26,0}, {127,14.07,util::d2r(-60)}

And a swerve modifier with a 20in square for the wheelbase

icecube45 commented 7 years ago

@JacisNonsense I've found my issue - I was under allocating the trajectory for loading into.

JaciBrunning commented 7 years ago

@icecube45 ahh, that'd do it. I'm glad you found your issue, I was just about to say I couldn't reproduce it.

icecube45 commented 7 years ago

@JacisNonsense this might be worthwhile to put in the documentation - I'm going to have to play with it a bit more as on the roboRio itself the issue persists, whereas underallocation solved it in my testing environment. Perhaps I'm allocating too large now, I might need to reduce my samples.

JaciBrunning commented 7 years ago

The number of points you need to allocate depends on a lot of different factors. Typically, instead of calling malloc(), I will instead use a static array to hold the generated points, e.g. static Segment mySegs[1024]. As for overallocation, this depends on your platform, and what memory space is available on the system.