Part 2: Robot Control
Last updated
Last updated
Thus far we've tackled a lot of the basics to get parts of our robot moving in response to our gamepad or sensors. So what comes next?
In Part 2 of Hello Robot we're going to look at working with a full, functional robot. By the end of this section your robot will be able controlled with the gamepad!
Before continuing it is recommended to complete, at minimum, a drivetrain. There are a few different options depending on the kit being used. We recommend looking at the C-Channel Drivetrain, such as what is used with our Starter Bot program, or the Class Bot V2!
For this guide the Class Bot V2 is used. Check out the build guide for full building instructions for the Class Bot V2!
The graphic below highlights the major hardware components of the Class Bot V2. These components are important to understand for the configuration process.
The Hello Robot - Configuration section focused on configuring the components in the Test Bed.
In order to continue forward with the Robot Control programming sections, additional motors must be added. It is your choice what variable names you would like to assign to your robot, but for reference this guide will use the following names for each hardware component.
Hardware Component
Hardware Type
Name
Right Drive Motor
REV Robotics UltraPlanetary HD Hex Motor
rightmotor
Left Drive Motor
REV Robotics UltraPlanetary HD Hex Motor
leftmotor
Arm Motor
REV Robotics Core Hex Motor
arm
Touch Sensor
REV Touch Sensor
test_touch
Before continuing it is important to understand the mechanical behavior of different drivetrains. The two most common drivetrain categories types are Differential and Omnidirectional.
Differential Drivetrains are the standard starting drivetrain. They are able to move in forward/reverse, as well as rotate either direction around a central point. There are different styles of directional drivetrains depending on the type of wheels, number of motors, and wheel positions. These include 4WD, 6WD, West Coast, and C-Channel drivetrains.
By comparison, omnidirectional drivetrains can move in any direction with each wheel typically being controlled separately. This allows for advanced forms of navigation, such as strafing, but requires a more complex program. Omnidirectional drivetrains include the use of omni wheels in Y or X configurations, mecanum wheel drivetrains, swerve drive, and other forms of holonomic drives.
The Class Bot V2 uses a directional drivetrain, which will be the drivetrain of focus for this tutorial!
While driving our robot with teleop control, we will be giving the robot inputs from our gamepad connected to our Driver Hub. Its job is to translate those inputs to the robot to perform the specified actions. How your robot drives and what joystick does what can be largely dependent on what you or your team's driver is comfortable using. Let's take a look at two of the more common methods of control: Tank Drive and Arcade Drive.
For tank drive, each side of the differential drivetrain is mapped to its own joystick so both will be used. Changing the position of each joystick allows the drivetrain to steer and change its heading. Sample code exists in the Robot Controller Application to control a differential drivetrain in this way.
For arcade drive, each side of the differential drivetrain is controlled by a single joystick. Changing position of the joystick changes the power applied to each side of the drivetrain allowing for a given command.
Arcade drives typically have left/right movement of the joystick set to spin the robot about its axis with forward/back moving the robot forward and reverse.
Arcade Drive may also be configured as a Split Arcade Drive where one joystick turns the robot while the other controls forward/back. An example of a Split Arcade Drive robot can be found as part of our 2023-24 Starter Bot.