Go to Post each year the chairmans award is given to the team the judges think deserve it the most, for that year. How can it be any other way? - KenWittlief [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 01-19-2016, 08:02 PM
Prodigi3277 Prodigi3277 is offline
Registered User
FRC #3277
 
Join Date: Jan 2016
Location: Minnesota
Posts: 2
Prodigi3277 is an unknown quantity at this point
Can't use joystick when using two CAN Jaguars

We are currently only able to control one CAN Jaguar in our code. Adding a second CANJaguar object creates a problem where the joystick values are not getting read into the robot. Even with the second CANJaguar (called m_JaguarLeft below) only created and initialized (no methods being called on it), and the robot stops responding to the joystick. The joystick is seen by the drive station, and the values are being displayed on all of the appropriate views.

Code:
class Robot: public SampleRobot
{
	RobotDrive myRobot; // robot drive system
	Joystick stick; // only joystick
	CANJaguar m_JaguarRight, m_JaguarLeft;
public:
	Robot() :
		myRobot(0, 1),	// initialize the RobotDrive to use motor controllers on ports 0 and 1
		stick(0),
		m_JaguarRight(3),
		m_JaguarLeft(2)
	{
		//LiveWindow *lw;

		m_JaguarRight.SetPercentMode(CANJaguar::QuadEncoder, 360);
		m_JaguarRight.EnableControl();
		m_JaguarRight.Set(0.0f);

		m_JaguarLeft.SetPercentMode(CANJaguar::QuadEncoder, 360);
		m_JaguarLeft.EnableControl();
		m_JaguarLeft.Set(0.0f);
		myRobot.SetExpiration(0.1);
	}
	void Disabled()
	{
		while(IsDisabled()){}
	}


	void RobotInit()
	{
		//lw = LiveWindows::GetInstance();

	}
	/**
	 * Runs the motors with arcade steering.
	 */
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			m_JaguarRight.Set(stick.GetY()); // drive with arcade style (use right stick)
			m_JaguarLeft.Set(stick.GetY());
			Wait(0.005);				// wait for a motor update time
		}
	}

};
We are getting our new programmers introduced into FRC, and are moving to C++ coding this year. Everyone is at a loss as to what is going on with this not working.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-19-2016, 08:32 PM
ozrien's Avatar
ozrien ozrien is online now
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 516
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: Can't use joystick when using two CAN Jaguars

Does the driver-station still say teleop-enabled when the Jags are misbehaving?
If so then the problem is likely RIO <=> Jag, not Gamepad <=> RIO.

Are the eclipse-plugins up-to-date 1/15/2016? Prolly not the issue but worth checking.

What are the Jag LEDs doing when they are misbehaving. Be sure they both show up in the roboRIO web-based config okay.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-20-2016, 08:30 AM
Dillz42 Dillz42 is offline
Registered User
FRC #3277
 
Join Date: Jan 2016
Location: Minnesota
Posts: 1
Dillz42 is an unknown quantity at this point
Re: Can't use joystick when using two CAN Jaguars

Replying from home, but same person (not on the team account).
Quote:
Originally Posted by ozrien View Post
Does the driver-station still say teleop-enabled when the Jags are misbehaving?
If so then the problem is likely RIO <=> Jag, not Gamepad <=> RIO.
The drivers station does show Teleop-enabled, with communication, robotcode, and joystick indicators all green.

Quote:
Originally Posted by ozrien View Post
Are the eclipse-plugins up-to-date 1/15/2016? Prolly not the issue but worth checking.
I can double check this today. I am not sure if we updated it since getting everything installed the Monday after kickoff. Hopefully it is that simple.

Quote:
Originally Posted by ozrien View Post
What are the Jag LEDs doing when they are misbehaving. Be sure they both show up in the roboRIO web-based config okay.
Both Jags have solid yellow LEDs while the robot is enabled, indicating they are getting a signal. The roboRIO webpage shows the Jags with the IDs in the above code.

At one point we had the joystick axis values printing out to a log to check if the value was changing, but the joystick Y-axis remained at zero no mater where the actual joystick was. Again, the DS showed that the joystick moved, but the code was not seeing this change.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-20-2016, 09:28 AM
Ken Streeter's Avatar
Ken Streeter Ken Streeter is offline
Let the MAYHEM begin!
FRC #1519 (Mechanical Mayhem)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Team: Milford, NH; Me: Bedford, NH
Posts: 468
Ken Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond repute
Re: Can't use joystick when using two CAN Jaguars

We don't use the "SimpleRobot" framework (we instead use Command-Based robot), but I wonder if you're using up a resource (maybe CAN bandwidth?) by sending too many messages too quickly.

The rate of DS control packet updates is only 50Hz. I'd suggest changing the Wait(0.005) to Wait (0.02) and seeing if that helps.
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"
Reply With Quote
  #5   Spotlight this post!  
Unread 01-20-2016, 06:37 PM
Prodigi3277 Prodigi3277 is offline
Registered User
FRC #3277
 
Join Date: Jan 2016
Location: Minnesota
Posts: 2
Prodigi3277 is an unknown quantity at this point
Re: Can't use joystick when using two CAN Jaguars

Thanks everyone the update to the library worked so now everything is running well
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:14 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