TigerJython4Kids
 robotics
Deutsch   English   

Documentation mbRobot/mbRobotPlus/mbRobotPlusV2

Module mbRobot / mbrobot_plus / mbrobot_plusV2

Modul import:
from mbrobot import *
/ from mbrobot_plus import * / from mbrobot_plusV2 import *

Real-aund Simultion mode

Function Action
forward() sets the robot in forward motion
backward() sets the robot in backward motion
left() sets the robot in a left turn (one motor in forward, the other in backward rotation)
right() sets the robot in a right turn (one motor in forward, the other in backward rotation)
leftArc(radius) sets the Maqueen to a left curve with given radius (in m)
rightArc(radius) sets the Maqueen to a right curve with given radius (in m)
stop() stops the movement
setSpeed(speed)

sets the speed for all movements (0..100)

calibrate(offset, differential, arcScaling)
(only real mode)

calibrates motors, if the robot does not drive straight
offset: minimal power of the motors (-10 to 50)
differential: Adjusts power difference of left and right Wheel (-150 to 150),
if a robot steers left when driving forward < 0, if steers right > 0
arcScalling: Adjusts the radius by leftArc() or rightArc() (values -50 to 50), if radius to laarge > 0, if radius to small < 0

setPID(1) [only mbrobot_plus, real mode]

reduces the speed, the robot moves slower (at walking pace)

setPID(0) [nur mbrobot_plus, real mode]

PID is switched off, robot moves at given speed

getDistance() returns the distance (in mm) measured with the ultrasonic sensor
irLeft.read_digital(), irRight.readDigital() infrared sensors return 0, if floor is dark; 1, if floor is bright
Maqueen PlusV2 has 5 IR-Sensors (irL1, irR1, irL2, irR2, irM)
Maqueen Plus has 6 IR-Sensors ((irL1, irR1, irL2, irR2, irL3, irR3)
irX.read_digital() return 0 or 1
setLED(1) turns LEDs on
mbRobot_plus has 7 colors(1:rot, 2:grün, 3:gelb, 4:blau, 5:pink, 6:cyan, 7:weiss)
setLED(0) turns LEDs off
setLEDLeft(n)

turns left LED on (n = 1) or off (n = 0)

setLEDRight(n)

turns the right LED on (n = 1) or off (n = 0)

setAlarm(1) sets alarm on
setAlarm(0) sets alarm off
setServo(port, angle) urns the servomotor connected to port S1 or S2 (or P1 or P2) to the specified angular position. (0 <= angle <= 180)
playTone(freq, duration) plays a tone of a given frequency and duration
RobotContext.
enableTrace(True) [only S]
robot leaves traces
RobotContext.
enableRotCenter(True) [only S]
draws the center of rotation for movements on a circular arc
RobotContext.
useBackground("sprite") [only S]
adds a background image for the simulation with light or color sensors
RobotContext.
setStartPosition(x, y) [only S]
places the simulated robot at the position (x, y) in the graphics window
RobotContext.
setStartDirection(w) [only S]
determines the start direction (0: east, 90: north, 180: west, 270: south)
RobotContext.
useObstacle("sprite", x, y) [only S]
adds an image with transparent background at position x,y
setBeamAreaColor() [only S] sets the color of the beam area boundaries
setProximityCircleColor() [only S] sets the color of the proximity circle
setMeshTriangleColor() [only S] sets the color of the mesh triangles
eraseBeamArea() [only S] erases the beam area boundaries


Modul mbrobotmot(switch motors individually)
(real- and simulation mode)
Modul import: from mbrobotmot import *
Modul import: from mbrorobot_plus import *
Modul import: from mbrorobot_plusV2 import *

motL, motR motor left, motor right
motX.rotate(speed) sets the left or right motor in motion with the rotation speed speed. For speed > 0 forwards, for speed < 0 backwards, speed = 0 stops the rotation