Fork Virtual Robot

Forking virtual_robot to Your Own GitHub

1. Fork on GitHub

  1. Go to github.com/ARES-23247/virtual_robot
  2. Click Fork → select your account (FC-Robotics-Main)
  3. Rename it to My_virtual_robot in the fork settings

2. Rename on GitHub (if not done during fork)

  1. Go to your fork → Settings
  2. Change repository name to My_virtual_robot
  3. Click Rename

3. Point your local project to your fork

Open terminal (Windows command prompt or Android Studio terminal) and type:

First, switch to the D drive:

D:

Then navigate to the project folder:

cd Nextcloud.Redfish\MyDocs.Byron\1-Robotics\virtual_robot

Then update the remote:

git remote set-url origin https://github.com/FC-Robotics-Main/My_virtual_robot.git

4. Verify it worked

git remote -v

Should show:

origin  https://github.com/FC-Robotics-Main/My_virtual_robot.git

5. Push your changes

git add .
git commit -m "My code changes"
git push origin master

Now your students can download from either the original ARES-23247 repo or your My_virtual_robot repo separately.

 

Listing 1.1: HelloWorld.java

package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
@TeleOp(name = "LJCH01 Hello World") // This is the most important line!
public class LJCh01_HelloWorld extends OpMode {

    @Override
    public void init() {
        telemetry.addData("Hello","World");


    }

    @Override
    public  void loop(){


    }
}

//Listing 2.1: PrimitiveTypes.java
package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
@TeleOp(name = "DataTypes") // This is the most important line!
public class LJCh02_PrimativeTypes extends OpMode {

    @Override
    public void init() {
        telemetry.addData("Hello","World333");

        int teamNumber = 16072;
        double motorSpeed = 0.5;
        boolean touchSensorPressed = true;

        telemetry.addData("Team Number", teamNumber);
        telemetry.addData("Motor Speed", motorSpeed);
        telemetry.addData("Touch Sensor", touchSensorPressed);

        String myName = "Alan Smith";

        telemetry.addData("Hello",myName);
    }

    @Override
    public  void loop(){


    }
}


// Listing 3.2: MathOpMode.java and exercises
package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
@TeleOp(name = "Learn Java Ch03 Gamepad") // This is the most important line!
public class LJCh03_Gamepad extends OpMode {

    @Override
    public void init() {
        telemetry.addData("Learn Java for FTC Ch03","Do you like my hat?");


    }

    @Override
    public  void loop(){

        double speedForward = -gamepad1.left_stick_y / 2.0;
        telemetry.addData("Left stick y", gamepad1.left_stick_y);
        telemetry.addData("speed Forward", speedForward);

        // Page 20 Exercise 1
        double speedSpin = gamepad1.right_stick_y;
        if(speedSpin == 0){
            telemetry.addData("Not Spinning",speedSpin);
        }
        else if(speedSpin <= 0) {
            telemetry.addData("Spin Left", gamepad1.right_stick_y);
            telemetry.addData("Spin Speed", speedSpin);
        }
        else {
            telemetry.addData("Spin Right", gamepad1.right_stick_y);
            telemetry.addData("Spin Speed", speedSpin);
        }

        // Page 20 Exercise 2
        boolean boolButtonB = gamepad1.b;
        if(boolButtonB) {
            telemetry.addData("Button B is Pressed.", boolButtonB);
        }
        else {
            telemetry.addData("Button B is NOT Pressed.", boolButtonB);
        }

        // Page 20 Exercise 3
        telemetry.addData("The difference in Y value of \n the Left and Right Joystick is", speedForward- speedSpin);

        // Page 20 Exercise 4
        double dblSumTriggers = gamepad1.right_trigger + gamepad1.left_trigger;
        telemetry.addData("The sum of the left and \n right Trigger values is", dblSumTriggers);


    }
}

//Listing 6.2
package org.firstinspires.ftc.teamcode.opmodes;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

import org.firstinspires.ftc.teamcode.mechanisms.ProgrammingBoard1;

@TeleOp()
public class TouchSensorOpMode extends OpMode {
    ProgrammingBoard1 board = new ProgrammingBoard1();
    
    @Override
    public void init() {
        board.init(hardwareMap);
    }

    @Override
    public void loop() {
        telemetry.addData("Touch sensor", board.getTouchSensorState());
    }
}

// Listing 6.3
package org.firstinspires.ftc.teamcode.mechanisms;

import com.qualcomm.robotcore.hardware.DigitalChannel;
import com.qualcomm.robotcore.hardware.HardwareMap;

public class ProgrammingBoard1 {
    private DigitalChannel touchSensor;

    public void init(HardwareMap hwMap) {
        touchSensor = hwMap.get(DigitalChannel.class, "touch_sensor");
        touchSensor.setMode(DigitalChannel.Mode.INPUT);
    }

    public boolean isTouchSensorPressed() {
        return !touchSensor.getState();
    }
}
// Listing 6.4
package org.firstinspires.ftc.teamcode.opmodes;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

import org.firstinspires.ftc.teamcode.mechanisms.ProgrammingBoard2;

@TeleOp()
public class TouchSensorOpMode2 extends OpMode {
    ProgrammingBoard2 board = new ProgrammingBoard2();

    @Override
    public void init() {
        board.init(hardwareMap);
    }

    @Override
    public void loop() {
        telemetry.addData("Touch pressed", board.isTouchSensorPressed());
    }
}

Leave a Comment