Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Swerve path and motor trajectory generator? (http://www.chiefdelphi.com/forums/showthread.php?t=137317)

Bernini 22-05-2015 16:46

Swerve path and motor trajectory generator?
 
Does a path planner exist for swerve given way points x y and heading?

EmileH 22-05-2015 21:07

Re: Swerve path and motor trajectory generator?
 
I think you could benefit greatly from Ether's swerve kinematics and programming documents. Look for the excel spreadsheet. All you need to give is a Joystick Y(up/down), X(left/right strafe), Z (Rotation) and Gyro Angle and it visualizes the angle and speed of 4 swerve wheels.

There is also a paper on how to write these algorithms into the programming language of your choice.

Hope this helps.

SoftwareBug2.0 22-05-2015 21:52

Re: Swerve path and motor trajectory generator?
 
Quote:

Originally Posted by emileh3467 (Post 1483720)
I think you could benefit greatly from Ether's swerve kinematics and programming documents. Look for the excel spreadsheet. All you need to give is a Joystick Y(up/down), X(left/right strafe), Z (Rotation) and Gyro Angle and it visualizes the angle and speed of 4 swerve wheels.

There is also a paper on how to write these algorithms into the programming language of your choice.

Hope this helps.

I think what he's looking for is something that will generate a sequence of angles and powers to do over time not just a single setting to choose. Interestingly, I have written such a thing for some restricted cases but was more of an exploratory exercise and didn't actually make it onto a robot.

To illustrate the difference between these two things, suppose what you want to do is go left. Ether's spreadsheet will tell you to turn all the wheels should face left and the power should be 100%. If you want to actually make trajectories what you would have is the sequence of "first turn wheels so they face left, second then turn power on for 1 ft.". Incidentally, this is not the fastest way to get to a given x,y coordinate unless you're already facing that direction.

Gdeaver 22-05-2015 23:22

Re: Swerve path and motor trajectory generator?
 
I assume that you have a functioning swerve chassis. Before you start on figuring out path planning, can your robot drive straight. If you command it to drive 20 ft straight ahead can your current platform do it? With perfect alignment and say 10 or more test can your robot go perfectly straight every time? What is the error spot. If your swerve can't drive straight then your not ready to tackle path planning. We have found that for autonomous navigation with our swerve required the minimum of adding the kit of parts gyro and a PID control loop to drive straight. This year we used the Navx MXP. We have encoders on all wheels to measure wheel rotation (distance). Are you to this point yet? If not you have allot of work ahead.

Bernini 23-05-2015 00:59

Re: Swerve path and motor trajectory generator?
 
I have a functioning swerve chassis that I can program to do anything I want really with great accuracy with encoders (for wheel angle and wheel rotations), as well as a gyro. I can set it to go x feet forward and end at a certain angle and it will do that in the amount of time that I specified thanks to @faust1706's neural network library. I'm looking for a swerve implementation of 254's waypoint navigation using splines:

http://www.chiefdelphi.com/forums/sh...=path+planning

I am looking for the same thing, except with swerve, that takes waypoints x y and heading and will traverse the path in a specified t time.

faust1706 23-05-2015 01:24

Re: Swerve path and motor trajectory generator?
 
Quote:

Originally Posted by Bernini (Post 1483747)
.... thanks to @faust1706's neural network library. ...

:D It's been a pleasure working with you.

I actually have exactly what you are looking for, verbatim actually...It is entirely untested, however.

https://github.com/faust1706/Smooth-Swerve

Bernini 23-05-2015 13:47

Re: Swerve path and motor trajectory generator?
 
I should have just asked you, it seems that you always have exactly what I am looking for or know exactly where to find it. I'll try to get this on the robot as soon as I can.

AlexanderTheOK 23-05-2015 20:23

Re: Swerve path and motor trajectory generator?
 
Quote:

Originally Posted by faust1706 (Post 1483752)
:D It's been a pleasure working with you.

I actually have exactly what you are looking for, verbatim actually...It is entirely untested, however.

https://github.com/faust1706/Smooth-Swerve

I'm sorry but what exactly is the implementation of this? As far as I understood, the original point of 254's spline based navigation was to give a robot that couldn't strafe an option for getting to a very specific point and orientation. With a swerve you can just give it points to get to and (as long as you have done due diligence and implemented dynamic acceleration limiting in your code) it should drive smoothly, at least it did for us. What kind of situations are you foreseeing where a holonomic robot would actually need to follow a defined curve rather than just a set of waypoints?

Pault 23-05-2015 22:03

Re: Swerve path and motor trajectory generator?
 
Quote:

Originally Posted by AlexanderTheOK (Post 1483839)
I'm sorry but what exactly is the implementation of this? As far as I understood, the original point of 254's spline based navigation was to give a robot that couldn't strafe an option for getting to a very specific point and orientation. With a swerve you can just give it points to get to and (as long as you have done due diligence and implemented dynamic acceleration limiting in your code) it should drive smoothly, at least it did for us. What kind of situations are you foreseeing where a holonomic robot would actually need to follow a defined curve rather than just a set of waypoints?

I don't know about the OP, but the reason I have considered doing this is for avoiding objects rather than trying to drive into them (i.e. the cans for a 20pt autonomous, or even other robots if you have a way to detect them and can run the path generator in real-time).

Bernini 23-05-2015 22:24

Re: Swerve path and motor trajectory generator?
 
Quote:

Originally Posted by AlexanderTheOK (Post 1483839)
I'm sorry but what exactly is the implementation of this?

One quick implementation of this is picking up objects on the fly. If you know where an object is with respect to the field, then you can drive to it, while driving to it, orientate your robot to quickly pick it up, have a passive grabber grab it, have your robot then proceed to go to a scoring position, then score, all in one fluid motion.

Jared Russell 24-05-2015 01:27

Re: Swerve path and motor trajectory generator?
 
Quote:

Originally Posted by Bernini (Post 1483684)
Does a path planner exist for swerve given way points x y and heading?

For a truly holonomic robot, you can generate three separate 1D trajectories for x, y, and heading and have the robot follow them. Many existing pieces of public code, including the 254 libraries, would be appropriate for this task.

faust1706 24-05-2015 03:05

Re: Swerve path and motor trajectory generator?
 
https://www.youtube.com/watch?v=KsF0...ature=youtu.be

Here's a video of a "robot" "simulation" that a programmer on team 2046 did of the program.

Bernini 25-05-2015 16:29

Re: Swerve path and motor trajectory generator?
 
I guess I should post an update: @faust1706's code works perfectly on a robot if you have the ability to go n encoder counts in t seconds, which I do with his neural network program that I trained to do just that.

teku14 25-05-2015 21:13

Re: Swerve path and motor trajectory generator?
 
How do I run a simulation using the code on my laptop like the video above?

faust1706 25-05-2015 21:55

Re: Swerve path and motor trajectory generator?
 
You can get the latest code from here: https://github.com/faust1706/Smooth-Swerve

The simulation is what this code displays as of right now, but that can be changed. To alter the simulation, change the waypoints to whatever and however many you want. Make sure the heading variable is of the same size as the waypoints array size, otherwise the program will get an outofbounds error.

I have not rigorously tested this code, so feel free to try to break it. If you do break it, either by making it generate an incorrect path or something, then leave a comment here or make it an issue on the repo's page.

The simulation is also completely smooth now thanks to the programmer on 2046.


All times are GMT -5. The time now is 01:40.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi