Go to Post [Pi day] is an irrational holiday - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 02-02-2015, 14:09
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Inverting Axis

Quote:
Originally Posted by GeeTwo View Post
For an example where the simpler code is not easier to read:

Logically, you want to do a conditional:

if (c is between a and b, and you don't know whether a is larger or smaller than b) then...

Human simpler (use this!):

if ((a<b) && (b<c) || (a>b) && (b>c)) then..

Probably machine quicker, but don't use:

if ((a-b)*(b-c) > 0) then..
Either your code is wrong, or your prose description is.

I guess neither is simpler.


Reply With Quote
  #17   Spotlight this post!  
Unread 02-02-2015, 16:01
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,687
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Inverting Axis

I swapped b and c between the two. Let's correct the prose. I meant to say that b was between a and c, and you didn't know whether a or c were larger.
Reply With Quote
  #18   Spotlight this post!  
Unread 03-02-2015, 16:44
2386programming 2386programming is offline
Registered User
FRC #2386 (Trojans)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Burlington
Posts: 34
2386programming is an unknown quantity at this point
Re: Inverting Axis

Code:
 double strafe = mainStick.getRawAxis(3);
         double forward = mainStick.getRawAxis(1);
         double rotation = mainStick.getRawAxis(2);


//mecanum algotrithms
        double mFL = strafe + forward + rotation;
        double mFR = strafe + forward - rotation;
        double mRL = strafe - forward + rotation;
        double mRR = strafe - forward - rotation;

        FL.set(mFL);
        FR.set(mFR);
        RL.set(mRL);
        RR.set(mRR);

This is my code for regular driving for mecanum but I feel that if I inverted the motot not everything else would be the same.
Reply With Quote
  #19   Spotlight this post!  
Unread 03-02-2015, 17:31
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Inverting Axis

Quote:
Originally Posted by 2386programming View Post

Code:


        double mFL = strafe + forward + rotation;
        double mFR = strafe + forward - rotation;
        double mRL = strafe - forward + rotation;
        double mRR = strafe - forward - rotation;

This is my code for regular driving for mecanum but I feel that if I inverted the motor not everything else would be the same.
The correct inverse kinematics for mecanum is:
Code:


double mFL = forward - strafeRight  - rotateClockwise;
double mFR = forward + strafeRight  + rotateClockwise;
double mRL = forward - strafeRight  + rotateClockwise;
double mRR = forward + strafeRight  - rotateClockwise;
If the above doesn't work, it's better to do the necessary motor inverting/swapping to make it work, rather than changing the signs of the kinematics.


Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:16.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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