Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Mech Wheel Programing (http://www.chiefdelphi.com/forums/showthread.php?t=61482)

whlspacedude 12-01-2008 13:58

Mech Wheel Programing
 
This year we would like to try mech drive with 1 joystick. this joystick has x,y and z(twist) on the stick and t for speed.
i have no clue how to do mech programing and would really like some help with it .
we would like strafe with the x axis and turn with the z axis.
also we would like speed control with the t axis
how would we go about doing this in easyc?

kaszeta 14-01-2008 10:42

Re: Mech Wheel Programing
 
Quote:

Originally Posted by whlspacedude (Post 676154)
This year we would like to try mech drive with 1 joystick. this joystick has x,y and z(twist) on the stick and t for speed.
i have no clue how to do mech programing and would really like some help with it .
we would like strafe with the x axis and turn with the z axis.
also we would like speed control with the t axis
how would we go about doing this in easyc?

While it's not easyC, check here: http://www.chiefdelphi.com/forums/sh...m+drive+co de

The basic idea for either an omnidirection or mechanum drive train, each wheel will have a certain speed that it needs to be driven to contribute to the desired combination of f/b motion, strafing, and turning. You calculate these for each wheel, and sum them up.

Code:

fr_pwm = speed-turn+strafe;
fl_pwm = speed+turn-strafe;
br_pwm = speed-turn-strafe;
bl_pwm = speed+turn+strafe;

You may have to reverse some of these due to how your motors are installed, and you would be best to do a lot of bounds checking and be careful with variable types to make sure you don't have wraparound errrors.

RyanW 14-01-2008 12:47

Re: Mech Wheel Programing
 
What Kaszeta said is correct; however, our team decided we also wanted to scale the values. What we came up with was to take the initial inputs, change the range to (-127)-(127), add them together, then scale the sum by a factor:

The factor = Max ( |speed|, |turn|, |strafe|) / (|speed| + |turn| + |strafe|)

We used this code last year, and it seemed to work pretty well.

whlspacedude 14-01-2008 15:43

Re: Mech Wheel Programing
 
Being new to "real' C programing (have a knowledge of BASIC) I really would like to have a .ecp file to look at. thanks for the other links!

kaszeta 14-01-2008 15:57

Re: Mech Wheel Programing
 
Quote:

Originally Posted by whlspacedude (Post 677718)
Being new to "real' C programing (have a knowledge of BASIC) I really would like to have a .ecp file to look at. thanks for the other links!

http://www.chiefdelphi.com/forums/sh...ad.php?t=51704 should take care of this.

Good luck.

whlspacedude 14-01-2008 15:58

Re: Mech Wheel Programing
 
THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


All times are GMT -5. The time now is 23:17.

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