Through hardware configuration script you define the low level elements controlled by HBot. We will see how to do that through two examples: a simulated robot and a real-life two-wheels homemade robot.

Player/Stage simulated robot

For using the robot simulator, you must first learn a bit about Player/Stage. I start player with the following command:

player /usr/local/share/stage/worlds/simple.cfg &

The following luabot configuration file is tested against the “simple.cfg” world file from Stage.

controller{
  type = "player",
  name = "playerHAL",
  host = "localhost",
  port = 6665
} 
  
sensorcontrol{
  type = "laser",
  name = "playerlaser",
  controller =  "playerHAL",
  plugID = 0
} 
  
robot{
  name = "HBot",
  controller = "playerHAL",
  type = "playerrobot",
  plugID = 0
} 

Two-wheels "real-life" robot

controller{                                  
  type = "ssc32",
  name = "ssc32",
  device = "/dev/ttyUSB0",
  rate = 38400,                   
  analogicTimer = 40000               
}

cservo{   
  name = "leftwheel",
  controller = "ssc32",
  plugID = 12,                         
-- calibration settings for cservo are 2 tables, one for pulse, the other for speed 
-- in mm/s; in this example there are 11 entries per tables, 5 for backward speed, 
-- 1 for full stop, 5 for forward
  speedCalib = { 122,  121,   91,   73,   30,    0,  -29,  -81, -104, -146, -147},
  pulseCalib = {1800, 1690, 1630, 1600, 1560, 1530, 1490, 1450, 1410, 1370, 1250}
} 
  
cservo{                                   
  name = "rightwheel",                  
  controller = "ssc32",
  plugID = 8,
  speedCalib = {-122, -121,  -91,  -73,  -30,    0,   29,   81,  104,  146,  147},
  pulseCalib = {1800, 1690, 1630, 1600, 1560, 1540, 1490, 1450, 1410, 1370, 1250}
}

servo{ 
  name = "tower",
  controller = "ssc32",
  plugID = 0,
-- calibration settings for servo are 2 tables, one for pulse, the other for angle
-- in degrees; there are typically 3 entries per tables: leftmost, center, rightmost
  angleCalib = {-90,    0,   90},       
  pulseCalib = {500, 1500, 2200}
}

sensor{
  name = "sharp",
  controller = "ssc32",
  plugID = 3
}

sensorcontrol{
  type = "turretrangefinder",      
  name = "sweepingIR",
  servo = "tower",                
  sensor = "sharp"
}

robot{
  name = "HBot",
  controller = "ssc32",                  
  type = "wheeledrobot",
  left = "leftwheel",
  right = "rightwheel",
-- calibration settings for rotation; CW stands for clockwise rotation speed, CCW for
-- counterclockwise; speed is given in degrees per seconds
  angularspeed = {CW = 45, CCW = 40}
}
 
hardware_configuration_example.txt · Last modified: 2009/03/03 13:55 by hadrien
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS La rache Driven by DokuWiki