Thursday, December 1, 2022

ACA Robotics Programming



Review theDocumentations:

Expansion Hub with Android Device Robot Controller - DUO Control System (revrobotics.com)

Keep this diagram handy:

Wiring Diagram - DUO Control System (revrobotics.com)

  • Programming 

Tutorials(name convention : 

yourunique-prefix+originalfilename.Java. 

For the FTC library name convention, please review this link.

 not to overwrite other’s configuration file)


3. Run/Debug your code

Copy and paste your java file to OnBot java on the web browser. Http://168……
Run the code 

4. Test the code via driver station 

5. Try if you can modify the code
1. Put the output on the driver station use the telemetry function 
2. add a count variable to display how many times the robot component(s) ran in the while loop. You can reference to the demo program: demorampmotospeed.Java

Autonomous programming 

The REV Expansion Hub has a built-in IMU, or Inertial Measurement Unit. This is a sensor that can measure acceleration (movement) in several axes. 

https://docs.revrobotics.com/duo-control/sensors/i2c/imu#how-to-use

Originally, Control Hubs and Expansion Hubs came with the Bosch BNO055 IMU. Control Hubs containing the alternative Bosch BHI260AP IMU started shipping in September 2022. To see which IMU your Control Hub has, go to the Manage page within the Program & Manage web interface, either from the Driver Station, the REV Hardware Client, or at http://192.168.43.1:8080 in a web browser on a laptop connected to the Control Hub's Wi-Fi network.
When you create a new configuration file, the correct IMU type will be automatically detected, and added to the configuration.
Version 8.1 of the FTC Robot Controller app adds a new universal IMU interface for Blocks and Java programming, which supports both the BNO055 IMU and the BHI260AP IMU. The BNO055 IMU can also be used from the legacy BNO055IMU interface.

The universal IMU interface

The new universal IMU interface added in version 8.1 of the FTC Robot Controller app provides robot-centric orientation and angular velocity values. You can specify the exact orientation of the Control or Expansion Hub on your robot, and the interface will convert the raw values from the IMU into robot-centric values. This simplifies how you use the IMU's values, and prevents problems when the hub is not mounted with the REV Robotics logo facing upwards.
All values from theIMU interface are in the Robot Coordinate System, in which the origin is inside your robot, the Z axis points towards the ceiling, the Y axis points straight ahead through the front of your robot (whatever you define the front to be), and the X axis points out the right side of your robot. This coordinate system is right-handed, which means that if you point a typical right thumb in the same direction as the axis, rotation in the same direction that the fingers curl is considered positive.
The IMU.getRobotYawPItchRollAngles()method on the IMU interface provides the robot's orientation in a simplified format of yaw, pitch, and roll angles. Most teams should use this method to get the robot's orientation.
  • Yaw (also known as heading) is the measure of rotation along the robot's Z axis, or the side-to-side lateral rotation of the robot.
  • Pitch is the measure of rotation along the robot's X axis, or the front-to-back rotation of the robot.
  • Roll is the measure along the robot's Y axis, or the side-to-side tilt of the robot.

Yaw, Pitch and Roll of the robot

It can be used in place of an external gyro. The IMU is not used in quite the same way as the gyro but is similar. Note: you must configure the IMU on I2C channel 0, port 0. Here is the DriveAvoid example converted to use the IMU in place of the MR gyro.




  • Use encoder:

Using RUN_TO_POSITION

To use RUN_TO_POSITION mode, you need to do the following things in this order:

  1. Set a target position (in ticks)

  2. Switch to RUN_TO_POSITION mode

  3. Set the maximum velocity

    // Set the motor's target position to 300 ticks
    motor.setTargetPosition(300);
    // Switch to RUN_TO_POSITION mode
    motor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
    // Start the motor moving by setting the max velocity to 200 ticks per second
    motor.setVelocity(200)

Basics of Programming with Encoders

STOP_AND_RESET_ENCODER Mode

Place a motor in this mode when you want to set its encoder position back to 0. The motor will stop. To start it again, you need to place the motor into one of the other three modes. It is recommended to place each motor you will be using encoders with into this mode at the start of each program, so that you know what position the motor is starting out in.
RUN_WITHOUT_ENCODER Mode

Use this mode when you don’t want the Control Hub to attempt to use the encoders to maintain a constant speed. You can still access the encoder values, but your actual motor speed will vary more based on external factors such as battery life and friction. In this mode, you provide a power level in the -1 to 1 range, where -1 is full speed backwards, 0 is stopped, and 1 is full speed forwards. Reducing the power reduces both torque and speed.
This mode is a good choice for drivetrain motors driven by joysticks on the gamepad.
RUN_USING_ENCODER Mode

In this mode, the Control Hub will use the encoder to take an active role in managing the motor’s speed. Rather than directly applying a percentage of the available power, RUN_USING_ENCODER mode targets a specific velocity (speed). This allows the motor to account for friction, battery voltage, and other factors.

This mode is a good choice for operations, like a flywheel, that require a specific speed and can use buttons on a gamepad for control.
RUN_TO_POSITION Mode

In this mode, the Control Hub will target a specific position, rather than a specific velocity. You still set a velocity, but it is only used as the maximum velocity. The motor will continue to hold its position even after it has reached its target.

DriveTrain Motors

Drivetrain Motors on Drivetrain Movement (two wheel driving) 


———————

Camera


------


https://youtu.be/NqRiXfuj-Dw camera images testing








No comments:

Post a Comment

We are the Winner at the regional tournament !

  https://youtu.be/mseGfEwSrX4