SoftBank Robotics documentation What's new in NAOqi 2.8?

Self-collision avoidance API

NAOqi Motion - Overview | API

Method list

class ALMotionProxy
bool ALMotionProxy::setCollisionProtectionEnabled(const std::string& ChainName, const bool& Enable)

Enable/Disable Anti-collision protection of the arms of the robot.

  • ChainName – The chain name {“Arms”, “LArm” or “RArm”}.
  • Enable – Activate or deactivate the anti-collision of the desired Chain.

A bool which return always true.

#! /usr/bin/env python
# -*- encoding: UTF-8 -*-

"""Example: Use setCollisionProtectionEnabled Method"""

import qi
import argparse
import sys

def main(session):
    This example uses the setCollisionProtectionEnabled method.
    # Get the service ALMotion.

    motion_service  = session.service("ALMotion")

    # Example showing how to activate "Arms" anticollision
    chainName = "Arms"
    enable  = True
    isSuccess = motion_service.setCollisionProtectionEnabled(chainName, enable)
    print "Anticollision activation on arms: " + str(isSuccess)

    # Example showing how to deactivate "LArm" anticollision
    chainName = "LArm"
    enable = False
    isSuccess = motion_service.setCollisionProtectionEnabled(chainName, enable)
    print "isSuccess: ", isSuccess

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--ip", type=str, default="",
                        help="Robot IP address. On robot or Local Naoqi: use ''.")
    parser.add_argument("--port", type=int, default=9559,
                        help="Naoqi port number")

    args = parser.parse_args()
    session = qi.Session()
        session.connect("tcp://" + args.ip + ":" + str(args.port))
    except RuntimeError:
        print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
               "Please check your script arguments. Run with -h option for help.")
bool ALMotionProxy::getCollisionProtectionEnabled(const std::string& ChainName)

Allow to know if the collision protection is activated on the given chain.

  • ChainName – The chain name {“LArm” or “RArm”}.

Return true is the collision protection of the given Arm is activated.