Coder Social home page Coder Social logo

cyberbotics / naoqisim Goto Github PK

View Code? Open in Web Editor NEW
22.0 45.0 11.0 19.93 MB

NAOqi enabled controller for simulated NAO robots in Webots

License: Other

Makefile 10.58% C++ 86.40% C 3.02%
webots nao-robot choregraphe naoqi softbank-robotics robotics-simulation

naoqisim's Introduction

naoqisim (deprecated)

NAOqi enabled controller for simulated NAO robots in Webots

DISCLAIMER

This software is provided as-is with the hope it may help users. It may or may not work, without any guarantee. It is not maintained any more, neither by Aldebaran / SoftBank Robotics, nor by Cyberbotics. It relies on outdated versions of Webots, Choregraphe and NAOqi.

Introduction

This repository contains the source code and dependencies needed to build the naoqisim Webots controller. This controller is used to connect a Webots-simulated NAO robot to the NAOqi programming interface, including the Choregraphe graphical programming interface.

Dependencies

Development environment

On Windows, it is necessary to install Microsoft Visual Studio C++ 2010 Express. You should also install MSYS2 (64 bit version) from https://www.msys2.org to have a convienient UNIX-like environment to be able to execute the Makefiles. On Linux, you will need the standard gcc compiler suite. On recent macOS distributions, naoqisim doesn't work any more.

Simulation SDK

These libraries were provided by Aldebaran Robotics Windows, Linux and Mac. However they are not maintained anymore and may not work on recent systems, including the latest versions of macOS. You can install them by typing make in the aldebaran directory.

Choregraphe

The Choregraphe suite software should be downloaded from SoftBank Robotics (formerly Aldebaran Robotics). Version 2.1.4.13 was recently tested and is known to work with naoqisim.

Webots

Webots can be downloaded from https://cyberbotics.com You should use the latest version of Webots. Version R2019a revision 1 was recently tested and is known to work with naoqisim, but later versions should work as well.

Build

Set the WEBOTS_HOME environment variable to point to the Webots installation folder, as documented in the Webots user guide.

Windows

Open the MSYS2 console, cd to the naoqisim root directory. Type make to complete the installation of the Simulator SDK and the naoqisim controller. On the Simulator SDK is installed, you can compile the naoqisim controller by opening controllers/naoqisim/naoqisim.sln with Visual C++ to build the project.

Linux

Add WEBOTS_HOME/lib to your library path (e.g. export LD_LIBRARY_PATH=$WEBOTS_HOME/lib). Type make in the naoqisim root directory to install the Simulation SDK and naoqisim controller. Once the Simulation SDK is installed, you can compile the naoqisim controller by typing make in the controllers/naoqisim folder.

Use

Short version

Start Webots, open the worlds/nao.wbt world file and run the simulation in real-time mode. Start Choregraphe. Choose Connection > Connect to or click the "Connect to" button. Click the "Wake Up" button (sun-like icon on the top right corner of the Choregraphe window) to make sure the stiffness is on.

For more information, refer to: http://doc.aldebaran.com/2-1/software/webots/webots_index.html

Using Webots with Choregraphe

These instructions have been tested with Webots R2018a and Choregraphe 2.1.4. Please note that Webots must not be launched as root when using any world containing naoqisim, otherwise Choregraphe won't be able to send instructions to the robot in Webots.

Start Webots and open this world file: "naoqisim/worlds/nao.wbt" You should see a red Nao in an empty environment. If the simulation is paused, then please start it by pushing the Real-time button in Webots.

The camera images in Webots (small purple viewports) should reflect what the robot sees.

Several lines of text information corresponding to the output of NAOqi should be printed to Webots console. Also, a couple of harmless error messages may be displayed, you can safely ignore them:

[naoqisim] Qt: Untested Windows version 6.2 detected!
[naoqisim] Error: %1 is not a valid Win32 application.
[naoqisim]  (dynamic library)
[naoqisim] Error: failed to load > C:/Program Files/Webots/resources/projects/plugins/robot_windows/generic/generic.dll library

