The sample programs are an excellent resource for looking at how all this works
For your specific question, no the names have no bearing on what port they are on. In fact, with what you have right now your code will not work and will crash as soon as you start Teleop (possibly sooner)
This must be in the class constructor:
Code:
stick2 = new Joystick(2);
Put that below the one for the first joystick. What this does is allocate the memory and create the actual Joystick that you will be interacting with. The first statement only declares that the stick2 variable exists and is a pointer to a Joystick object.
To assign usb ports, simply change the number inside the parenthases in "new Joystick(2)" to the port number and it will assign the port
EDIT: missed the question about PWM
There are 2 ways that the Victor/Jaguar ports are defined. Both occur when the "new RobotDrive(...);" happens.
1) (cannot be used with CAN controllers)
Code:
drive = new RobotDrive(1,2);
This tells the drive object that the motor on the left is PWM port 1, and right is PWM port 2. A 2nd version of this exists as well, defining a 4 wheel drive system (2 independent motors on each side). The declaration, instead of 2 numbers, has 4 numbers, which are the following: front left motor, rear left motor, front right motor, rear right motor.
2) (CAN-compatible, PWM works too)
Code:
leftJag = new CANJaguar(1);
rightJag = new CANJaguar(2);
drive = new RobotDrive(leftJag, rightJag);
This version, instead of creating the motor objects itself, has you create the objects and give them to the RobotDrive (useful if you switch the RobotDrive on and off during a match to manually run the motors instead for some reason). The constructor can take a Victor, Jaguar, or CANJaguar object, as well as anything else you come across that inherits the SpeedController class. This also has a 4-motor variant identical to the one above