PierreJac / Project-NAO-Control

This project goal is to simulate a NAO in v-rep.
33 stars 25 forks source link

Runtime error when running single_nao_control.py #6

Open Napoleon-BlownApart opened 7 years ago

Napoleon-BlownApart commented 7 years ago

Hi Pierre, thank you for your work. However I'm having some issues getting it working here. When I run single_nao_control.py, I get the following error:

user@host:[14:20]:~/Downloads/v-rep_Nao/Project-NAO-Control/Scripts$ python single_nao_control.py 
================ Program Sarted ================
Connected to remote API server
================ Choregraphe's Initialization ================
Enter your NAO IP
192.168.0.2
Enter your NAO port
9559
[I] 30651 qimessaging.session: Session listener created on tcp://0.0.0.0:0
[I] 30651 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.0.2:36903
[I] 30651 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:36903
Posture Initialization : StandZero
Traceback (most recent call last):
  File "single_nao_control.py", line 38, in <module>
    postureProxy.goToPosture(posture,1.0,1.0)
  File "/usr/local/pynaoqi-python2.7-2.1.4.13-linux64/naoqi.py", line 301, in __call__
    return self.__wrapped__.method_missing(self.__method__, *args, **kwargs)
  File "/usr/local/pynaoqi-python2.7-2.1.4.13-linux64/naoqi.py", line 371, in method_missing
    raise e
RuntimeError:   ALRobotPosture::goToPosture
    Arguments types did not match for goToPosture (resolved to '(sff)'):
  Candidate:
  goToPosture::(sf) (1)

user@host:[14:21]:~/Downloads/v-rep_Nao/Project-NAO-Control/Scripts$

Can you shed any light on what may be going wrong?

I have a variety of Choregraphes installed but I'm using choregraphe-suite-2.1.4.13-linux64. I am using the lastest V-REP, downloaded a few days ago. I also have a variety of Naoqi libraries installed in usr/local:

naoqi-sdk-1.14.5-linux64/
naoqi-sdk-2.1.4.13-linux64/
naoqi-sdk-2.4.3.28-linux64/
pynaoqi-python2.7-2.1.4.13-linux64/
pynaoqi-python2.7-2.4.3.28-linux64/

My PYTHONPATH points to pynaoqi-python2.7-2.1.4.13-linux64/ and my LD_LIBRARY_PATH points to /usr/local/naoqi-sdk-2.1.4.13-linux64/lib

My full environment, is listed below:

XDG_VTNR=7
XDG_SESSION_ID=c2
CLUTTER_IM_MODULE=xim
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/user
SESSION=ubuntu
GPG_AGENT_INFO=/home/user/.gnupg/S.gpg-agent:0:1
SHELL=/bin/bash
TERM=xterm-256color
VTE_VERSION=4205
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
ROS_MASTER_URI=http://localhost:11311
WINDOWID=58720266
WEBOTS_HOME=/home/user/Downloads/Webots/webots7.4.3
OLDPWD=/home/user/Downloads/v-rep_Nao
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1608
GNOME_KEYRING_CONTROL=
GTK_MODULES=gail:atk-bridge:unity-gtk-module
USER=user
LD_LIBRARY_PATH=/opt/ros/kinetic/lib:/usr/local/naoqi-sdk-2.1.4.13-linux64/lib
QT_ACCESSIBILITY=1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
PATH=/opt/ros/kinetic/bin:/home/user/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user/myScripts:/home/user/git
DESKTOP_SESSION=ubuntu
QT_IM_MODULE=ibus
QT_QPA_PLATFORMTHEME=appmenu-qt5
XDG_SESSION_TYPE=x11
PWD=/home/user/Downloads/v-rep_Nao/Project-NAO-Control/Scripts
JOB=unity-settings-daemon
XMODIFIERS=@im=ibus
GNOME_KEYRING_PID=
LANG=en_AU.UTF-8
GDM_LANG=en_AU
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
IM_CONFIG_PHASE=1
COMPIZ_CONFIG_PROFILE=ubuntu
ROSLISP_PACKAGE_DIRECTORIES=
GDMSESSION=ubuntu
SESSIONTYPE=gnome-session
GTK2_MODULES=overlay-scrollbar
HOME=/home/user
XDG_SEAT=seat0
SHLVL=1
ROS_DISTRO=kinetic
LANGUAGE=en_AU:en
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
ROSDISTRO=kinetic
UPSTART_INSTANCE=
PYTHONPATH=/opt/ros/kinetic/lib/python2.7/dist-packages:/usr/local/pynaoqi-python2.7-2.1.4.13-linux64
UPSTART_EVENTS=xsession started
XDG_SESSION_DESKTOP=ubuntu
LOGNAME=user
COMPIZ_BIN_PATH=/usr/bin/
QT4_IM_MODULE=xim
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-KXfEoMjObH
LESSOPEN=| /usr/bin/lesspipe %s
PKG_CONFIG_PATH=/opt/ros/kinetic/lib/pkgconfig
INSTANCE=
UPSTART_JOB=unity7
CMAKE_PREFIX_PATH=/opt/ros/kinetic
DISPLAY=:0
XDG_CURRENT_DESKTOP=Unity
GTK_IM_MODULE=ibus
LESSCLOSE=/usr/bin/lesspipe %s %s
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
XAUTHORITY=/home/user/.Xauthority
_=/usr/bin/printenv
Napoleon-BlownApart commented 7 years ago

The error seems to be cause by a change in the Aldebaran API. Line 38 needs to be changed to:

postureProxy.goToPosture(posture,1.0)

Where only the Posture and speed are required as parameters. Stiffness, I haven't checked the old API so I could be wrong, is no longer required.

Fixing this leads to a subscript out of range error in the JointControl method:

Traceback (most recent call last):
  File "single_nao_control.py", line 57, in <module>
    JointControl(clientID,motionProxy,0,Body)
  File "/home/user/Downloads/v-rep_Nao/Project-NAO-Control/Scripts/manage_joints.py", line 216, in JointControl
    vrep.simxSetJointTargetPosition(clientID,Body[21][i],commandAngles[22],vrep.simx_opmode_streaming)
IndexError: list index out of range

22 is out of range from the commandAngles = motionProxy.getAngles('Body', False) call (line 187). This may have something to do with the version of the Nao being used? (Not sure.)

Napoleon-BlownApart commented 7 years ago

I have made it work in general. However I have removed the functionality for the finger, which I will return next. I'm going to Fork this repo, fix it up, and then do a pull request.

PierreJac commented 7 years ago

Hi Napoleon,

Thanks for the info. I haven't touch this project for a long time (since I was still a student) and it's true that the NAOqi API have changed since.

I'm going to take a look soon in the code to updgrade it for 2.1.4.3, and maybe add more functionnalities.

Thanks again for your help ! :)