Overview | API
See also
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)
{
if (argc < 2) {
std::cerr << "Usage: motion_getjointnames pIp"
<< std::endl;
return 1;
}
const std::string pIp = argv[1];
AL::ALMotionProxy motion(pIp);
// Example showing how to get the names of all the joints in the body.
std::vector<std::string> bodyNames = motion.getJointNames("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.getJointNames("LLeg");
std::cout << "All joints in LLeg: " << std::endl;
std::cout << leftLegJointNames << std::endl;
return 0;
}
import sys
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python motion_getjointnames.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
proxy = ALProxy("ALMotion", IP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
# Example showing how to get the names of all the joints in the body.
bodyNames = proxy.getJointNames("Body")
print "Body: " + str(bodyNames)
# Example showing how to get the names of all the joints in the left leg.
leftLegJointNames = proxy.getJointNames("LLeg")
print "LLed: " + str(bodyNames)
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)
{
if (argc < 2) {
std::cerr << "Usage: motion_getsensornames pIp"
<< std::endl;
return 1;
}
const std::string pIp = argv[1];
AL::ALMotionProxy motion(pIp);
// 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;
}
import sys
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python motion_getsensornames.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
proxy = ALProxy("ALMotion", IP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
# Example showing how to get the list of the sensors
sensorList = proxy.getSensorNames()
for sensor in sensorList:
print sensor
Get the minAngle (rad), maxAngle (rad), and maxVelocity (rad.s-1) for a given joint or actuator in the body.
Parameters: |
|
---|---|
Returns: | Array of ALValue arrays containing the minAngle, maxAngle and maxVelocity for all the joints specified. |
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
if (argc < 2) {
std::cerr << "Usage: motion_getlimits pIp"
<< std::endl;
return 1;
}
const std::string pIp = argv[1];
AL::ALMotionProxy motion(pIp);
// Example showing how to get the limits for the whole body
std::string name = "Body";
std::vector<std::string> jointNames = motion.getJointNames(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"
<< std::endl;
}
return 0;
}
import sys
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python motion_getlimits.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
proxy = ALProxy("ALMotion", IP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
# Example showing how to get the limits for the whole body
name = "Body"
limits = proxy.getLimits(name)
jointNames = proxy.getJointNames(name)
for i in range(0,len(limits)):
print jointNames[i] + ":"
print "MinAngle", limits[i][0], "MaxAngle", limits[i][1],"MaxVelocity", limits[i][2]
Get the robot configuration. Get the minAngle (rad), maxAngle (rad), and maxVelocity (rad.s-1) for a given joint or actuator in the body.
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)
{
if (argc < 2) {
std::cerr << "Usage: motion_getrobotconfig pIp"
<< std::endl;
return 1;
}
const std::string pIp = argv[1];
AL::ALMotionProxy motion(pIp);
// 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;
}
import sys
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python motion_getrobotconfig.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
proxy = ALProxy("ALMotion", IP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
# Example showing how to get the robot config
robotConfig = proxy.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".
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)
{
if (argc < 2) {
std::cerr << "Usage: motion_getsummary pIp"
<< std::endl;
return 1;
}
const std::string pIp = argv[1];
AL::ALMotionProxy motion(pIp);
// Example showing how to get a summary of Nao's state
std::cout << motion.getSummary() << std::endl;
return 0;
}
import sys
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python motion_getsummary.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
proxy = ALProxy("ALMotion", IP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
# Example showing how to get a summary of Nao's state
print proxy.getSummary()
Gets the mass of a joint, chain, “Body” or “BodyJoints”.
Parameters: |
|
---|---|
Returns: | The mass in kg. |
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
if (argc < 2) {
std::cerr << "Usage: motion_getmass pIp"
<< std::endl;
return 1;
}
const std::string pIp = argv[1];
AL::ALMotionProxy motion(pIp);
// 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;
}
import sys
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python motion_getmass.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
proxy = ALProxy("ALMotion", IP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
# Example showing how to get the mass of "HeadYaw".
pName = "HeadYaw"
mass = proxy.getMass(pName)
print pName + " mass: " + str(mass)
# Example showing how to get the mass "LLeg" chain.
pName = "LLeg"
print "LLeg : ", proxy.getMass(pName)
# It is equivalent to the following script
pNameList = ["LHipYawPitch", "LHipRoll", "LHipPitch", "LKneePitch", "LAnkleRoll", "LAnklePitch"]
mass = 0
for pName in pNameList:
mass = mass + proxy.getMass(pName)
print "LLeg :", mass
Gets the COM of a joint, chain, “Body” or “BodyJoints”.
Parameters: |
|
---|---|
Returns: | The COM position (meter). |
#include <iostream>
#include <alproxies/almotionproxy.h>
int main(int argc, char **argv)
{
if (argc < 2) {
std::cerr << "Usage: motion_getcom pIp"
<< std::endl;
return 1;
}
const std::string pIp = argv[1];
AL::ALMotionProxy motion(pIp);
// Example showing how to get the COM of "HeadYaw".
std::string pName = "HeadYaw";
int pSpace = 0; // SPACE_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;
}
import sys
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python motion_getcom.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
proxy = ALProxy("ALMotion", IP, PORT)
except Exception,e:
print "Could not create proxy to ALMotion"
print "Error was: ",e
sys.exit(1)
# Example showing how to get the COM position of "HeadYaw".
pName = "HeadYaw"
pSpace = 0 # SPACE_TORSO
pUseSensors = False
pos = proxy.getCOM(pName, pSpace, pUseSensors)
print "HeadYaw COM Position: x = ", pos[0], " y:", pos[1], " z:", pos[2]