Skip to content

Segfault when trying to save a trajectory in CSV or raw format #37

@vampjaz

Description

@vampjaz

Trying to make code that saves the trajectory to a file and then reads from that file as a cache. I discovered that the Pathfinder.writeToFile and Pathfinder.writeToCSV methods both cause a segfault during the call to the C++ library. This is running on the roboRio. Here is the crash log.

The path generated just fine, but after, when we try to save it, it crashes.

		Waypoint[] points = new Waypoint[] {
			new Waypoint(-4, -1, Pathfinder.d2r(-45)),
			new Waypoint(-2, -2, 0),
			new Waypoint(0, 0, 0) 
		};

		Trajectory.Config config = 
				new Trajectory.Config(
						Trajectory.FitMethod.HERMITE_CUBIC, 
						Trajectory.Config.SAMPLES_HIGH, 
						0.05, 
						RobotMap.MAX_VELOCITY, 
						2.0, 
						60.0);
		
		File saveFile = new File(RobotMap.TRAJECTORY_CACHE);
		if(saveFile.exists() && !saveFile.isDirectory()) {
			log.add("trajectory file already found, usng cached paths", LOG_LEVEL);
			trajectory = Pathfinder.readFromFile(saveFile);
		} else {
			log.add("trajectory file not found, generating new path", LOG_LEVEL);
			trajectory = Pathfinder.generate(points, config);
			log.add("saving path to cache", LOG_LEVEL);
			Pathfinder.writeToFile(saveFile,trajectory);
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions