Go to Post Truly good teasers should give people a good place to start guessing, while still leaving some mystery and uncertainty. - Travis Covington [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

 
 
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 01-10-2012, 01:53 AM
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: 667
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
New to 2CAN and Jaguar

Our team has been using Victors for a number of years. We finally want to embrace Jaguar and try CAN bus for this year. We've got 4 Black Jaguars and a 2CAN (not V2 though). I quickly written some simple code to test the Jaguars but it doesn't work. There must be some sample code written somewhere for CANJaguar on 2CAN. Would somebody point me to it? To summarize what my simple code does:
Code:
class MyRobot: public SimpleRobot
{
private:
    CANJaguar m_jagLeft;
    CANJaguar m_jagRight;
    Joystick m_leftStick;
    Joystick m_rightStick;
 
public:
    MyRobot():
        m_jagLeft(CANID_LEFT_JAG, CANJaguar::kSpeed),
        m_jagRight(CANID_RIGHT_JAG, CANJaguar::kSpeed),
        m_leftStick(JOYSTICK_LEFT),
        m_rightStick(JOYSTICK_RIGHT)
    {
        m_jagLeft.SetSpeedReference(CANJaguar::kSpeedRef_QuadEncoder);
        m_jagRight.SetSpeedReference(CANJaguar::kSpeedRef_QuadEncoder);
 
        m_jagLeft.SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
        m_jagRight.SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
 
        m_jagLeft.SetPID(DRIVE_KP, DRIVE_KI, DRIVE_KD);
        m_jagRight.SetPID(DRIVE_KP, DRIVE_KI, DRIVE_KD);
 
        m_jagLeft.ConfigEncoderCodesPerRev(DRIVE_ENCODER_CODES_PER_REV);
        m_jagRight.ConfigEncoderCodesPerRev(DRIVE_ENCODER_CODES_PER_REV);
 
        m_jagLeft.EnableControl();
        m_jagRight.EnableControl();
    }
 
    ....
    ....
    ....
   void OperatorControl(void)
   {
        while (IsOperatorControl())
        {
            m_jagLeft.Set(-m_leftStick.GetY());
            m_jagRight.Set(-m_rightStick.GetY());
            Wait(0.005);
        }
    }
};
I printed the joystick values to dsLCD and I got reasonable values when reading the sticks. So it means the m_jagXXXX.Set() is not doing anything. All the jags are assigned correct IDs (2 and 3) and have firmware version 92 on them. The 2CAN has a green light and I can access its web page in my browser on http://10.4.92.10. I even plugged in the serial cable directly to one of the jags and ran bdc-comm-92.exe tool. The tool enumerated saw the jag ID 2 and 3 and I was able to set some values on each of the jags and made them turn. That means the CAN bus is wired properly and the 2CAN interface with the CAN bus successfully (through the web interface). The only thing I am unsure is if the cRIO can communicate with the 2CAN. I assume the cRIO knows how to communicate with the 2CAN since I have imaged the cRIO with "2CAN" selected, so the 2CAN driver should be running. And I am also assuming the cRIO will communicate with the 2CAN using 10.xx.xx.10 as its IP address. What else did I miss?
__________________

Last edited by mikets : 01-10-2012 at 01:56 AM.
Reply With Quote
 


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:24 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