Active links mask length in a modified robot

Hi,

I am trying to make a modified Poppy Torso on a Raspberry Pi 3, working on poppy.local.

In this modified Torso, the motors 43, 44, 53, 54 are removed, and the motors 33, 34, 35 are replaced by MX106 ones. The robot configuration file has been modified, including putting MX106 instead of MX28 for the considered motors.

But when I try initializing the robot, I have the following message : “Your active links mask length of 7 is different from the number of your links, which is 9”. It’s the first time I see this one. Has someone any idea of what it means and how to solve it ?

Attempt 1 to start the robot...
SnapRobotServer is now running on: http://0.0.0.0:6969

You can open Snap! interface with loaded blocks at "http://snap.berkeley.edu/snapsource/snap.html#open:http://192.168.0.166:6969/snap-blocks.xml"

HTTPRobotServer is now running on: http://0.0.0.0:8080

Your active links mask length of 7 is different from the number of your links, which is 9
Attempt 2 to start the robot...
Connection to the robot failed! No suitable port found for ids [33, 34, 35, 36, 37, 41, 42, 51, 52]. These ids are missing [33, 34, 35, 36, 37, 41, 42, 51, 52] !
Attempt 3 to start the robot...
Connection to the robot failed! No suitable port found for ids [33, 34, 35, 36, 37, 41, 42, 51, 52]. These ids are missing [33, 34, 35, 36, 37, 41, 42, 51, 52] !
Attempt 4 to start the robot...
Connection to the robot failed! No suitable port found for ids [33, 34, 35, 36, 37, 41, 42, 51, 52]. These ids are missing [33, 34, 35, 36, 37, 41, 42, 51, 52] !
Attempt 5 to start the robot...
Connection to the robot failed! No suitable port found for ids [33, 34, 35, 36, 37, 41, 42, 51, 52]. These ids are missing [33, 34, 35, 36, 37, 41, 42, 51, 52] !
Could not start up the robot...
Traceback (most recent call last):
  File "/home/poppy/miniconda/bin/poppy-services", line 6, in 
    sys.exit(main())
  File "/home/poppy/miniconda/lib/python2.7/site-packages/poppy/creatures/services_launcher.py", line 179, in main
    with closing(start_poppy_with_services(args)):
  File "/home/poppy/miniconda/lib/python2.7/site-packages/poppy/creatures/services_launcher.py", line 38, in start_poppy_with_services
    raise exc_inst
IOError: Connection to the robot failed! No suitable port found for ids [33, 34, 35, 36, 37, 41, 42, 51, 52]. These ids are missing [33, 34, 35, 36, 37, 41, 42, 51, 52] !

When I electronically remove a motor (for example the 37), I have the “good error” that tells that the ID 37 is missing. The “active link” error only happens when all the motors are detected.

Here is the configuration file, which is in /miniconda/lib/python2.7/site-packages/poppy_torso/configuration/poppy_torso.json :

{
  "controllers": {
    "upper_body_controller": {
      "sync_read": true, 
      "attached_motors": [
        "torso",
        "head",
        "arms"
      ],
      "port": "auto"
    }
  },
  "motorgroups": {
    "head": [
      "head_z",
      "head_y"
    ],
    "r_arm": [
      "r_shoulder_y",
      "r_shoulder_x"
    ],
    "torso": [
      "abs_z",
      "bust_y",
      "bust_x"
    ],
    "l_arm": [
      "l_shoulder_y",
      "l_shoulder_x"
    ],
    "arms": [
      "l_arm",
      "r_arm"
    ]
  },
  "motors": {
    "head_y": { 
      "offset": 20.0,
      "type": "AX-12",
      "id": 37,
      "angle_limit": [
        -40,
        8
      ],
      "orientation": "indirect"
    },
    "head_z": { 
      "offset": 0.0,
      "type": "AX-12",
      "id": 36,
      "angle_limit": [
        -100,
        100
      ],
      "orientation": "direct"
    },
    "r_shoulder_x": {
      "offset": 90.0,
      "type": "MX-28",
      "id": 52,
      "angle_limit": [
        -110,
        105
      ],
      "orientation": "indirect"
    },
    "r_shoulder_y": {
      "offset": 90,
      "type": "MX-28",
      "id": 51,
      "angle_limit": [
        -155,
        120
      ],
      "orientation": "indirect"
    },
    "abs_z": {
      "offset": 0.0,
      "type": "MX-106",
      "id": 33,
      "angle_limit": [
        -80,
        80
      ],
      "orientation": "direct"
    },
    "bust_y": {
      "offset": 0.0,
      "type": "MX-106",
      "id": 34,
      "angle_limit": [
        -46,
        23
      ],
      "orientation": "indirect"
    },
    "bust_x": {
      "offset": 0.0,
      "type": "MX-106",
      "id": 35,
      "angle_limit": [
        -40,
        40
      ],
      "orientation": "indirect"
    },
    "l_shoulder_x": {
      "offset": -90.0,
      "type": "MX-28",
      "id": 42,
      "angle_limit": [
        -105,
        110
      ],
      "orientation": "indirect"
    },
    "l_shoulder_y": {
      "offset": 90,
      "type": "MX-28",
      "id": 41,
      "angle_limit": [
        -120,
        155
      ],
      "orientation": "direct"
    }
  }
}