Now you can start Choregraphe with the --no-naoqi option. Please make sure the Choregraphe version matches the NAOqi version printed in Webots console. In Choregraphe choose the menu Connection / Connect to.... Then, in the list, select the NAOqi that was started by Webots, on you local machine, it will have the port number 9559, unless you change it. Note that the NAOqi will not appear in the list if the simulation was not started in Webots. If the simulation was started but the robot still doesn't appear in the list, force the IP and port to 127.0.0.1 and 9559 in Choregraphe and then press connect.

At this point a Nao model matching the Webots model should appear in Choregraphe. Now, in Choregraphe toggle the "Wake up" button, which is a little sun in the top right of the window. Nao is currently in the "Stand Zero" pose, you can change its starting pose using the posture library in Choregraphe.

Then, double-click on any of the Nao parts in Choregraphe: a small window with control sliders appears. Now, move any of the sliders: the motor movement in Choregraphe should be reflected in the Webots simulation. If you open the Video monitor in Choregraphe you should see the picture of the Nao camera simulated by Webots.

It is possible to have several Nao robots in your simulation. However, each Nao robot must use a different NAOqi port. This can be done in the controllerArgs field in the newly created robot, e.g. 9560.

Using Motion Boxes

Now we can test some of the motion boxes of Choregraphe. A simple example is a sit down -> stand up motion. In Choregraphe, select the "Sit Down" and "Stand Up" boxes from Box libraries > default. Drag and drop them in central view. Then connect the global "onStart" input to the "Sit Down" box's "onStart" input, and the output of this box to the "Stand Up" box's "onStart" input. Now, make sure the simulation is running, and push the Play button in Choregraphe. This will make the robot sit down, and then stand up once he is done sitting down.

Using the Cameras

Webots simulates Nao's top and bottom cameras. Using SoftBank Robotics's Choregraphe or the Monitor programs, it is possible to switch between these cameras. In Choregraphe, use the "Select Camera" box in Box Library / Vision. The simulated camera image can be viewed in Choregraphe: View / Video monitor. The resolution of the image capture can be changed in Webots using the cameraWidth and cameraHeight fields of the robot. Note that the simulation speed decreases as the resolution increases. It is possible to hide the camera viewports (purple frame) in Webots, by setting the cameraPixelSize field to 0. It is also possible to completely switch off the camera simulation by adding the "-nocam" option before the NAOqi port number in the controllerArgs field, e.g. "-nocam 9559".

Known Problems

macOS Support

SoftBank Robotics dropped the simulator SDK support for macOS since the 2.1.2.17 version. Webots includes this latest version for macOS, however it doesn't work on recent macOS versions.

Timing Issues: Getting the Right Speed for Realistic Simulation

Choregraphe uses exclusively real-time and so the robot's motions are meant to be carried out in real-time. The Webots simulator uses a virtual time base that can be faster or slower than real-time, depending on the CPU and GPU power of the host computer. If the CPU and GPU are powerful enough, Webots can keep up with real-time, in this case the speed indicator in Webots shows approximately 1.0x, otherwise the speed indicator goes below 1.0x. Choregraphe motions will play accurately only if Webots simulation speed is around 1.0x. When Webots simulation speed drifts away from 1.0x, the physics simulation becomes wrong (unnatural) and thus Choregraphe motions don't work as expected anymore. For example, if Webots indicates 0.5x, this means that it is only able to simulate at half real-time the motion provided by Choregraphe: the physics simulation is too slow. Therefore it is important to keep the simulation speed as close as possible to 1.0x. There are currently no means of synchronizing Webots and Choregraphe, but this problem will be addressed in a future release. It is often possible to prevent the simulation speed from going below 1.0x, by keeping the CPU and GPU load as low as possible. There are several ways to do that, here are the most effective ones:

  • Switch off the simulation of the Nao cameras with the "-nocam" option, as mentioned above.
  • Increase the value of WorldInfo.displayRefesh in the Scene Tree.
  • Switch off the rendering of the shadows: change to FALSE the castShadows field of each light source in the Scene Tree.
  • Reduce the dimensions of the 3D view in Webots, by manually resizing the GUI components.
  • Remove unnecessary objects from the simulation, in particular objects with physics.

