uzh-rpg / rpg_time_optimal

Time-Optimal Planning for Quadrotor Waypoint Flight
GNU General Public License v3.0
69 stars 22 forks source link

[bug] The plotting program reported errors. #1

Open Africasss opened 1 year ago

Africasss commented 1 year ago

Thanks for reading my question. I have followed your instructions to run the optimization in the example and generate the .csv file. But I falsed to run plotting, And here is the error report ' Traceback (most recent call last): File "E:\zzg\pythonProject\rpg_time_optimal-main\src\trajectory.py", line 540, in load self.wp = wp.reshape(self.NW, 3).T ValueError: cannot reshape array of size 61634 into shape (20,3) '. What should I do, thank you for your answer.

kingwell-Liu commented 1 month ago

I have the same problem. It is because the "result_cpc_format.csv" file has some blank lines. You can bypass this issue by using "next(traj_reader)". You can modify the load function as follows:

def load(self, filename): ...... self.N = int(self.N) next(traj_reader) self.x = np.array(next(traj_reader)) next(traj_reader) wp = np.array(next(traj_reader)) self.wp = wp.reshape(self.NW, 3).T self.parse() return self