Did you copy the wrong traceback (this one seems not relevant to your issue) ?
I never had this issue neither, but is is something which come from ikpy as you should have read it in the traceback.

The easier way if you don’t use the inverse kinematics is to modify poppy_torso.py and remove IkChain occurrence.

Actually, it is the issue I have in the http://poppy.local/logs

I have written a fast program in ipython notebooks :

import pypot
from poppy_torso import PoppyTorso
pop = PoppyTorso(use_http=True, start_services=True)

The issue is :

 HTTPRobotServer is now running on: http://0.0.0.0:8080

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-4ed868ef090d> in <module>()
      5 from poppy_torso import PoppyTorso
      6 
----> 7 pop = PoppyTorso(use_http=True, start_services=True)

/home/poppy/miniconda/lib/python2.7/site-packages/poppy/creatures/abstractcreature.pyc in __new__(cls, base_path, config, simulator, scene, host, port, id, use_snap, snap_host, snap_port, snap_quiet, use_http, http_host, http_port, http_quiet, use_remote, remote_host, remote_port, start_background_services, sync, **extra)
    149             print('RemoteRobotServer is now running on: http://{}:{}\n'>.format(remote_host, remote_port))
    150 
--> 151         cls.setup(poppy_creature)
    152 
    153         if start_background_services:

/home/poppy/miniconda/lib/python2.7/site-packages/poppy_torso/poppy_torso.pyc in setup(cls, robot)
     29                                          motors=robot.torso + robot.l_arm,
     30                                          passiv=robot.torso,
---> 31                                          tip=[0, 0.18, 0])
     32 
     33         rc = IKChain.from_poppy_creature(robot,

/home/poppy/miniconda/lib/python2.7/site-packages/poppy/creatures/ik.pyc in from_poppy_creature(cls, poppy, motors, passiv, tip, reversed_motors)
     31                                    base_elements=chain_elements,
     32                                    last_link_vector=tip,
---> 33                                    active_links_mask=activ)
     34 
     35         chain.motors = [getattr(poppy, l.name) for l in chain.links[1:-1]]

/home/poppy/miniconda/lib/python2.7/site-packages/ikpy-2.2.1-py2.7.egg/ikpy/chain.pyc in from_urdf_file(cls, urdf_file, base_elements, last_link_vector, base_element_type, active_links_mask, name)
    123         links = URDF_utils.get_urdf_parameters(urdf_file, base_elements=base_elements, last_link_vector=last_link_vector, base_element_type=base_element_type)
    124         # Add an origin link at the beginning
--> 125         return cls([link_lib.OriginLink()] + links, active_links_mask=active_links_mask, name=name)
    126 
    127     def active_to_full(self, active_joints, initial_position):

/home/poppy/miniconda/lib/python2.7/site-packages/ikpy-2.2.1-py2.7.egg/ikpy/chain.pyc in __init__(self, links, active_links_mask, name, profile, **kwargs)
     30         if active_links_mask is not None:
     31             if len(active_links_mask) != len(self.links):
---> 32                 raise ValueError("Your active links mask length of {} is different from the number of your links, which is {}".format(len(active_links_mask), len(self.links)))
     33             self.active_links_mask = np.array(active_links_mask)
     34             # Always set the last link to True

ValueError: Your active links mask length of 7 is different from the number of your links, which is 9

I’ve made some more testing.

  • when I put MX-28 rather than MX-106, it does not change the issue, so the type of motor is not the cause.
  • when I put the original configuration with all the motors, there is no issue, so all the hardware seems good.
  • I tried remodifying the orginal configuration just by removing 1 motor. I had the same issue with an active mask length of 8 rather than 9.
  • I replaced in the Ipython “pop = PoppyTorso(use_http=True, start_services=True)” by “pop = PoppyTorso()”, and I had the same issue.

So I’ll try removing IkChain as you said.

It’s weird because when I added motors in my humanoid robot, I never had these issue. (Maybe because I used a different port for the additional motors?)

Ok, I’ve followed what you did @Theo, and it works now.

in ~/miniconda/lib/python2.7/site-packages/poppy_torso/poppy_torso.py, I commented the following lines :

        # Add Kinematic chains for each arm
        #lc = IKChain.from_poppy_creature(robot,
        #                                 motors=robot.torso + robot.l_arm,
        #                                 passiv=robot.torso,
        #                                 tip=[0, 0.18, 0])

        #rc = IKChain.from_poppy_creature(robot,
        #                                 motors=robot.torso + robot.r_arm,
        #                                 passiv=robot.torso,
        #                                 tip=[0, 0.18, 0],
        #                                 reversed_motors=[robot.r_shoulder_x])

        #robot.l_arm_chain = lc
        #robot.r_arm_chain = rc

And in ~/miniconda/lib/python2.7/site-packages/poppy_torso/primitives/idle.py, i adapted/removed the motors that I have removed from the modified robot in the motor_list (sinus_args).

I can now program the modified Torso robot in http://poppy.local and monitor it by executing :
pop = PoppyTorso(use_http=True, start_services=True)

Thanks @Theo ! :smile: