Compare commits
No commits in common. "5ab59b9d1b2870a5aae7af0e45aeaca6af274c80" and "f1f98189aefce321bf6598e529103ae65b34a524" have entirely different histories.
5ab59b9d1b
...
f1f98189ae
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1989654e8505b074d9a0280de8649b7d
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: db5f4144ac032d649994939f1d833737
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: dd31613f75db97f4ca4d408bfce69746
|
|
||||||
TextScriptImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 186de70a0b3d098409ce1a5ec887b1ae
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,31 +0,0 @@
|
|||||||
using System.Threading;
|
|
||||||
using RoboidControl;
|
|
||||||
|
|
||||||
class BB2B {
|
|
||||||
static void Main() {
|
|
||||||
// The robot's propulsion is a differential drive
|
|
||||||
DifferentialDrive bb2b = new();
|
|
||||||
// It has a touch sensor at the front left of the roboid
|
|
||||||
TouchSensor touchLeft = new(bb2b);
|
|
||||||
// and other one on the right
|
|
||||||
TouchSensor touchRight = new(bb2b);
|
|
||||||
|
|
||||||
// Do forever:
|
|
||||||
while (true) {
|
|
||||||
// The left wheel turns forward when nothing is touched on the right side
|
|
||||||
// and turn backward when the roboid hits something on the right
|
|
||||||
float leftWheelSpeed = touchRight.touchedSomething ? -600.0f : 600.0f;
|
|
||||||
// The right wheel does the same, but instead is controlled by
|
|
||||||
// touches on the left side
|
|
||||||
float rightWheelSpeed = touchLeft.touchedSomething ? -600.0f : 600.0f;
|
|
||||||
// When both sides are touching something, both wheels will turn backward
|
|
||||||
// and the roboid will move backwards
|
|
||||||
bb2b.SetWheelVelocity(leftWheelSpeed, rightWheelSpeed);
|
|
||||||
|
|
||||||
// Update the roboid state
|
|
||||||
bb2b.Update(true);
|
|
||||||
// and sleep for 100ms
|
|
||||||
Thread.Sleep(100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user