The NAO robot has been in the lab for several months, and has been familiar with the platform and is ready to implement a soccer robot function on this platform. In the study of the relevant
Records are mainly familiar with the NAO of some of the scattered things, decided to organize and write out.
Some examples of Python are small programs that get the value of the device, the sensor value, and so on:
1, view NAO each sensor and joint value:
From NAOqi import alproxy memproxy = Alproxy ("Almemory", "192.168.1.139", 9559) print Memproxy.getdata ("device/ Subdevicelist/lshoulderpitch/position/sensor/value ") Print Memproxy.getdata (" Device/subdevicelist/inertialsensor /gyrx/sensor/value ") Print Memproxy.getdata (" Device/subdevicelist/inertialsensor/gyry/sensor/value ") print Memproxy.getdata ("Device/subdevicelist/inertialsensor/gyrref/sensor/value")
The API used is almemory. The robot is equipped with a two-axis gyroscope, located in the center of the body. It consists of 3 sub devices and a reference value. These sensors provide a rotational speed around the x and y axes of the robot.
2, control the single joint Action routines:
Import NAOqi from NAOqi import alproxy motion = Alproxy ("Almotion", "192.168.1.139", 9559) names = "Headyaw" #各个关节的名称可以在sdk说 The document found anglelists = [1.0,0.0] #关节要转动的角度 timelists = [1.0,2.0] #到达指定角度的指定时间 isabsoulte = True #true代表绝对角度 motion.angleinter Polation (Names,anglelists,timelists,isabsoulte)
How to create your own remote execution module:
First of all, use the module_generator.py in the software package to produce some cmake-related, and some program framework and header files or something. If nothing changes, a module is generated by default. Specific ways to adapt: in the resulting several files, open cmake.list will be inside the other two files, respectively, is a header file a main.cpp file deleted. Then use CMake to generate vcproj engineering, compile, run/work. This creates a remote execution module of its own. Without having to call again.