wpilibsuite / PathWeaver

Desktop application for generating motion paths
Other
64 stars 68 forks source link

A question about drawing a trajectory in PathWeaver #265

Closed mendax1234 closed 2 years ago

mendax1234 commented 2 years ago

Describe the question you have. A clear and concise description of what you want clarification on.

image

Describe the reason for your confusion. A clear and concise description of why the question requires clarification and what's confusing.

Is your question related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

image

Additional context Add any other context or screenshots about the question here.

jasondaming commented 2 years ago

PathWeaver is designed for differential drive. I have not personally used it for swerve but I know others have.

So, my question is how to drive a trajectory for a swerve. For example , if l want to draw a bounce path. l should draw like below?

I think instead of one continuous path you would want to separate it into multiple paths. This would allow the point turn that I think you want instead of a rounded turn (not sure how big the rounding would be in practice probably depends on your swerve) which is what I think you would get now.

Besides, how can l control the head of my robot?

I don't think we can answer this without more information about how your robot is coded and what you are trying to do.

First , what is the whole length of such the whole field. For instance, just take the picture above as an example . What is the length between the start zone and the finish zone?

The length of the field is whatever is setup for the field image you are using. Here is the article on setting up a custom field image you can see the length is specified. In the case above the field is the 2021 at-home challenges (see 2.4.4) which are 15' by 30'

Second, is this trajectory the same with the waypoint like the example code below

You copied the example in the trajectory tutorial. That is for manually specifying the waypoints. To use PathWeaver you would import the trajectory generated by PathWeaver

For example, how is the 8.5 got using the P and D value from the characterization tool.

I actually opened an issue for this problem a while back. Unfortunately since the characterization tool is being replaced with the new SysID tool there hasn't been a lot of interest in updating this.

At last , l wonder how to deploy the robot code in charavterization tool if l only can connect to the robot wifi. (l cannot connect to the Internet and RoboRio at the same time)

I don't understand what wifi has to do with it. The characterization tool doesn't need wifi. The tool even has "deploy project" built in.

jasondaming commented 2 years ago

Did this make sense? Do you have additional questions?

mendax1234 commented 2 years ago

Sorry for replying so late since l have had a test recently.

I think instead of one continuous path you would want to separate it into multiple paths.

But , how many paths should l seperate it ? Is there any requirements? Or , it just depend on my mood?

jasondaming commented 2 years ago

I suggest you create a new path every time there is a discontinuity (in this case a change in direction). Here is what our path for bounce looked like (this is for a tank drive so we needed to also set the reversed flag). image

mendax1234 commented 2 years ago

I suggest you create a new path every time there is a discontinuity (in this case a change in direction). Here is what our path for bounce looked like (this is for a tank drive so we needed to also set the reversed flag).

Sorry for replying so late , since l have been really busy recently.

So, l have an idea that l can modify each picture's .json file to adjust the unit of its total length? Is that right? Besides , What does imaginary line mean and how to draw it ?

Any help is appreciated!

mendax1234 commented 2 years ago

image

image

l have recently run into this error. l didn't run into it before . And l have changed nothing. What's the matter?

PeterJohnson commented 2 years ago

What version of WPILib is this with?

jasondaming commented 2 years ago

What do you mean by "imaginary line"?

You are looking to modify the field image, why do you want to do that?

mendax1234 commented 2 years ago

What version of WPILib is this with?

2021.2.2

mendax1234 commented 2 years ago

What do you mean by "imaginary line"?

You are looking to modify the field image, why do you want to do that?

image

Maybe this.

mendax1234 commented 2 years ago

What version of WPILib is this with?

Do l need to reinstall the WPILIB?

jasondaming commented 2 years ago

There are multiple lines in that picture which are you referring to?

I think a reinstall of WPILib is premature. Do you have the code that is producing the error posted?

mendax1234 commented 2 years ago

There are multiple lines in that picture which are you referring to?

The middle one.

And the code is here.

It seems that l can't upload the .zip

jasondaming commented 2 years ago

Can you upload it to its own github repo?

I still don't understand which line.

The blue lines control the curvature at each waypoint.

The dashed brown line indicates the robot going in reverse.

The green line is the robot going forward.

The grey lines are a part of the field used for dimensioning.

mendax1234 commented 2 years ago

https://drive.google.com/drive/folders/1bxUQdVRSHk7u520lgSHRIQUH8AO2XTIZ

mendax1234 commented 2 years ago

Can it now been seen?

jasondaming commented 2 years ago

In the future please use Github to post code as it is much easier for us to look at.

You mentioned above that you were modifying the .json files. How are you modifying them? Why are you modifying them? Does it load fine with an unmodified file?

mendax1234 commented 2 years ago

In the future please use Github to post code as it is much easier for us to look at.

Since the repository is now private , l will public it maybe next year when the 2022 season is over. Sorry for that.

You mentioned above that you were modifying the .json files. How are you modifying them? Why are you modifying them? Does it load fine with an unmodified file?

l have found that the problem is in the photonlib.json. Since l can't install photonlib from online . So l download it directly and copy it to the venderdeps. However , it seems that the code built well , but the auto can't work . So l copy another photonlib.json which l have successfully downloaded with WPILIB 2021.3.1 in May to the venderdeps and now it works well , nothing goes wrong.

jasondaming commented 2 years ago

frc-characterization is/was deprecated. We have replaced it with SysID which is much more user friendly. I am not sure exactly what you are looking to tune for your swerve but it should help.

mendax1234 commented 2 years ago

Can l use it now? Or do l need to wait until the 2022 version is launched?

jasondaming commented 2 years ago

Yes it is fully functional now and will ship as part of the 2022 season. You can use it now via either the instructions linked or as part of the FRC beta testing!

mendax1234 commented 2 years ago

Hello , l have run into a problem recently. We draw a straight line in Pathweaver and load it successfully. However , when l enable the autonomous mode , the swerve will rotate but l don't let it rotate . It's strange.

image

jasondaming commented 2 years ago

Lets keep issues separate so they are trackable instead of just keep adding onto this issue.

I don't understand what "the swerve will rotate but l don't let it rotate" means. Before using PathWeaver you should be verifying that you can run simple trajectories like this one, have you done that?

mendax1234 commented 2 years ago

Lets keep issues separate so they are trackable instead of just keep adding onto this issue.

I don't understand what "the swerve will rotate but l don't let it rotate" means. Before using PathWeaver you should be verifying that you can run simple trajectories like this one, have you done that?

l have tested it . l don't change any parameters , and draw 3 trajectories. It seems that it works well (But does it mean that l don't need to test the parameters?) . However , when it finished one trajectory, it will stop suddenly and then go another trajectory. I would like it to be continuous. Should l draw it in one trajectory?