Go to Post Our robot attacked our programmer autonomously. - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-02-2014, 10:16 AM
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 608
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Kaj Drive in c++?

I've seen quite a bit of posts talking about 2 stick arcade drive or kaj drive. With this method, 1 stick controls the rotation of the robot, and the other controls the throttle of the robot *or thumb pads in the case of a controller* . I'm not sure how to implement this in c++ and would love some help setting this up.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-02-2014, 11:37 AM
ekovacs ekovacs is offline
Registered User
AKA: Evan Kovacs
FRC #2539
Team Role: College Student
 
Join Date: Dec 2012
Rookie Year: 2011
Location: Palmyra, PA
Posts: 21
ekovacs is on a distinguished road
Re: Kaj Drive in c++?

This is what my team has done for the last few years now. It can be done with one line of code that is built in to the RobotDrive class in wpilib.

Code:
yourRobotDriveobject.ArcadeDrive(joystick.getRawAxis(forwardaxis), joystick.getRawAxis(rotateaxis));
Reply With Quote
  #3   Spotlight this post!  
Unread 07-02-2014, 12:00 PM
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 608
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Re: Kaj Drive in c++?

While that method should work for a single joystick, it doesn't appear to work if using 2 stick arcade or Kaj drive. Any idea if changing arcade drive in the robotdrive header file could fix this?
Reply With Quote
  #4   Spotlight this post!  
Unread 07-02-2014, 12:11 PM
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 598
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
Re: Kaj Drive in c++?

I think this is roughly what you're looking for

Code:
float speed = throttleStick->GetY();
float turn = turnStick->GetX();
float leftSpeed = speed + turn;
float rightSpeed = speed - turn;
//output speed to motors
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
Reply With Quote
  #5   Spotlight this post!  
Unread 07-02-2014, 12:24 PM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,547
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Kaj Drive in c++?

Quote:
Originally Posted by ekovacs View Post
This is what my team has done for the last few years now. It can be done with one line of code that is built in to the RobotDrive class in wpilib.

Code:
yourRobotDriveobject.ArcadeDrive(joystick.getRawAxis(forwardaxis), joystick.getRawAxis(rotateaxis));
Quote:
Originally Posted by thatprogrammer View Post
While that method should work for a single joystick, it doesn't appear to work if using 2 stick arcade or Kaj drive. Any idea if changing arcade drive in the robotdrive header file could fix this?
ekovacs example above is using the following form of ArcadeDrive.
Code:
void ArcadeDrive(float moveValue, float rotateValue, bool squaredInputs = true);
It doesn't matter where the moveValue and rotateValue come from. You could read from a second joystick, or a sensor, or anything else.
Reply With Quote
  #6   Spotlight this post!  
Unread 07-02-2014, 12:56 PM
ekovacs ekovacs is offline
Registered User
AKA: Evan Kovacs
FRC #2539
Team Role: College Student
 
Join Date: Dec 2012
Rookie Year: 2011
Location: Palmyra, PA
Posts: 21
ekovacs is on a distinguished road
Re: Kaj Drive in c++?

Quote:
Originally Posted by Joe Ross View Post
ekovacs example above is using the following form of ArcadeDrive.
Code:
void ArcadeDrive(float moveValue, float rotateValue, bool squaredInputs = true);
It doesn't matter where the moveValue and rotateValue come from. You could read from a second joystick, or a sensor, or anything else.
This is the form that we used, with the moveValue coming from a the left thumb stick/dpad on a controller and the rotateValue coming from the right thumb stick. But as Joe said, the values can come from anywhere.
Reply With Quote
  #7   Spotlight this post!  
Unread 07-02-2014, 02:26 PM
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 608
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Re: Kaj Drive in c++?

Thanks for all the help! I won't be able to work on the robot until monday, but when I do, you can bet I'll implement this!
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 09:16 AM.

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