|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#16
|
|||
|
|||
|
Re: CANJaguar
Yes I tried that as well. I declared 4 of them. Something along the lines of
SpeedController frontLeft = new Jaguar(1,1); SpeedController rearLeft = new Jaguar(1,2); SpeedController frontRight = new Jaguar(1,3); SpeedController rearRight = new Jaguar(1,4); To be honest, I am not entirely sure what the slot number on the chassis is supposed to signify, so i just used 1 because that seems to be what everyone used in the examples i have seen. For the channel number, I used the PWM slot number i connected each jaguar to on the digital side car. Then I used the set method, passing in the throttle value from a joystick, to set the speeds. Then I passed the speed controllers into the tankDrive() method. One more thing that i have noticed is that the the green diagnostic light in the driver station diagnostic console doesnt change color to blue when i move the sticks. It does, however, change color when i press buttons on the stick. Does this have any significance? |
|
#17
|
|||
|
|||
|
Re: CANJaguar
Quote:
And the dashboard is just like that. No real significance. It changes color only for button-presses. |
|
#18
|
||||
|
||||
|
Re: CANJaguar
Quote:
|
|
#19
|
||||
|
||||
|
Re: CANJaguar
We had some problems with things getting initiated at the beginning of the year because some standards have changed with regards to the numbering of the modules. Your digital module should be in slot 2, and then you should just remove the slot number from the lines that instantiate the motors. Also, how to OTHER things connected to the sidecar work? I saw a person earlier today that had a faulty ribbon cable.
|
|
#20
|
||||
|
||||
|
Re: CANJaguar
Quote:
I have to disagree with you on this. According to CAN spec IS0 11898:1993(E) Table 15, the maximum cable distance for 1Mbit/second is 40 Meters not 20 feet. We have also tested at distances much greater than 20 feet without issue using 120 Ohm's of termination on each end of the BUS. FYI a termination resistor of 100 ohms is outside of the spec. Teams using 120 ohms resistors should have no issues related to signal reflection. |
|
#21
|
||||
|
||||
|
Re: CANJaguar
Quote:
Total Cable Length (maximum) 20 ft / 6.1m Tip: Start with this length of bulk cable and cut all segments from it to ensure compliance. Termination Resistance 100 At each end of the network. Just quoting specs. - Bryce |
|
#22
|
||||
|
||||
|
Re: CANJaguar
Quote:
|
|
#23
|
||||
|
||||
|
Re: CANJaguar
Quote:
I think this deviates from what "Slot" meant in the past: the actual physical position the card was at (i.e. slot 4 of 8 for previous years was the slot for the first DIO module) Again this is just what I remember from beta test, and what I've observed from my testing. If I'm wrong, let me know so I can avoid headaches down the road. ![]() |
|
#24
|
||||
|
||||
|
Re: CANJaguar
The 'Getting Started Guide' is not the CAN spec, IS0 11898:1993(E) is.
|
|
#25
|
|||
|
|||
|
Re: CANJaguar
Quote:
Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Jaguar;
public class RobotTemplate extends IterativeRobot {
RobotDrive robot;
Joystick left;
Joystick right;
Jaguar leftFront;
Jaguar leftRear;
Jaguar rightFront;
Jaguar rightRear;
public void robotInit() {
Jaguar leftFront = new Jaguar(1);
Jaguar leftRear= new Jaguar(2);
Jaguar rightFront= new Jaguar(3);
Jaguar rightRear= new Jaguar(4);
robot = new RobotDrive(leftFront,leftRear,rightFront,rightRear);
//robot = new RobotDrive(1,2,3,4);
left = new Joystick(1);
right = new Joystick(2);
System.out.println("RobotInit() completed.\n");
}
public void disabledContinuous(){
leftFront.set(1);
//robot.tankDrive(1,1);
}
public void disabledPeriodic(){
leftFront.set(1);
//robot.tankDrive(1,1);
}
public void autonomousPeriodic() {
leftFront.set(1);
//robot.tankDrive(1,1);
}
public void teleopContinuous(){
leftFront.set(1);
//robot.tankDrive(1,1);
}
public void teleopPeriodic() {
//robot.tankDrive(left.getThrottle(),(-1*right.getThrottle()));
leftFront.set(1);
//rightFront.set(right.getMagnitude());
//robot.tankDrive(leftFront.get(), rightFront.get());
//robot.tankDrive(left, right);
//robot.tankDrive(1,1);
//System.out.println("left:"+left.getThrottle());
//System.out.println("right:"+right.getThrottle());
//System.out.println("LMAG:"+ left.getMagnitude());
//System.out.println("RMAG:"+ right.getMagnitude());
//System.out.println("LRAD"+left.getDirectionDegrees());
//System.out.println("RRAD"+right.getDirectionDegrees());
System.out.println("Tank Drive");
}
}
I have also tried creating jaguar objects and setting their speed manually. Again this did not work. I even took a multimeter to my sidecar, testing each of the signal pins in both the 3 pin PWM and the 3 pin Digital I/O. No matter what code I tried, the signal pins never presented any current. What do you guys think the problem could be? My code looks fine right? Could it be the ribbon cable connecting the cRIO to the sidecar? |
|
#26
|
||||
|
||||
|
Quote:
This wouldn't be the first time a device isn't fully compliant with a spec. One thing I've learned in the industry is that if you design a system to the spec of a bus and not that of a part you'll get burned every time - SPI, I2C, EBI, you name it. The reason microprocessors have so many options for these buses is that parts are so varied. - Bryce Last edited by Bryscus : 22-01-2012 at 17:17. |
|
#27
|
|||
|
|||
|
Re: CANJaguar
Quote:
They differ in the following ways:
Ideally each Jaguar would be configured with its own specific bit-timing parameters (parameters that define when the CAN module samples the bit). These parameters depend on a lot of factors including location on the bus, bus impedance, the number of drivers on the bus, etc. In this specific application (FRC) a lot of those factors are unknown. What works for one setup may not work as well for another. During our testing of Jaguar we found that as the number of Jaguars increased and the cable lengths got longer, some Jaguars would not sample the bits correctly. We saw that the bus was taking longer to transition from the dominant to recessive states fast enough when every CAN driver on the bus was driving dominant. We were able to successfully improve the timing by lowering the resistance of the terminator to 100 ohms. The lower resistance helped pull the CANH and CANL to the recessive state much faster. We also found that minimizing the cable lengths between the Jaguars helped a bit too. The bottom line: TI specifies 100 ohm termination resistors and ~20' total of cabling. This differs from the official ISO specification for CAN, but should ensure that teams have the best experience with the Jaguar when using CAN. -David |
|
#28
|
||||
|
||||
|
Re: CANJaguar
Quote:
Our findings tell a different story. I would be happy to share them with you. |
|
#29
|
||||
|
||||
|
Re: CANJaguar
Quote:
You instantiate your jaguars as class variables (green lines), then create four new jaguar variables within the robotInit() method (red lines). You're not initializing the class variables as you may think. Basically you're telling the program that within the robotInit() class it should use the local copies of those Jag variables (red), instead of the ones the rest of the program knows about (green). Any reference to the Jag variables outside of the robotInit() method will refer to the ones that aren't initialized (green), and since they aren't initialized they won't be sending commands to any motor controllers. Remove the "Jaguar" text thats highlighted red and that should fix your problem. Read up on scope: http://sip.clarku.edu/tutorials/java/java.html#scope |
|
#30
|
||||
|
||||
|
Re: CANJaguar
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|