420 likes | 663 Views
SPL basic – Add Mobile Robots. SPL First Beginner Course – 05. Young Joon Kim http://www.helloapps.com. Topics. Add DifferentialDrive mobile robot Drive DifferentialDrive mobile robot Add FourByFourDrive mobile robot Drive FourByFourDrive mobile robot. Mobile robot entities in SPL.
E N D
SPL basic – Add Mobile Robots SPL First Beginner Course – 05 Young Joon Kim http://www.helloapps.com
Topics • Add DifferentialDrive mobile robot • Drive DifferentialDrive mobile robot • Add FourByFourDrive mobile robot • Drive FourByFourDrive mobile robot
Mobile robot entities in SPL • DifferentialDrivemobile robot • Two wheels • One caster • FourByFourDrive mobile robot • Four wheels
Add DifferentialDrive entity • Start with “StartSimulationEngine” and “SimState/basicsim.xml” Double-Click Double-Click
Add DifferentialDrive entity • Select “Entities” tab • Add “AddDifferentialDriveEntity” command by double-clicking 1 2 Double-Click
Add DifferentialDrive entity • Run script Press “F2” key
Drive DifferentialDrive entity • Select “Services” tab • Add “SimpleDashboard” command by double-clicking 1 2 Double-Click
Drive DifferentialDrive entity • Run script Drag a mouse 4 Click 1 3 2 Click Double-Click
Drive DifferentialDrive entity • Executed result
Drive DifferentialDrive entity with script
Drive DifferentialDrive entity with script • Remove “SimpleDashboard” command line remove
Drive DifferentialDrive entity with script • Select “Action” tab menu • Add “FlushScript” command by double-clicking 1 2 Double-Click
Drive DifferentialDrive entity with script • Type “base1”
Drive DifferentialDrive entity with script • Find “[DifferentialDrive Commands]” item • Expand “[Method]” item by double-clicking Double-Click
Drive DifferentialDrive entity with script • Add “Go(left, right)” command by double-clicking Double-Click
Drive DifferentialDrive entity with script • Run script
Drive DifferentialDrive entity with script • Go Forwards commands • base1.Go() • base1.Go(0.5) • base1.Go(0.5, 0.5) • base1.SetDrivePower(0.5, 0.5)
Drive DifferentialDrive entity with script • Turn commands • base1.Go(-0.5, 0.5) • Base1.Go(0.2, 0.5) • base1.SetDrivePower(-0.5, 0.5) • base1.Turn(90, 0.3) //turn 90 degrees with 0.3 power • base1.RotateDegrees(90, 0.3)
Drive DifferentialDrive entity with script • Go Distance commands • base1.GoTo(2.0, 0.5) //Go forwards 2.0m with 0.5 power • base1.DriveDistance(2.0, 0.5)
Drive DifferentialDrive entity with script • Go Duration commands • base1.GoFo(0.5, 0.5, 1000) • Go with 0.5 power during 1000 milliseconds • After duration time, robot keeps its power
Drive DifferentialDrive entity with script • Stop robot commands • base1.Stop() • base1.Go(0) • base1.Go(0, 0) • Base1.GoFor(0, 0, 1000) //keep stop during 1 second
Drive DifferentialDrive entity with script • Apply multi-drive-commands
Add FourByFourDrive entity • Start with “StartSimulationEngine” and “SimState/basicsim.xml”
Add FourByFourDrive entity • Select “Entities” tab • Add “AddFourByFourEntity” command by double-clicking 1 2 Double-Click
Add FourByFourDrive entity • Run script
Add body for FourByFourEntity • Add “AddNewEntity” command Double-Click
Add body for FourByFourEntity • Add “/ParentEntity:” option Double-Click
Add body for FourByFourEntity • Type “car1”
Add body for FourByFourEntity • Add “AddBoxShape” command
Add body for FourByFourEntity • Modify dimensions as follows
Add body for FourByFourEntity • Run script
Drive FourByFourEntity • Select “Action” tab menu • Add “FlushScript” command by double-clicking 1 2 Double-Click
Drive FourByFourEntity • Type “car1”
Drive FourByFourEntity • Find “[FourByFourDrive Commands]” and expand “[Method]” • Add “.Drive(steerAngle, power)” method by double-clicking Double-Click
Drive FourByFourEntity • Run script
Drive FourByFourEntity • Steer 30 degrees
Drive FourByFourEntity • Multi-drive-commands