My first robot programming - Simple “Go” MSRDS First Beginner Course – STEP4 Young Joon Kim http://www.helloapps.com
Topics Preparing basic environment Simple “Go” drive “Go Forwards” drive “Go Backwards” drive Stopping a robot Going around Turning round
“Go” Drive Commands
“Go” Drive Commands Go Usages Range of motor power values Drive a robot with motor power Motor power is set with given value and keeps its value Usages robotname.Go() //default power is 0.2 robotname.Go(power) robotname.Go(left_power, right_power) Range of motor power values -1.0 (Max backwards) ~ 1.0 (Max forwards) 0: Stop the motor
“Go” Drive Commands Go forwards Go backwards Use the value above 0 Ex) robotname.Go() robotname.Go(0.3) robotname.Go(0.2, 0.2) Go backwards Use the negative value robotname.Go(-0.3) robotname.Go(-0.2, -0.2)
“Go” Drive Commands Stopping a robot Use the value 0 Ex) robotname.Go(0) robotname.Go(0, 0) robotname.Stop()
Preparing basic environment
Preparing basic environment Launch SPL and add “StartSimulationEngine” command 1 2 Double click
Preparing basic environment Expand “/FileName:” option Click + Expanded
Preparing basic environment Double click “SimState/basicsim.xml” Double click
Preparing basic environment Add “AddDifferentialDriveEntity” command on the “Entities” tab 1 Double click 2
Preparing basic environment Add “FlushScript” command on the Actions tab 1 2 Double click
Preparing basic environment Save as “script/SimpleGo.txt”
Preparing basic environment Run SPL by pressing “F5” key or clicking “Run (F5)” icon
Preparing basic environment Execution result
Simple “Go” drive
Simple “Go” drive Check available method for DriveEntity under the Actions tab
Simple “Go” drive base1.Go() How to use drive methods “robot_name” + “.” + method Ex) Robot name: “base1” Method: “.Go()” base1.Go()
Simple “Go” drive Add “base1.Go()” command as follows
Simple “Go” drive Run SPL by pressing “F5” key or clicking “Run” icon
“Go Forwards” drive
“Go Forwards” drive Change drive command as follows base1.Go() -> base1.Go(0.5) Left and right power will be set with 0.5
“Go Forwards” drive Change command as follows
“Go Forwards” drive Run SPL by pressing “F5” key or clicking “Run” icon
“Go Backwards” drive
“Go Backwards” drive Change drive command as follows base1.Go(0.5) -> base1.Go(-0.3) Left and right power will be set with -0.3
“Go Backwards” drive Change command as follows
“Go Backwards” drive Execution result
Stopping a robot
Stopping a robot Add time delay command Wait milliseconds Ex) wait 5 seconds Wait 5000
Stopping a robot Add “wait 5000” command as follows
Stopping a robot Add new drive command as follows base1.Go(0.0) Left and right power will be set with 0.0
Stopping a robot Add “base1.Go(0.0)” as follows
Stopping a robot Execution result Go backwards 1 Stop 2
Going around
Going around Change drive command as follows base1.Go(-0.3) -> base1.Go(0.2, 0.4) Left power will be set with 0.2 Right power will be set with 0.4
Going around Change command as follows
Going around Execution result
Turning round
Going around Change drive command as follows base1.Go(0.2, 0.4) -> base1.Go(-0.2, 0.2) Left power will be set with -0.2 Right power will be set with 0.2
Going around Change command as follows
Turning round Execution result