Go to Post Teams should spend more time talking about how to avoid penalties during their strategy sessions. - Rob [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 02-08-2010, 03:49 PM
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
void RobotDrive::SetLeftRightMotorSpeeds?

Hi all-

Our robot drive-train is consisting of a total of 6 motors, meaning 3 motors per side, meaning 3 jaguars per side.

After looking through the RobotDrive class, I noticed there is not consturctor for a 6 wheel drive-train. So I made a constructor for 6 wheels, which I think should work...

Code:
RobotDrive::RobotDrive(SpeedController *rearLeftMotor, SpeedController *middleLeftMotor,
						SpeedController *frontLeftMotor, SpeedController *rearRightMotor,
						SpeedController *middleRightMotor,
						SpeedController *frontRightMotor,
						float sensitivity)
{
	if (frontLeftMotor == NULL || middleLeftMotor == NULL || rearLeftMotor == NULL || frontRightMotor == NULL || frontMiddleMotor == NULL|| rearRightMotor == NULL)
	{
		wpi_fatal(NullParameter);
		m_frontLeftMotor = m_rearLeftMotor = m_frontRightMotor = m_rearRightMotor = NULL;
		return;
	}
	m_rearLeftMotor = rearLeftMotor;
	m_middleLeftMotor = middleLeftMotor;
	m_frontLeftMotor = frontLeftMotor;
	m_rearRightMotor = rearRightMotor;
	m_middleRightMotor = middleLeftMotor;
	m_frontRightMotor = frontRightMotor;
	m_sensitivity = sensitivity;
	for (INT32 i=0; i < kMaxNumberOfMotors; i++)
	{
		m_invertedMotors[i] = 1;
	}
	m_deleteSpeedControllers = false;
}
Anyway, I looked into the TankDrive function I am using, because I want to ensure that when I move my joysticks, it moves all the motors, not just the first 2. So after looking through the TankDrive, it calls another function called SetLeftRightMotorSpeeds. After reading that, it makes me THINK that it will only set the first 2 Jaguars (on each side) to drive, not the third.

Here is that function
Code:
void RobotDrive::SetLeftRightMotorSpeeds(float leftSpeed, float rightSpeed)
{
	wpi_assert(m_rearLeftMotor != NULL && m_rearRightMotor != NULL);

	leftSpeed = Limit(leftSpeed);
	rightSpeed = Limit(rightSpeed);

	if (m_frontLeftMotor != NULL)
		m_frontLeftMotor->Set(Limit(leftSpeed) * m_invertedMotors[kFrontLeftMotor]);
	m_rearLeftMotor->Set(Limit(leftSpeed) * m_invertedMotors[kRearLeftMotor]);

	if (m_frontRightMotor != NULL)
		m_frontRightMotor->Set(-Limit(rightSpeed) * m_invertedMotors[kFrontRightMotor]);
	m_rearRightMotor->Set(-Limit(rightSpeed) * m_invertedMotors[kRearRightMotor]);
}
Any help on how to edit that so all 3 will go, not just 2?

Edit: Im thinking i can just say m_middleRight/LeftMotor -> Set...., but Im not sure.

Thanks- 1771

Last edited by nighterfighter : 02-08-2010 at 03:58 PM. Reason: Thought of something
Reply With Quote
  #2   Spotlight this post!  
Unread 02-08-2010, 03:59 PM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: void RobotDrive::SetLeftRightMotorSpeeds?

The simple and obvious solution is to duplicate the lines that control the front motors and change them to control the middle motors.

(But I'm not as strong in C++ as I could be, so keep in mind this adage: For every complex problem, there is usually a solution that is simple, obvious...and wrong.)
Reply With Quote
  #3   Spotlight this post!  
Unread 02-08-2010, 04:18 PM
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: void RobotDrive::SetLeftRightMotorSpeeds?

Yeah, that's why I'm hesitant to do that.

One of those reasons is that first If statement is corresponding to the set command directly below it, but the next Set command is not....

I figure I can just try it, with the motors not hooked up, and just check the Jags.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-08-2010, 04:54 PM
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: void RobotDrive::SetLeftRightMotorSpeeds?

but it is correct:
(change the 1 to -1 to invert the middle motors)
Code:
void RobotDrive::SetLeftRightMotorSpeeds(float leftSpeed, float rightSpeed)
{
	wpi_assert(m_rearLeftMotor != NULL && m_rearRightMotor != NULL);

	leftSpeed = Limit(leftSpeed);
	rightSpeed = Limit(rightSpeed);

	if (m_frontLeftMotor != NULL)
		m_frontLeftMotor->Set(Limit(leftSpeed) * m_invertedMotors[kFrontLeftMotor]);
	m_rearLeftMotor->Set(Limit(leftSpeed) * m_invertedMotors[kRearLeftMotor]);

	if (m_frontRightMotor != NULL)
		m_frontRightMotor->Set(-Limit(rightSpeed) * m_invertedMotors[kFrontRightMotor]);
	m_rearRightMotor->Set(-Limit(rightSpeed) * m_invertedMotors[kRearRightMotor]);

	if (m_middleRightMotor != NULL)
		m_middleRightMotor ->Set(-Limit(rightSpeed) * 1);
	if (m_middleLeftMotor != NULL)
		m_middleLeftMotor ->Set(Limit(leftSpeed) * 1);
}
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #5   Spotlight this post!  
Unread 02-09-2010, 10:33 AM
JacobC's Avatar
JacobC JacobC is offline
Registered User
FRC #1885 (ILITE Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Virginia
Posts: 1
JacobC is an unknown quantity at this point
Re: void RobotDrive::SetLeftRightMotorSpeeds?

I believe there is a reason that there is not a six wheel drive train option. To my knowledge, you are only allowed to use 5 CIMs. I would double check the rules on this before spending too much time programming it.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-09-2010, 10:47 AM
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: void RobotDrive::SetLeftRightMotorSpeeds?

Quote:
Originally Posted by JacobC View Post
I believe there is a reason that there is not a six wheel drive train option. To my knowledge, you are only allowed to use 5 CIMs. I would double check the rules on this before spending too much time programming it.
You are correct that only 5 CIMs are allowed. However, it's likely that they are using 4 CIMs and 2 other motors (such as fisher price motors).
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
RobotDrive Bug? Bryscus Programming 5 02-03-2010 10:29 AM
RobotDrive + PIDController = possible? oddjob C/C++ 4 01-14-2010 11:33 PM
editing robotDrive class help mikelowry C/C++ 2 10-07-2009 01:25 PM
void* pointer to object in C++ byteit101 C/C++ 6 01-14-2009 05:15 PM
problem with void Process_Data_From_Local_IO CmptrGk Programming 2 01-29-2005 05:14 PM


All times are GMT -5. The time now is 10:42 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