Go to Post sweet nectar thy name is Dew... - Trinora [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 14-01-2012, 01:38
krugmik krugmik is offline
Registered User
FRC #3244
 
Join Date: Jan 2012
Location: Minnesota
Posts: 1
krugmik is an unknown quantity at this point
Need help coding the jaguars

Last year I programmed our robot with the help of two mentors and another team member. Unfortunately this year the main programming mentor has moved away and the other mentor has been very busy the past week leaving me alone to handle the programming. It's only made harder by the fact that our computer with the code on it was stolen so I don't have any examples of how to write the code like we did last year.

Using the default example template I've managed to get most of the code properly written for our robot that currently only has a drive mechanism, however I can't get the jaguars attached to the cim motors to work properly. I have declared the jaguars but I'm not able to figure out how to add in the information for where each jag is connected. I've tried searching the provided guides and searching the internet but I've been unable to find anything that has worked. Whenever the robot is turned on the jags flash with a yellow light. Any help with the basic coding for the jaguars would be much appreciated!
Reply With Quote
  #2   Spotlight this post!  
Unread 14-01-2012, 02:04
4057programmer 4057programmer is offline
Registered User
FRC #4057
 
Join Date: Jan 2012
Location: Klamath Falls
Posts: 37
4057programmer is an unknown quantity at this point
Re: Need help coding the jaguars

go to the part in the code where all the other objects have their location stated. for example the stick controller should have whatever the name is then parentheses next to it with a number.

drivingcontroller(1)

in that area you need to add your jaguars and in parentheses next to it type in the number that matches what port it is plugged into on your i/o board.

jaguarthefirst(1) or whatever number you are using.
Reply With Quote
  #3   Spotlight this post!  
Unread 14-01-2012, 02:40
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 671
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Need help coding the jaguars

You need to find out how the Jaguars are connected to the cRIO. There are two ways. You are either connecting the Jaguars to the PWM channels or you are connecting them to a CAN bus by the RJ-12 cables. The way they are connected to the cRIO affects how they are programmed. If you are using CAN bus, you need to declare CANJaguar objects. If you are using PWM, then you declare Jaguar objects. What slot in the cRIO is your digital module plugged into? If your robot is 2-motor drive and you have an 8-slot cRIO with the digital module on slot 4 and connect them through PWM, then you need to declare the Jaguars like this:
Code:
class MyRobot: public SimpleRobot
{
    RobotDrive drive;
 
    MyRobot():
        drive(PWM_CHANNEL_LEFTJAG, PWM_CHANNEL_RIGHTJAG)
    {
        // You may want to flip the booleans if the motors running the wrong way.
        drive.SetInvertedMotor(kRearLeftMotor, true);
        drive.SetInvertedMotor(kRearRightMotor, false);
        ...
        ...
    }
}
__________________

Last edited by mikets : 14-01-2012 at 02:44.
Reply With Quote
  #4   Spotlight this post!  
Unread 14-01-2012, 11:54
Team 3705's Avatar
Team 3705 Team 3705 is offline
Registered User
FRC #3705
 
Join Date: Jan 2011
Location: Canada
Posts: 34
Team 3705 is an unknown quantity at this point
Re: Need help coding the jaguars

Hmm we are having problems also programming our robot.
Code:
 
#include "WPILib.h"

/**
 * This is a demo program showing the use of the RobotBase class.
 * The SimpleRobot class is the base of a robot application that will automatically call your
 * Autonomous and OperatorControl methods at the right time as controlled by the switches on
 * the driver station or the field controls.
 */ 
class RobotDemo : public SimpleRobot
{
	RobotDrive myRobot; // robot drive system
	Joystick leftstick; // "leftstick" is a variable that points to the joystick object.
	
	Jaguar *gripperMotor;
public:
	RobotDemo(void):
		myRobot(1, 2),	// these must be initialized in the same order
		leftstick(1)
				// as they are declared above.
	{
		Joystick *rightstick;
		myRobot.SetExpiration(0.1);
	}

	/**
	 * Drive left & right motors for 2 seconds then stop
	 */
	void Autonomous(void)
	{
		myRobot.SetSafetyEnabled(false);
		myRobot.Drive(0.5, 0.0); 	// drive forwards half speed
		Wait(2.0); 				//    for 2 seconds
		myRobot.Drive(0.0, 0.0); 	// stop robot
	}

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			myRobot.ArcadeDrive(leftstick); // drive with arcade style (use right stick)
			Wait(0.005);
			
			
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
This is for our 2011 robot.
We have not been able to get Autonomous nor Operator control going. We are constantly bombarded with an error about the digital module not being found, and something at line 26 of PWM.cpp.

When we try autonomous or teleoperated nothing occurs.The robot does not move or anything.

Last edited by Team 3705 : 14-01-2012 at 12:11.
Reply With Quote
  #5   Spotlight this post!  
Unread 14-01-2012, 15:13
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: Need help coding the jaguars

Quote:
Originally Posted by Team 3705 View Post
When we try autonomous or teleoperated nothing occurs.The robot does not move or anything.
You need to put the module that the digital sidecar comes out of into the 2nd slot in the cRio - it's a change from 2011. If you're a veteran team, you probably skipped that step like the instructions told you to. Check out the "How to set up your robot control system" in the Getting Started with the 2012 FRC Control System_2.pdf.
Reply With Quote
  #6   Spotlight this post!  
Unread 15-01-2012, 00:11
Team 3705's Avatar
Team 3705 Team 3705 is offline
Registered User
FRC #3705
 
Join Date: Jan 2011
Location: Canada
Posts: 34
Team 3705 is an unknown quantity at this point
Re: Need help coding the jaguars

oh thanks~ I read that somewhere? So, after placing the module in the second slot of the cRIO, will the simple template program run?
Reply With Quote
  #7   Spotlight this post!  
Unread 15-01-2012, 07:44
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: Need help coding the jaguars

Quote:
Originally Posted by Team 3705 View Post
oh thanks~ I read that somewhere? So, after placing the module in the second slot of the cRIO, will the simple template program run?
It should. You need the analog module in #1, digital module in #2, solenoid module in #3.
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 03:08.

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