Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Switchable amosII (configuration for amosIIv1 and amosIIv2) working

  • Loading branch information...
commit 4ac5b50faffca932351dcffcc9977275f6ed8b1f 1 parent 88f0938
authored April 25, 2012
297  ode_robots/robots/amosII.cpp
@@ -1308,6 +1308,14 @@ namespace lpzrobots {
1308 1308
   }
1309 1309
 
1310 1310
   AmosIIConf AmosII::getDefaultConf(
  1311
+     double _scale,
  1312
+     bool _useShoulder,
  1313
+     bool _useFoot,
  1314
+     bool _useBack)
  1315
+     {
  1316
+  	    return getAmosIIv2Conf (_scale, _useShoulder,_useFoot,_useBack);
  1317
+      }
  1318
+  AmosIIConf AmosII::getAmosIIv2Conf(
1311 1319
       double _scale,
1312 1320
       bool _useShoulder,
1313 1321
       bool _useFoot,
@@ -1326,7 +1334,7 @@ namespace lpzrobots {
1326 1334
     c.useLocalVelSensor = 0;
1327 1335
     c.legContactSensorIsBinary = false;
1328 1336
 
1329  
-    // the trunk length. this scales the whole robot! all parts' sizes,
  1337
+    // the trunk lenAmosIIConf c;gth. this scales the whole robot! all parts' sizes,
1330 1338
     // masses, and forces will be adapted!!
1331 1339
     c.size = 0.43 * _scale;
1332 1340
     //trunk width
@@ -1525,68 +1533,72 @@ namespace lpzrobots {
1525 1533
 
1526 1534
 
1527 1535
   AmosIIConf AmosII::getAmosIIv1Conf(
1528  
-        double _scale,
1529  
-        bool _useShoulder,
1530  
-        bool _useFoot,
1531  
-        bool _useBack)
1532  
-        {
1533  
-      AmosIIConf c;
1534  
-
1535  
-      // use shoulder (fixed joint between legs and trunk)
1536  
-      c.useShoulder = _useShoulder;
1537  
-      c.useTebiaJoints = 0;
1538  
-      //create springs at the end of the legs
1539  
-      c.useFoot = _useFoot;
1540  
-      //create a joint in the back
1541  
-      c.useBack = _useBack;
1542  
-      c.rubberFeet = false;
1543  
-      c.useLocalVelSensor = 0;
1544  
-
1545  
-      // the trunk length. this scales the whole robot! all parts' sizes,
1546  
-      // masses, and forces will be adapted!!
1547  
-      c.size = 0.43 * _scale;
1548  
-      //trunk width
1549  
-      c.width = 7.0 / 43.0 * c.size;
1550  
-      //trunk height
  1536
+                double _scale,
  1537
+                bool _useShoulder,
  1538
+                bool _useFoot,
  1539
+                bool _useBack)
  1540
+                {
  1541
+        	  AmosIIConf c= getAmosIIv2Conf(_scale, _useShoulder,_useFoot,_useBack);
  1542
+
  1543
+
  1544
+//      AmosIIConf c;
  1545
+//
  1546
+//      // use shoulder (fixed joint between legs and trunk)
  1547
+//      c.useShoulder = _useShoulder;
  1548
+//      c.useTebiaJoints = 0;
  1549
+//      //create springs at the end of the legs
  1550
+//      c.useFoot = _useFoot;
  1551
+//      //create a joint in the back
  1552
+//      c.useBack = _useBack;
  1553
+//      c.rubberFeet = false;
  1554
+//      c.useLocalVelSensor = 0;
  1555
+//      c.legContactSensorIsBinary = false;
  1556
+//
  1557
+//      // the trunk length. this scales the whole robot! all parts' sizes,
  1558
+//      // masses, and forces will be adapted!!
  1559
+//      c.size = 0.43 * _scale;
  1560
+//      //trunk width
  1561
+//      c.width = 7.0 / 43.0 * c.size;
  1562
+//      //trunk height
1551 1563
       c.height = /*6.5*/ 8.5/ 43.0 * c.size;//---------------------------------------------------AMOSIIv1
1552  
-      c.frontLength = 12.0 / 43.0 * c.size;
1553  
-      // we use as density the original trunk weight divided by the original
1554  
-      // volume
1555  
-
1556  
-      const double density = 2.2 / (0.43 * 0.07 * 0.065);
1557  
-
1558  
-      c.trunkMass = density * c.size * c.width * c.height;
1559  
-      // use the original trunk to total mass ratio
1560  
-      const double mass = 5.758 / 2.2 * c.trunkMass;
1561  
-      c.frontMass = c.trunkMass * c.frontLength / c.size;
1562  
-      // distribute the rest of the weight like this for now */
1563  
-      c.shoulderMass = (mass - c.trunkMass)
1564  
-          / (6 * (3.0 + c.useShoulder))
1565  
-          * (20.0 - c.useFoot)
1566  
-          / 20.0;
1567  
-      c.coxaMass = c.shoulderMass;
1568  
-      c.secondMass = c.shoulderMass;
1569  
-      c.tebiaMass = c.shoulderMass;
1570  
-      // foot gets 3 or 4 times 1/20 of shoulderMass (divide and multiply by
1571  
-      // 3 or 4)
1572  
-      c.footMass = (mass - c.trunkMass) / 6 * c.useFoot / 20.0;
1573  
-
1574  
-      //As real robot!!
1575  
-      const double shoulderHeight_cm = 6.5;
1576  
-      //shoulder height "4.5 wrong" --> correct=6.5 cm from rotating point
1577  
-      c.shoulderHeight = shoulderHeight_cm / 6.5 * c.height;
1578  
-
1579  
-      // distance between hindlegs and middle legs
1580  
-      c.legdist1 = 19.0 / 43.0 * c.size;
1581  
-      // distance between middle legs and front legs
1582  
-      c.legdist2 = 15.0 / 43.0 * c.size;
1583  
-
1584  
-      // configure the wheels (if used). They don't have any counterpart in
1585  
-      // reality, so the chosen values are arbitrary
1586  
-      c.wheel_radius = 0.10 * c.size;
1587  
-      c.wheel_width  = 0.04 * c.size;
1588  
-      c.wheel_mass   = (mass-c.trunkMass) / 6.0;
1589  
-
  1564
+//      c.frontLength = 12.0 / 43.0 * c.size;
  1565
+//      // we use as density the original trunk weight divided by the original
  1566
+//      // volume
  1567
+//
  1568
+//      const double density = 2.2 / (0.43 * 0.07 * 0.065);
  1569
+//
  1570
+//      c.trunkMass = density * c.size * c.width * c.height;
  1571
+//      // use the original trunk to total mass ratio
  1572
+//      const double mass = 5.758 / 2.2 * c.trunkMass;
  1573
+//      c.frontMass = c.trunkMass * c.frontLength / c.size;
  1574
+//      // distribute the rest of the weight like this for now */
  1575
+//      c.shoulderMass = (mass - c.trunkMass)
  1576
+//          / (6 * (3.0 + c.useShoulder))
  1577
+//          * (20.0 - c.useFoot)
  1578
+//          / 20.0;
  1579
+//      c.coxaMass = c.shoulderMass;
  1580
+//      c.secondMass = c.shoulderMass;
  1581
+//      c.tebiaMass = c.shoulderMass;
  1582
+//      // foot gets 3 or 4 times 1/20 of shoulderMass (divide and multiply by
  1583
+//      // 3 or 4)
  1584
+//      c.footMass = (mass - c.trunkMass) / 6 * c.useFoot / 20.0;
  1585
+//
  1586
+//      //As real robot!!
  1587
+//      const double shoulderHeight_cm = 6.5;
  1588
+//      //shoulder height "4.5 wrong" --> correct=6.5 cm from rotating point
  1589
+//      c.shoulderHeight = shoulderHeight_cm / 6.5 * c.height;
  1590
+//
  1591
+//      // distance between hindlegs and middle legs
  1592
+//      c.legdist1 = 19.0 / 43.0 * c.size;
  1593
+//      // distance between middle legs and front legs
  1594
+//      c.legdist2 = 15.0 / 43.0 * c.size;
  1595
+//
  1596
+//      // configure the wheels (if used). They don't have any counterpart in
  1597
+//      // reality, so the chosen values are arbitrary
  1598
+//      c.wheel_radius = 0.10 * c.size;
  1599
+//      c.wheel_width  = 0.04 * c.size;
  1600
+//      c.wheel_mass   = (mass-c.trunkMass) / 6.0;
  1601
+//
1590 1602
       // -----------------------
1591 1603
       // 1) Biomechanics
1592 1604
       // Manual setting adjustable joint positions at the body
@@ -1622,30 +1634,30 @@ namespace lpzrobots {
1622 1634
       c.rLegTrunkAngleH = 3.1416/6;//---------------------------------------------------AMOSIIv1
1623 1635
       // => till
1624 1636
       c.rLegRotAngle = 0.0;
1625  
-
1626  
-
1627  
-      // be careful changing the following dimension, they may break the
1628  
-      // simulation!! (they shouldn't but they do)
1629  
-      const double shoulderLength_cm = 4.5;
1630  
-      c.shoulderLength = shoulderLength_cm / 43.0 * c.size;
1631  
-      c.shoulderRadius = .03 * c.size;
1632  
-
1633  
-      const double coxaLength_cm = 3.5;
1634  
-      c.coxaLength = coxaLength_cm / 43.0 * c.size;
1635  
-      c.coxaRadius = .04 * c.size;
1636  
-
1637  
-      const double secondLength_cm = 6.0;
1638  
-      c.secondLength = secondLength_cm / 43.0 * c.size;
1639  
-      c.secondRadius = .03 * c.size;
1640  
-      c.tebiaRadius = 1.3 / 43.0 * c.size;
1641  
-
1642  
-      const double tebiaLength_cm = 11.5; // 3)
1643  
-      c.tebiaLength = tebiaLength_cm / 43.0 * c.size;
1644  
-
1645  
-      // this determines the limit of the footspring
1646  
-      c.footRange = .2 / 43.0 * c.size;
1647  
-      c.footRadius = 1.5 / 43.0 * c.size;
1648  
-
  1637
+//
  1638
+//
  1639
+//      // be careful changing the following dimension, they may break the
  1640
+//      // simulation!! (they shouldn't but they do)
  1641
+//      const double shoulderLength_cm = 4.5;
  1642
+//      c.shoulderLength = shoulderLength_cm / 43.0 * c.size;
  1643
+//      c.shoulderRadius = .03 * c.size;
  1644
+//
  1645
+//      const double coxaLength_cm = 3.5;
  1646
+//      c.coxaLength = coxaLength_cm / 43.0 * c.size;
  1647
+//      c.coxaRadius = .04 * c.size;
  1648
+//
  1649
+//      const double secondLength_cm = 6.0;
  1650
+//      c.secondLength = secondLength_cm / 43.0 * c.size;
  1651
+//      c.secondRadius = .03 * c.size;
  1652
+//      c.tebiaRadius = 1.3 / 43.0 * c.size;
  1653
+//
  1654
+//      const double tebiaLength_cm = 11.5; // 3)
  1655
+//      c.tebiaLength = tebiaLength_cm / 43.0 * c.size;
  1656
+//
  1657
+//      // this determines the limit of the footspring
  1658
+//      c.footRange = .2 / 43.0 * c.size;
  1659
+//      c.footRadius = 1.5 / 43.0 * c.size;
  1660
+//
1649 1661
       // -----------------------
1650 1662
       // 2) Joint Limits
1651 1663
       // Setting Max, Min of each joint with respect to real
@@ -1683,62 +1695,63 @@ namespace lpzrobots {
1683 1695
       c.tebiaJointLimitD = M_PI / 180.0 * 140.0;
1684 1696
       //15 deg  downward; (+) MAX --> normal walking range 120 deg MAX
1685 1697
       c.tebiaJointLimitU = M_PI / 180.0 * 15.0;
1686  
-
1687  
-
1688  
-
1689  
-      // -----------------------
1690  
-      // 3) Motors
1691  
-      // Motor power and joint stiffness
1692  
-      // -----------------------
1693  
-
1694  
-      c.footSpringPreload = 8.0 / 43.0 * c.size;
1695  
-      // negative is downwards (spring extends)
1696  
-      c.footSpringLimitD = c.footSpringPreload;
1697  
-      c.footSpringLimitU = c.footSpringPreload + c.footRange;
1698  
-
1699  
-      const double backPower_scale = 30.0;
1700  
-      const double coxaPower_scale = 10.0;
1701  
-      const double springstiffness = 350.0;
1702  
-
1703  
-      // use an original radius and mass and scale original torque by their
1704  
-      // new values to keep acceleration constant
1705  
-      c.backPower = backPower_scale * (1.962 / (0.035 * 2.2))
1706  
-          * c.coxaLength * c.trunkMass;
1707  
-      // torque in Nm
1708  
-      c.coxaPower = coxaPower_scale * (1.962 / (0.035 * 2.2))
1709  
-          * c.coxaLength * c.trunkMass;
1710  
-      c.secondPower = c.coxaPower;
1711  
-      c.tebiaPower = c.coxaPower;
1712  
-      // this is the spring constant. To keep  acceleration for the body
1713  
-      // constant, we use the above unscaled preload of 0.08 and original
1714  
-      // trunkMass to and then multiply by the new ones
1715  
-      c.footPower = (springstiffness * 0.08 / 2.2)
1716  
-          * c.trunkMass / c.footSpringPreload;
1717  
-
1718  
-      c.backDamping = 0.0;
1719  
-      // Georg: no damping required for new servos
1720  
-      c.coxaDamping = 0.0;
1721  
-      c.secondDamping = 0.0;
1722  
-      c.tebiaDamping = 0.01;
1723  
-      c.footDamping = 0.05; // a spring has no damping??
1724  
-
1725  
-      c.backMaxVel = 1.961 * M_PI;
1726  
-      // The speed calculates how it works
1727  
-      c.coxaMaxVel = 1.961 * M_PI;
1728  
-      c.secondMaxVel = 1.961 * M_PI;
1729  
-      c.tebiaMaxVel = 1.961 * M_PI;
1730  
-      c.footMaxVel = 1.961 * M_PI;
1731  
-
1732  
-      c.usRangeFront = 0.3 * c.size;
1733  
-      c.irRangeLeg = 0.2 * c.size;
1734  
-
1735  
-      //Values by Dennis
1736  
-      // 1 is parallel, -1 is antiparallel
1737  
-      c.usParallel = false;
1738  
-      c.usAngleX = 0.5;
1739  
-      c.usAngleY = 1;
1740  
-
1741  
-      c.texture = "Images/toy_fur3.jpg";
  1698
+//
  1699
+//
  1700
+//
  1701
+//      // -----------------------
  1702
+//      // 3) Motors
  1703
+//      // Motor power and joint stiffness
  1704
+//      // -----------------------
  1705
+//
  1706
+//      c.footSpringPreload = 8.0 / 43.0 * c.size;
  1707
+//      // negative is downwards (spring extends)
  1708
+//      c.footSpringLimitD = c.footSpringPreload;
  1709
+//      c.footSpringLimitU = c.footSpringPreload + c.footRange;
  1710
+//
  1711
+//      const double backPower_scale = 30.0;
  1712
+//      const double coxaPower_scale = 10.0;
  1713
+//      const double springstiffness = 350.0;
  1714
+//
  1715
+//      // use an original radius and mass and scale original torque by their
  1716
+//      // new values to keep acceleration constant
  1717
+//      c.backPower = backPower_scale * (1.962 / (0.035 * 2.2))
  1718
+//          * c.coxaLength * c.trunkMass;
  1719
+//      // torque in Nm
  1720
+//      c.coxaPower = coxaPower_scale * (1.962 / (0.035 * 2.2))
  1721
+//          * c.coxaLength * c.trunkMass;
  1722
+//      c.secondPower = c.coxaPower;
  1723
+//      c.tebiaPower = c.coxaPower;
  1724
+//      // this is the spring constant. To keep  acceleration for the body
  1725
+//      // constant, we use the above unscaled preload of 0.08 and original
  1726
+//      // trunkMass to and then multiply by the new ones
  1727
+//      c.footPower = (springstiffness * 0.08 / 2.2)
  1728
+//          * c.trunkMass / c.footSpringPreload;
  1729
+//
  1730
+//      c.backDamping = 0.0;
  1731
+//      // Georg: no damping required for new servos
  1732
+//      c.coxaDamping = 0.0;
  1733
+//      c.secondDamping = 0.0;
  1734
+//      c.tebiaDamping = 0.01;
  1735
+//      c.footDamping = 0.05; // a spring has no damping??
  1736
+//
  1737
+//      c.backMaxVel = 1.961 * M_PI;
  1738
+//      // The speed calculates how it works
  1739
+//      c.coxaMaxVel = 1.961 * M_PI;
  1740
+//      c.secondMaxVel = 1.961 * M_PI;
  1741
+//      c.tebiaMaxVel = 1.961 * M_PI;
  1742
+//      c.footMaxVel = 1.961 * M_PI;
  1743
+//
  1744
+//      c.usRangeFront = 0.3 * c.size;
  1745
+//      c.irRangeLeg = 0.2 * c.size;
  1746
+//
  1747
+//      //Values by Dennis
  1748
+//      // 1 is parallel, -1 is antiparallel
  1749
+//      c.usParallel = false;
  1750
+//      c.usAngleX = 0.5;
  1751
+//      c.usAngleY = 1;
  1752
+//
  1753
+//      c.texture = "Images/whiteground.rgb";
  1754
+//      c.bodyTexture = "Images/stripes.rgb";
1742 1755
 
1743 1756
       return c;
1744 1757
     }
8  ode_robots/robots/amosII.h
@@ -310,13 +310,19 @@ namespace lpzrobots {
310 310
       /**
311 311
        * Returns the default configuration values
312 312
        */
  313
+      static AmosIIConf getDefaultConf(
  314
+          double _scale = 1.0,
  315
+          bool _useShoulder = 1,
  316
+          bool _useFoot = 1,
  317
+          bool _useBack = 0);
  318
+
313 319
       static AmosIIConf getAmosIIv1Conf(
314 320
           double _scale = 1.0,
315 321
           bool _useShoulder = 1,
316 322
           bool _useFoot = 1,
317 323
           bool _useBack = 0);
318 324
 
319  
-      static AmosIIConf getDefaultConf(
  325
+      static AmosIIConf getAmosIIv2Conf(
320 326
           double _scale = 1.0,
321 327
           bool _useShoulder = 1,
322 328
           bool _useFoot = 1,

0 notes on commit 4ac5b50

Please sign in to comment.
Something went wrong with that request. Please try again.