NAOqi Motion - Overview | API
Deprecated Methods
Get notifications status. Return true if notifications are active.
Returns: | Return true is notifications are active. |
---|
Gets the names of all the joints in the collection.
Parameters: |
|
---|---|
Returns: | Vector of strings, one for each joint in the collection |
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
std::string robotIp = "127.0.0.1";
if (argc < 2) {
std::cerr << "Usage: almotion_getbodynames robotIp "
<< "(optional default \"127.0.0.1\")."<< std::endl;
}
else {
robotIp = argv[1];
}
AL::ALMotionProxy motion(robotIp);
// Example showing how to get the names of all the joints in the body.
std::vector<std::string> bodyNames = motion.getBodyNames("Body");
std::cout << "All joints in Body: " << std::endl;
std::cout << bodyNames << std::endl;
// Example showing how to get the names of all the joints in the left leg.
std::vector<std::string> leftLegJointNames = motion.getBodyNames("LLeg");
std::cout << "All joints in LLeg: " << std::endl;
std::cout << leftLegJointNames << std::endl;
return 0;
}
# -*- encoding: UTF-8 -*-
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Example showing how to get the names of all the joints in the body.
bodyNames = motionProxy.getBodyNames("Body")
print "Body:"
print str(bodyNames)
print ""
# Example showing how to get the names of all the joints in the left leg.
leftLegJointNames = motionProxy.getBodyNames("LLeg")
print "LLeg:"
print str(leftLegJointNames)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Deprecated since version 1.14: use ALMotionProxy::getBodyNames() instead.
param name: | Name of a chain, “Body”, “Chains”, “JointActuators”, “Joints” or “Actuators”. |
---|---|
return: | Vector of strings, one for each joint in the collection |
Gets the list of sensors supported on your robot.
Returns: | Vector of sensor names |
---|
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
std::string robotIp = "127.0.0.1";
if (argc < 2) {
std::cerr << "Usage: almotion_getsensornames robotIp "
<< "(optional default \"127.0.0.1\")."<< std::endl;
}
else {
robotIp = argv[1];
}
AL::ALMotionProxy motion(robotIp);
// Gets the list of sensors supported on your robot.
std::vector<std::string> sensorList = motion.getSensorNames();
std::cout << "Sensors: " << std::endl;
for (unsigned int i=0; i<sensorList.size(); i++)
{
std::cout << sensorList.at(i) << std::endl;
}
return 0;
}
# -*- encoding: UTF-8 -*-
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Example showing how to get the list of the sensors
sensorList = motionProxy.getSensorNames()
for sensor in sensorList:
print sensor
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Get the minAngle (rad), maxAngle (rad), maxVelocity (rad.s-1) and maxTorque (N.m). for a given joint or actuator in the body.
Parameters: |
|
---|---|
Returns: | Array of ALValue arrays containing the minAngle, maxAngle, maxVelocity and maxTorque for all the joints specified. |
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
std::string robotIp = "127.0.0.1";
if (argc < 2) {
std::cerr << "Usage: almotion_getlimits robotIp "
<< "(optional default \"127.0.0.1\")."<< std::endl;
}
else {
robotIp = argv[1];
}
AL::ALMotionProxy motion(robotIp);
// Example showing how to get the limits for the whole body
std::string name = "Body";
std::vector<std::string> jointNames = motion.getBodyNames(name);
AL::ALValue limits = motion.getLimits(name);
for (unsigned int i=0; i<limits.getSize(); i++)
{
std::cout << " Joint name " << jointNames[i]
<< " minAngle " << limits[i][0] << " rad"
<< " maxAngle " << limits[i][1] << " rad"
<< " maxChange " << limits[i][2] << " rad.s-1"
<< " maxTorque " << limits[i][3] << " N.m"
<< std::endl;
}
return 0;
}
# -*- encoding: UTF-8 -*-
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Example showing how to get the limits for the whole body
name = "Body"
limits = motionProxy.getLimits(name)
jointNames = motionProxy.getBodyNames(name)
for i in range(0,len(limits)):
print jointNames[i] + ":"
print "minAngle", limits[i][0],\
"maxAngle", limits[i][1],\
"maxVelocity", limits[i][2],\
"maxTorque", limits[i][3]
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Get the motion cycle time in milliseconds.
Returns: | ALValue containing the cycle time in milliseconds as an integer. |
---|
Get the robot configuration.
Returns: | ALValue arrays containing the robot parameter names and the robot parameter values. |
---|
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
std::string robotIp = "127.0.0.1";
if (argc < 2) {
std::cerr << "Usage: almotion_getrobotconfig robotIp "
<< "(optional default \"127.0.0.1\")."<< std::endl;
}
else {
robotIp = argv[1];
}
AL::ALMotionProxy motion(robotIp);
// Example showing how to get the robot config
AL::ALValue robotConfig = motion.getRobotConfig();
for (unsigned int i=0; i<robotConfig[0].getSize(); i++)
{
std::cout << robotConfig[0][i] << ": " << robotConfig[1][i] << std::endl;
}
return 0;
}
# -*- encoding: UTF-8 -*-
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Example showing how to get the robot config
robotConfig = motionProxy.getRobotConfig()
for i in range(len(robotConfig[0])):
print robotConfig[0][i], ": ", robotConfig[1][i]
# "Model Type" : "naoH25", "naoH21", "naoT14" or "naoT2".
# "Head Version" : "VERSION_32" or "VERSION_33" or "VERSION_40".
# "Body Version" : "VERSION_32" or "VERSION_33" or "VERSION_40".
# "Laser" : True or False.
# "Legs" : True or False.
# "Arms" : True or False.
# "Extended Arms": True or False.
# "Hands" : True or False.
# "Arm Version" : "VERSION_32" or "VERSION_33" or "VERSION_40".
# Number of Legs : 0 or 2
# Number of Arms : 0 or 2
# Number of Hands: 0 or 2
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Returns a string representation of the Model’s state
Returns: | A formated string |
---|
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
std::string robotIp = "127.0.0.1";
if (argc < 2) {
std::cerr << "Usage: almotion_getsummary robotIp "
<< "(optional default \"127.0.0.1\")."<< std::endl;
}
else {
robotIp = argv[1];
}
AL::ALMotionProxy motion(robotIp);
// Example showing how to get a summary of Nao's state
std::cout << motion.getSummary() << std::endl;
return 0;
}
# -*- encoding: UTF-8 -*-
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Example showing how to get a summary of Nao's state
print motionProxy.getSummary()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Gets the mass of a joint, chain, “Body” or “Joints”.
Parameters: |
|
---|---|
Returns: | The mass in kg. |
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
std::string robotIp = "127.0.0.1";
if (argc < 2) {
std::cerr << "Usage: almotion_getmass robotIp "
<< "(optional default \"127.0.0.1\")."<< std::endl;
}
else {
robotIp = argv[1];
}
AL::ALMotionProxy motion(robotIp);
// Example showing how to get the mass of "HeadYaw".
std::string pName = "HeadYaw";
float mass = motion.getMass(pName);
std::cout << "Mass on " << pName << " is " << mass << std::endl;
return 0;
}
# -*- encoding: UTF-8 -*-
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Example showing how to get the mass of "HeadYaw".
pName = "HeadYaw"
mass = motionProxy.getMass(pName)
print pName + " mass: " + str(mass)
# Example showing how to get the mass "LLeg" chain.
pName = "LLeg"
print "LLeg mass: ", motionProxy.getMass(pName)
# It is equivalent to the following script
pNameList = motionProxy.getBodyNames("LLeg")
mass = 0.0
for pName in pNameList:
jointMass = motionProxy.getMass(pName)
print pName + " mass: " + str(jointMass)
mass = mass + jointMass
print "LLeg mass:", mass
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Gets the COM of a joint, chain, “Body” or “Joints”.
Parameters: |
|
---|---|
Returns: | The COM position (meter). |
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
std::string robotIp = "127.0.0.1";
if (argc < 2) {
std::cerr << "Usage: almotion_getcom robotIp "
<< "(optional default \"127.0.0.1\")."<< std::endl;
}
else {
robotIp = argv[1];
}
AL::ALMotionProxy motion(robotIp);
// Example showing how to get the COM of "HeadYaw".
std::string pName = "HeadYaw";
int pSpace = 0; // FRAME_TORSO
bool pUseSensors = false;
std::vector<float> pos = motion.getCOM(pName, pSpace, pUseSensors);
std::cout << pName << " COM position: " << std::endl;
std::cout << "x: " << pos[0] << "; y: " << pos[1] << "; z: " << pos[2]
<< std::endl;
return 0;
}
# -*- encoding: UTF-8 -*-
import motion
import argparse
from naoqi import ALProxy
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Example showing how to get the COM position of "HeadYaw".
name = "HeadYaw"
frame = motion.FRAME_TORSO
useSensors = False
pos = motionProxy.getCOM(name, frame, useSensors)
print "HeadYaw COM Position: x = ", pos[0], " y:", pos[1], " z:", pos[2]
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1",
help="Robot ip address")
parser.add_argument("--port", type=int, default=9559,
help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Internal Use.
Parameters: |
|
---|
Enable / Disable notifications.
Parameters: |
|
---|
Deprecated since version 1.18: use ALTrackerProxy instead.
Update the target to be followed by the head of the robot.
Parameters: |
|
---|