Monday, March 7, 2016

SciBorg

Task:

Use Arduino to code a SciBorg to move.
My partner, Jennifer, and I installed Bricktronics Lego NXT shield onto the Arduino connected to our Sciborg machine.  Using NXT cables, we connected motors 1 and 2 to the motor ports and connected a switch to the battery pack which was then inserted into a DC jack connected to the Arduino.

Here is what our SciBorg looked like with the Bricktronics Lego NXT.


Both Motors:

Using a downloaded BareMinimum code, we modified the code to run both motors at the same speed simultaneously.

In the loop, each paragraph of code contains commands to move motor 1 and motor 2 simultaneously before a delay() telling those two motors to go at a certain speed.

The speed of the motors is coded in m1.setFixedDrive() and m2.setFixedDrive().   The lower the number, the slower the speed of the motor.  The direction of the motor is determined by the sign (+) or (-) in front of the numbers for the speed of the motors.

While the motors were running, we coded the serial to print out what the motor was currently doing, whether going slow and speeding up or going forward or in reverse.





Minimum Speed:

Our next task was to determine the minimum speed at which the SciBorg would still move.

Initially, we set our value to 75.  While holding our SciBorg in the air, the wheels would turn, but once we set the SciBorg down, the speed was not powerful enough to move the robot.

We increased the speed to 100 which in turn did move our SciBorg but at a very slow speed.

The minimum speed required for the SciBorg to move is 100.



Hard Turn:

In order to get our SciBorg to make a hard turn, we set the speed of the motors to the maximum with a speed of 255 but in opposite directions.

This is similar to thinking about turning a two person canoe.  While one person rows on one side, the other person rows on the other side resulting in the canoe to turn in stationary circles.



Soft Turn:

We recorded two different types of soft turn.

The first soft turn is the SciBorg doing the same thing as a hard turn but at a slower speed.  We changed the speed of 255 and -255 to 125 and -125.  The lines of code for soft turn read:



Our second soft turn is where both motors go in the same direction but at different speeds, resulting in our SciBorg to turn in a circular path.





10 Feet:

Our last task was to time how long it takes for our SciBorg to travel 10 feet.  Taking that information, Jennifer and I coded our SciBorg to move forward for that amount of time, hoping for the SciBorg to reach and stop at the finish line.

Our Sciborg took 11 seconds to move 10 meters.  In our continuous loop, we coded the SciBorg to move for 11 seconds at a speed of 255: if (mills() <=11000).  Once 11 seconds - 11,0000 milliseconds - hit, both motors 1 and 2 would turn off, stopping the SciBorg.


First Trial:

Our first trial turned out pretty well, disregarding the non-straight path of our SciBorg.  The SciBorg stopped about 2 inches short of the finish line.  In every trail afterwards, excluding the last trial, our SciBorg would travel to the right.  We concluded the curved path of our SciBorg was due to different motor speeds, or the unnoticeable incline or decline of the ground.


Last Trial:

Our SciBorg's last trail run traveled in a straight line.  However, the SciBorg stopped 8 inches before the 10 feet mark.  As you can see in the video, we even set up blocks and pipes on the side of the SciBorg for it to move in a straight line;  in the end the blocks and pipes were not used as the SciBorg coincidentally moved in a straight line right after we set up the blocks.




1 comment:

  1. I really like how you thought to set up blocks in order to get your SciBorg to move straight!

    ReplyDelete