Go to Post So your gearbox failed, and your first course of action was to post about it CD? This is an interesting failure recovery plan. :) - JVN [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
  #1   Spotlight this post!  
Unread 01-02-2017, 13:41
Coach Seb's Avatar
Coach Seb Coach Seb is offline
Registered User
AKA: Sebastien Cournoyer
FRC #5860 (Full Metal Muskrats)
Team Role: Coach
 
Join Date: Sep 2015
Rookie Year: 2015
Location: Algonac, MI
Posts: 122
Coach Seb is an unknown quantity at this point
Java Arcade with 3 CIM Gearbox

Following this video...

https://youtu.be/WO-FAKuhpNs?list=PL...d2I4m8Z6gfm7YC

I have 3 CIM gearbox on each side... comment was made that i may need a y to connect 2 motor into 1 PWM port... i guess thats a limitation on the arcade class???

Since we are using Talon SRX with CAN bus, can i assume that i will just each motor separated in my RobotMap.java like this ?

public static final int
Drive_Left1 = 0,
Drive_Left2 = 1,
Drive_Left3 = 2,
Drive_Right1 = 3,
Drive_Right2 = 4,
Drive_Right3 = 5;
Reply With Quote
  #2   Spotlight this post!  
Unread 01-02-2017, 13:55
JonKiddy JonKiddy is offline
Programming Mentor (Java/C++)
FRC #4930 (Electric Mayhem)
Team Role: Mentor
 
Join Date: Jul 2014
Rookie Year: 2013
Location: Buffalo, NY
Posts: 11
JonKiddy is an unknown quantity at this point
Re: Java Arcade with 3 CIM Gearbox

Our team also uses a 3 CIM gearbox on both sides for our drive train. Look into a slave/master setup. A CANTalon object can be set to follow another CANTalon object.

http://www.ctr-electronics.com/downl...e%20Manual.pdf

Section 9.1.3

Also, I don't believe a y connector is legal (I could be mistaken).
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2017, 14:10
flemdogmillion's Avatar
flemdogmillion flemdogmillion is offline
Programmer, Builder, Driver...
FRC #3007
 
Join Date: Nov 2016
Rookie Year: 2015
Location: Minnesota
Posts: 146
flemdogmillion will become famous soon enoughflemdogmillion will become famous soon enough
Re: Java Arcade with 3 CIM Gearbox

Quote:
Originally Posted by JonKiddy View Post
Our team also uses a 3 CIM gearbox on both sides for our drive train. Look into a slave/master setup. A CANTalon object can be set to follow another CANTalon object.

http://www.ctr-electronics.com/downl...e%20Manual.pdf

Section 9.1.3

Also, I don't believe a y connector is legal (I could be mistaken).
PWM Y connectors are legal, a CAN master/slave setup is also legal. (comma splice, I know)

You need one motor controller for each CIM.
You need 6 motor controllers of the same type and settings.
If you go the PWM route, you will need a total of 4 PWM y connectors.
If you go the CAN route, you can simply daisy-chain all of them together, connecting one to the next, eventually connecting all 6 together in a line.

For CAN, unlike PWM, you need to set up your master/slave setup.

PWM is easier to work with in my opinion.

I hope all these snippets help.
__________________
Team 4506: 2015-2016
Team 3007: 2017

Jack of all trades except C++ & Java
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2017, 15:07
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 559
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: Java Arcade with 3 CIM Gearbox

We also have an example that might help....
https://github.com/CrossTheRoadElec/...bot/Robot.java
... basically slave the fifth and sixth talon outside of RobotDrive to the appropriate talons inside RobotDrive.

Quote:
PWM is easier to work with in my opinion.
I argue CANTalon is easier than PWM. If a CANTalon misbehaves you can use the web-based config to determine why - without adding telemetry to your robot code.

A PWM motor controller will provide little feedback as to why it's not doing what you want.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2017, 10:33
Coach Seb's Avatar
Coach Seb Coach Seb is offline
Registered User
AKA: Sebastien Cournoyer
FRC #5860 (Full Metal Muskrats)
Team Role: Coach
 
Join Date: Sep 2015
Rookie Year: 2015
Location: Algonac, MI
Posts: 122
Coach Seb is an unknown quantity at this point
Re: Java Arcade with 3 CIM Gearbox

Omar,

do i add these lines in my robot.java class? or to my robotmap.java class?

I am a little confused and very new to java...

I was trying to use Robotbuilder but gave up because the talon SRX are not available... since it feels that it has not been updated since 2013, i am assuming that some new sensors, actuators are missing and feel that i should just code from scratch and learn the hard way... (that's my french sticking....)

I am now trying to follow the WPILIB docs and this video

Wish i could find a resource that explain what the class are for.... These are my assumption... please correct if i am off....

robot.java --> main program, this is what call all other class/methods
robotmap.java --> where i define ports on Roborio, sensors, controller...
OI --> define my joystick and human interface...

I then create subsystem class in which i call the robotmap.java to get the hardware settings ....
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2017, 10:53
flemdogmillion's Avatar
flemdogmillion flemdogmillion is offline
Programmer, Builder, Driver...
FRC #3007
 
Join Date: Nov 2016
Rookie Year: 2015
Location: Minnesota
Posts: 146
flemdogmillion will become famous soon enoughflemdogmillion will become famous soon enough
Re: Java Arcade with 3 CIM Gearbox

Whether or not you use PWM, before you test the code, remove the motors from the gearbox in case one was wired or programmed in reverse polarity.
__________________
Team 4506: 2015-2016
Team 3007: 2017

Jack of all trades except C++ & Java
Reply With Quote
  #7   Spotlight this post!  
Unread 03-02-2017, 12:29
Coach Seb's Avatar
Coach Seb Coach Seb is offline
Registered User
AKA: Sebastien Cournoyer
FRC #5860 (Full Metal Muskrats)
Team Role: Coach
 
Join Date: Sep 2015
Rookie Year: 2015
Location: Algonac, MI
Posts: 122
Coach Seb is an unknown quantity at this point
Re: Java Arcade with 3 CIM Gearbox

so here is what i did.... Hopefully this make sense...

in my RobotMap.java....

Code:
public class RobotMap {
		
	public static CANTalon _frontLeftMotor = new CANTalon(11);  /* device IDs here (1 of 2) */		
	public static CANTalon _rearLeftMotor = new CANTalon(13);
	public static CANTalon _frontRightMotor = new CANTalon(14);
	public static CANTalon _rearRightMotor = new CANTalon(15);

	/* extra talons for six motor drives */
	public static CANTalon _leftSlave = new CANTalon(16);
	public static CANTalon _rightSlave = new CANTalon(17);
then in my DriveTrain_Subsystem class

Code:
private RobotDrive MainDrive = new RobotDrive(RobotMap._frontLeftMotor, RobotMap._rearLeftMotor, RobotMap._frontRightMotor, RobotMap._rearRightMotor);
I added the joystick line in my OI.java class

Code:
	Joystick _joy = new Joystick(0);
and finally, added the following to my Robot.java class... unfortunately it will not resolved the DriverJoystick .....

Code:
	public void teleopPeriodic() {
		Scheduler.getInstance().run();
		
    	double forward = DriverJoystick.getRawAxis(1); // logitech gampad left X, positive is forward
    	double turn = DriverJoystick.getRawAxis(2); //logitech gampad right X, positive means turn right
    	DriverJoystick.arcadeDrive(forward, turn);
	}
Any help would be appreciated... i think once i resolve how ot properly use the Talon SRX CAN then i can keep going... until then i am kinda stuck...
Reply With Quote
  #8   Spotlight this post!  
Unread 03-02-2017, 12:52
Waz Waz is offline
Strategy and programming mentor
AKA: Steve
FRC #2357 (System Meltdown)
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Raymore, MO
Posts: 20
Waz is an unknown quantity at this point
Re: Java Arcade with 3 CIM Gearbox

You should just use two motor controllers to create your RobotDrive, one for the left and one for the right, and not four. Then set up the other two left side motors as followers of the one left side motor you used to create RobotDrive. Do the same for the right side.

You do not show your code where you actually set up any motors to be followers. It is well documented in the manual that was linked in a prior post.

Edit: I am assuming here that all three motors on one side are on the same gearbox.

Hope this helps,
Steve
Reply With Quote
  #9   Spotlight this post!  
Unread 03-02-2017, 12:57
Coach Seb's Avatar
Coach Seb Coach Seb is offline
Registered User
AKA: Sebastien Cournoyer
FRC #5860 (Full Metal Muskrats)
Team Role: Coach
 
Join Date: Sep 2015
Rookie Year: 2015
Location: Algonac, MI
Posts: 122
Coach Seb is an unknown quantity at this point
Re: Java Arcade with 3 CIM Gearbox

do you have an example i could look at?

I though i did... see RobotMap.java up on previous post... i copied directly from Omar github.

Any help would be appreciated...
Reply With Quote
  #10   Spotlight this post!  
Unread 03-02-2017, 12:58
Coach Seb's Avatar
Coach Seb Coach Seb is offline
Registered User
AKA: Sebastien Cournoyer
FRC #5860 (Full Metal Muskrats)
Team Role: Coach
 
Join Date: Sep 2015
Rookie Year: 2015
Location: Algonac, MI
Posts: 122
Coach Seb is an unknown quantity at this point
Re: Java Arcade with 3 CIM Gearbox

yes... using 3 CIM vexpro with Talon SRX...
Reply With Quote
  #11   Spotlight this post!  
Unread 06-02-2017, 13:03
Waz Waz is offline
Strategy and programming mentor
AKA: Steve
FRC #2357 (System Meltdown)
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Raymore, MO
Posts: 20
Waz is an unknown quantity at this point
Re: Java Arcade with 3 CIM Gearbox

See section 9.1 here (http://www.ctr-electronics.com/downl...%20Manual.pdf).

It has the Java code to set up one follower/slave for a master Talon SRX. It is essentially this:
Code:
slaveMotor1.changeControlMode(CANTalon.ControlMode.Follower);
slaveMotor1.set(masterMotor.getDeviceID())
You will just need to set it up for two slaves on each side following the same master.
Code:
slaveMotor2.changeControlMode(CANTalon.ControlMode.Follower);
slaveMotor2.set(masterMotor.getDeviceID())
Then, just use your two masters (one left and one right) to create your RobotDrive object (it has a constructor that just takes one left and one right motor) and you have it.

I hope this helps,
Steve
Reply With Quote
  #12   Spotlight this post!  
Unread 06-02-2017, 17:29
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 559
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: Java Arcade with 3 CIM Gearbox

Quote:
Originally Posted by Coach Seb View Post
...
I was trying to use Robotbuilder but gave up because the talon SRX are not available....
The Talon SRX should be in RobotBuilder. Can you confirm this?

Picture attached.
Attached Thumbnails
Click image for larger version

Name:	TalonRobotBuilder.png
Views:	25
Size:	177.1 KB
ID:	21733  
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 04:11.

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