OCCRA
Go to Post I volunteered to be the person responsible for the electronics and raised my hand before realizing that I have had almost no electronics experience. I hope our robot turns out alright... - Blue_Mist [more]
Home
Go Back   Chief Delphi > Technical > Programming > WindRiver C++
CD-Events   CD-Media   CD-Spy   FRC-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 03-27-2012, 10:28 AM
Butter's Butter's is offline
Registered User
AKA: Joe Kent
FRC #0522 (Robo Wizards)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Staten Island, New York
Posts: 21
Butter's is an unknown quantity at this point
Adjust individual motor speed

Quick question. I've checked the library and I am unable to find a function that allows me to change an individual motor speed. I read some where that you can do this with Smart Dashboard but it's too late for us to implement that now. Also, I need to set these values is teleop.

Anyone know how do go about doing this?
Reply With Quote
  #2   Spotlight this post!  
Unread 03-27-2012, 11:20 AM
virtuald virtuald is offline
Registered User
AKA: Dustin Spicuzza
FRC #1418
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Northern Virginia
Posts: 513
virtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to behold
Re: Adjust individual motor speed

Create an object, call Set() on it.

Code:
// some global somewhere... 
Jaguar my_motor(2);

.. 

// in your main loop
my_motor.Set( 1.0 );  // full speed in one direction
my_motor.Set( -1.0 ); // full speed in another direction
However, I suspect that is not what you're asking. If you want to control the motor using some external input, then the easiest thing is just pass the value retrieved from a joystick.

Code:
// some global somewhere
Joystick stick;

... 

// in your main loop
my_motor.Set( stick.GetY() );
__________________
Co-maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables (NetworkTables for Python)

Team #1418: 2014 VA Regional: Finalists, #2 seed overall, Industrial Design Award; DC Regional: Finalists, #6 alliance captain
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


FRC Software Resources (including 2014 python code): http://www.virtualroadside.com/FRC/
WPILib Doxygen Repo: http://www.virtualroadside.com/WPILib/index.html
Reply With Quote
  #3   Spotlight this post!  
Unread 03-27-2012, 01:06 PM
Butter's Butter's is offline
Registered User
AKA: Joe Kent
FRC #0522 (Robo Wizards)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Staten Island, New York
Posts: 21
Butter's is an unknown quantity at this point
Re: Adjust individual motor speed

Quote:
Originally Posted by virtuald View Post
Create an object, call Set() on it.

Code:
// some global somewhere... 
Jaguar my_motor(2);

.. 

// in your main loop
my_motor.Set( 1.0 );  // full speed in one direction
my_motor.Set( -1.0 ); // full speed in another direction
However, I suspect that is not what you're asking. If you want to control the motor using some external input, then the easiest thing is just pass the value retrieved from a joystick.

Code:
// some global somewhere
Joystick stick;

... 

// in your main loop
my_motor.Set( stick.GetY() );

Thank you so much! I actually needed the first one. Our robot has a slight curve so I wanted to make one robot have a little more power than the other (Not joystick based).

I'll go test out a few different values and tell you if it works out!

EDIT: The first method you gave us would move the robot, the second would just control it. Could I maybe make a function that would automatically (Time based) use the .Set method? It would only turn on if your driving with that stick.

Code:
public void fixCurve(bool x){
while(x == true){
wait(2.0);
rightmotor.Set(whateverTheNumberWouldBe);
}
(X is made true when the robot drives and false when they stop)

EDIT: My function would work but we need a formula to determine the speed so this itself doesn't cause a curve..... FUN!

Last edited by Butter's : 03-27-2012 at 01:28 PM.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-27-2012, 02:11 PM
virtuald virtuald is offline
Registered User
AKA: Dustin Spicuzza
FRC #1418
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Northern Virginia
Posts: 513
virtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to behold
Re: Adjust individual motor speed

Don't use Wait() to implement a timing delay. Use the timer class instead.
__________________
Co-maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables (NetworkTables for Python)

Team #1418: 2014 VA Regional: Finalists, #2 seed overall, Industrial Design Award; DC Regional: Finalists, #6 alliance captain
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


FRC Software Resources (including 2014 python code): http://www.virtualroadside.com/FRC/
WPILib Doxygen Repo: http://www.virtualroadside.com/WPILib/index.html
Reply With Quote
  #5   Spotlight this post!  
Unread 03-27-2012, 02:35 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 6,127
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: Adjust individual motor speed

Quote:
Originally Posted by Butter's View Post
Our robot has a slight curve so I wanted to make one robot [ed: motor?] have a little more power than the other
First and foremost, you want to determine if there is an alignment or friction problem in your drivetrain, or a resistance problem in your wiring, that is causing this. For example, see this post. If you find a problem, it is far better to correct it at the source.

Secondly, What kind of drivetrain do you have, and what is your driver interface? I ask because there may be better ways to compensate.


Reply With Quote
  #6   Spotlight this post!  
Unread 03-27-2012, 02:42 PM
Butter's Butter's is offline
Registered User
AKA: Joe Kent
FRC #0522 (Robo Wizards)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Staten Island, New York
Posts: 21
Butter's is an unknown quantity at this point
Re: Adjust individual motor speed

Quote:
Originally Posted by Ether View Post
First and foremost, you want to determine if there is an alignment or friction problem in your drivetrain, or a resistance problem in your wiring, that is causing this. For example, see this post. If you find a problem, it is far better to correct it at the source.

Secondly, What kind of drivetrain do you have, and what is your driver interface? I ask because there may be better ways to compensate.


I probably could answer your questions, however, I would rather talk to one of the team members on the build committee first before I throw out possibly incorrect information.
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 10:04 AM.

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


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