my team and I are trying to implement path following for a differential robot, when I run the command with a trajectory of 1 meter, it travels half,
I use navx as a gyroscope, the robot code is made according to the documentation
So if you set it for 1m, it only runs for ~0.5m? If you set it for 4m, does it run for ~2m? If so, you have some of your numbers off, either during characterization or in one of the constants that goes into Ramsete. Also possible that your units are wrong (i.e. using feet instead of meters) for one of those values.
yes, if pose2d takes in feet then most likely because of this?
Pose2d takes in whatever units you’re system used, which needs to be consistent, and should be meters
I have a getPoseMeter method in my code
I second this suggestion. It’s important to know whether it’s going halfway or stopping half a metre short.
Also, we could be of more help if you could post your code, say as a Github link.
Ramsete commands will look for the expected trajectory time in order to finish. It does not matter if your robot is actually at that position when the command finishes, it is all up to the trajectory time that had been calculated while generating the trajectory. I think the reason is most probably about the trajectory config, which will cause a miscalculation for the trajectory time.
Things to check:
- Does the odometry work in teleop? When you drive around, do you see the correct X, Y position and heading reflected by odometry?
- Do you have good PID control of your motor’s speeds? Ramsete basically tells your motors at which speed they should run, so try to verify if you can indeed get to the desired speeds
- Determine your maximum speed, and then create the trajectory with maybe half that to assert that the robot will be able to follow the trajectory
Finally, put it all together: Create trajectory, then ramsete command which gets trajectory and odometry, and tells the motors at which speeds to run. If all the separate building blocks work, the end result is likely OK.
You can display your current robot pose and the trajectory you are trying to follow on the Field2d widget on Glass and use that to see if the issue is in your Trajectory generation or Odometry code.
github repo. my teams use vmx-pi controller and titan.
i use wpilib 2020
public double getLeftSpeed() {
return (Constants.wheelRadius * Math.PI * leftMotor.getRPM()) / 60;
}
Circle circumference is 2*PI*radius
, so maybe this is reporting half the speed?
i will check this at monday
You should probably switch to 2022; it is better and includes new features that help with this. In addition, it is the only WPILib version that supports the latest RIO image.
I would love to but my controller does not support 2022
Your roboRIO doesn’t support 2022?
i use vmx-pi by studica
this maybe helped, but now it tries to turn on the correct course, even if the path is a line
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.