Unexpected Webots Crashes

If for some unexpected reason Webots crashes, it is possible that the hal or naoqi-bin processes remain active in memory. In this case we recommend you to terminate these processes manually before restarting Webots.

On Windows, use the Task Manager (the Task Manager can be started by pressing Ctrl+Alt+Delete): In the Task Manager select the Processes tab, then select each hal.exe and naoqi-bin.exe line and push the "End Process" button for each one.

On Linux, you can use the killall or the pkill commands, e.g.:

$ killall hal naoqi-bin

naoqisim's People

Contributors

davidmansolino avatar lprobsth avatar omichel avatar wbadry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

naoqisim's Issues

getPackages is deprecated

Hello, I installed the naoqisim controllers just as it is specified in the readme. I am using Webots R2021a in Linux Mint 20 and running the file naoqisim.wbt, connecting it to Choregraphe 2.1.4.13. It appears to connect properly, but when I create a behavior in Choregraphe in the robot view it's previewed but is not mirrored in Webots' simulation, I think it has to do with this output bellow about deprecated functions, which I got after creating a "Walk towards..." activity.

[I] 8056 core.naoqi: NAOqi is ready...
[I] 8038 qimessaging.servicedirectory: Registered Service "ALChoregraphe" (#66)
[I] 8051 qimessaging.servicedirectory: Registered Service "ALChoregrapheRecorder" (#67)
[W] 8030 packagemanager: getPackages is deprecated please use packages instead.
[W] 8039 packagemanager: getPackage is deprecated please use package instead.
[W] 8045 packagemanager: checkRequirements disabled
[I] 8045 packagemanager: .lastUploadedChoregrapheBehavior: package installed in version 
[W] 8052 packagemanager: getPackages is deprecated please use packages instead.
[W] 8036 ALMotion.ALMotionConfigurator: ENABLE_FOOT_CONTACT_PROTECTION: 1

naoqisim make

Hello,
I followed your instructions. I am on Windows OS using MSYS2 (32 bit) and Visual C++ 2010 express edition. When I attempt to issue command make I receive the following error:

bash: cmake: command not found

Your help is appreciated . Thanks

Controller.dll missing when naoqisim is run

I have built the Aldebaran simulation SDK as instructed in the readme, however, when I built the naoqisim controller in Visual Studio, I get an error saying that it cannot run the exe as 'Controller.dll' is missing. Have I done something wrong in building the controller?

[request] update to NAO v6 naoqi

Hello,
Softbank robotics released a new C++ SDK for NAO. I believe they hold the same API in addition to new one. Is it possible to replace the older one for naoqisim with this one? It may solve several issues. Or it would be great to know what to do to get simlator-sdk based on the new one. Thanks a lot.

Which Version of Simulator SDK?

here can I download the latest version of the Simulator SDK?
The only one I could find was simulator-sdk-2.1.2.17-win32-vs2010, and it gives the following error:
1>d:\fady\simulator-sdk-2.1.2.17-win32-vs2010\include\qi\path.hpp(50): warning C4251: 'qi::Path::_p': class 'boost::shared_ptrqi::PrivatePath' needs to have dll-interface to be used by clients of class 'qi::Path'
1>d:\fady\simulator-sdk-2.1.2.17-win32-vs2010\include\qi\path.hpp(49): note: see declaration of 'boost::shared_ptrqi::PrivatePath'
1>d:\fady\naoqisim\controllers\naoqisim\singletons.cpp(81): error C2660: 'Sim::SimLauncher::launch': function does not take 5 arguments
1>d:\fady\simulator-sdk-2.1.2.17-win32-vs2010\include\alsimutils\sim_launcher.h(34): note: see declaration of 'Sim::SimLauncher::launch'

I could compile it by removing the last parameter of the line:
return mLauncher->launch(mModel, naoqiPort, wbu_system_short_path(sdkPrefix.c_str()), std::vectorstd::string(), halInitializedCallback);

But it doesn't look like I have the same version of naosim used here

Posture Library Error

Hello sir,
I hope you are doing good. I followed everything on your document and did as you described but after i open webots and load the naoqism.wbt world in it, i get this message
[naoqisim] [E] 1248 posture: PostureLibrary::loadLibraryFromFile: cannot open file ""
everything else is working just as you described but due to this messeage probably my webots and choreographe nao are not in synchronization and moving nao in choreographe does not has any effect on nao in webots. I highly appreciate your work. Kindly help me, thanks.

This is the whole message my webots console shows:

WARNING: PointLight: A quadratic 'attenuation' should be preferred to have a realistic simulation of light. Only the third component of the 'attenuation' field should be greater than 0.
INFO: naoqisim: Starting controller: "E:\FYP\naoqisim-master\controllers\naoqisim\naoqisim.exe" 9559
[naoqisim] Qt: Untested Windows version 6.2 detected!
[naoqisim] Error: %1 is not a valid Win32 application.
[naoqisim] (dynamic library)
[naoqisim] Error: failed to load E:/webots/Webots/resources/projects/plugins/robot_windows/generic/generic.dll library
[naoqisim] ===== naoqisim controller started =====
[naoqisim] Press the real-time button [>] to start the simulation, then you can connect Choregraphe.
[naoqisim] ===== starting alsim controller =====
[naoqisim] sdkPrefix: ....\aldebaran\simulator-sdk
[naoqisim] [E] 1248 posture: PostureLibrary::loadLibraryFromFile: cannot open file ""
[naoqisim] [I] 1248 SimLauncher: Launching ....\aldebaran\simulator-sdk\bin/hal -s hal-ipc9559 -p HAL/Robot/Type:string=Nao -p HAL/Simulation:int=1 -p HAL/Time:int=0 -p HAL/CycleTime:int=0 -p DCM/Time:int=0 -p DCM/CycleTime:int=0 -p HAL/SimShmId:int=9559 -p HAL/Ack:int=0 -p HAL/Nack:int=0 -p HAL/Error:int=0
[naoqisim] [I] 1248 SimLauncher: Launching ....\aldebaran\simulator-sdk\bin/naoqi-bin.exe -p 9559 --writable-path C:\Users\MSI\AppData\Local\Temp\SimLauncher6JuljXd
[naoqisim] Webots cameras enabled.
[naoqisim] Add the '-nocam' option in 'controllerArgs' to disable the cameras and increase the simulator performance.
[naoqisim] simulator-sdk max camera resolution: CameraBottom: 1280x960
[naoqisim] Webots camera resolution: CameraBottom: 160x120
[naoqisim] simulator-sdk max camera resolution: CameraTop: 1280x960
[naoqisim] Webots camera resolution: CameraTop: 160x120

Cartesian motion infeasible when trying to make NAO move.

Using:
Webots R2019a Revision 1
Ubuntu 18.04
Python 2.7.15 :: Anaconda, Inc.

I ran the nao walk examples from aldebaran docs. When I run the script, the robot seems to get in a ready state but it does not move. I am getting a lot of error messages in the console regarding infeasible cartesian motion.
I am providing all the webots console logs below.

naoqisim init
on running script

Also the script that I'm trying to run:
nao_walk.py

Simulated NAO not moving

Hi,
I am using:
Webots R2019a Revision 1
Ubuntu 18.04
Python 2.7.15 :: Anaconda, Inc.

I am able to have the simulated NAO showing up.
Screenshot from 2019-03-21 12-09-33

However, when command is sent from both python or Choregraphe Suite 2.1.4, the NAO robot doesn't move. Is there something I did wrong?

Thanks for any help provided.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.