| |
Make a robot move itself
1. Add a drive command to make robot move itself
- You can drive a robot by using below method.
robotname.Drive(left_power, right_power)
- Left power and right power have the range of -1.0 ~ 1.0.
- Left power and right power will make robot move as follows.
0, 0  : Stop
1.0, 1.0  : Go forwards with maximum speed
-1.0, -1.0  : Go backwards with maximum speed
- Examples for drive options (left powerm and right power).
0.3, 0.3  : Go forwards with 0.3 power
-0.2, 0.2  : Turn left with 0.2 power
0.2, 0.3  : Go round with left direction
- Add a drive command to make a robot go forwards with 0.3 power.
| |
MFEmulator emul1
/TargetEmulator:SPLMFConsoleEmulator
StartSimulationEngine "SimState/basicenv4.xml"
AddDifferentialDriveEntity base1
FlushScript
base1.Go(0.3, 0.3)
| |
|
- Save script.
- Press "F5" key or click "Run" icon.
- You can see a mobile robot go forwards.
2. Make a robot go round
- Add a drive command to make a robot go forwards with 0.3 power.
| |
MFEmulator emul1
/TargetEmulator:SPLMFConsoleEmulator
StartSimulationEngine "SimState/basicenv4.xml"
AddDifferentialDriveEntity base1
FlushScript
base1.Go(0.2, 0.4)
| |
|
- Save script.
- Press "F5" key or click "Run" icon.
- You can see a mobile robot go round.
|