Ri2D Code
Tags: controlPersonhours: 4
Task: Code a Basic TeleOp Code for the Ri2D bot using pre-existing classes and methods
As the Ri2D bot nears completion, the need for TeleOp code becomes apparent to actually make it move. Since this robot is based of from MiniMech, a previous chassis design for Rover Rockus, the code was simply inserted into its existing class. To allow its subsystems to move and hold their position when they are not, methods for it to pose were used from the code for Icarus, our Rover Rockus robot. Most of the `PoseBigWheel` class wont be used for this robot, but that's fine since that is as simple as not using the methods not needed, done. The constructor for the `PoseBigWheel` class needed to be modified since there are different motors and servos used, this was easy as we just needed to remove anything we didn't need. Again, most stuff here won't be used, but as long as we don't delete any PIVs we should be fine.
Once the code for robot posing is made to match the Ri2D bot, we need to implement it. To do this an instance of this class was instantiated in the `MiniMech` class. With that, we can now use methods of the `Crane` class(the one with robot posing) in the `MiniMech` class.
Now it's time to use these methods from the `Crane` class. Since the elbow and slides are the same from Icarus we can apply these methods directly. These were simple if statements to detects a button press and set the appropriate motor moving using the posing code from the `Crane` class. Instead of using basic `setMotor` commands to get the motors going, pre-coded methods were used, we can now keep the motors in the position where they are placed in the same amount of complexity and with no previous knowledge of how to code robot poseing.
Finally, we have to code the servos. Since the `Crane` class comes with code for two servos we can advantage of it since the Ri2D bot has only two servos. Although the code for this is a lot simpler since robot posing isn't required here, it is still nice to have values for the open and closed positions stored in a PIV in the `Crane` class if we ever have to change them later. A simple toggle feature was used so one button sets the servo to an open position when closed and vice versa.
Next Steps
We could on some robot articulations later on, but a basic TeleOp program is good for now.