playMaker

Author Topic: Nao Robot and playmaker  (Read 1117 times)

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • View Profile
    • Online Playmaker Courses
Nao Robot and playmaker
« on: May 11, 2014, 08:32:42 PM »
Hi Guys,

What I am trying to do is get the Nao Robot working inside of unity3d.

Here is a link to the Nao:
https://community.aldebaran-robotics.com/doc/1-14/dev/python/index.html#python-introduction

They use python, c++, java and .net as options for programming for the Nao.

Here is a link to their docs on python scripting:
https://community.aldebaran-robotics...n-introduction

When I try and use their .net2 stuff I get the following error though:

MissingMethodException: Method contains unsupported native code
<Module>.<CrtImplementationDetails>.LanguageSupp or t.Initialize (<CrtImplementationDetails>.LanguageSupport* )
<Module>..cctor ()

Here is the code using C# and Playmaker:

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.

using UnityEngine;
using System;
using System.Runtime.InteropServices;
using HutongGames.PlayMaker;
using Aldebaran.Proxies;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory("Nao")]
    [Tooltip("Gets the Nao to say something.")]

    public class NaoTalk : FsmStateAction
    {
        public FsmString naoIPAddress = "10.0.1.2";
        public FsmInt port = 9559;
        public FsmString naoSpeech = "Hello Human";

        public override void OnEnter()
        {
            NaoSpeak();
            Finish();
        }

        private void NaoSpeak()
        {
            TextToSpeechProxy tts = new TextToSpeechProxy(naoIPAddress.Value, port.Value);

            tts.say(naoSpeech.Value);
        }
    }

}

I did look online and it seems I have to use P/Invoke. But it looked like I would have to alter the existing code for the Nao to get it to work before I can use its functions in unity3d.

I am also trying IronPython to see if I can get the python nao code to work. Unfortunately my experience with python is limited. I did get a package off the asset store and the developer replied to my email which is awesome.

I just thought I would ask to see if you guys can help me out. I just thought it would be cool to have the Nao working inside of Unity3d. Then you can do all sorts of applications and games with it. Such as augmented reality interaction etc.

And since I love playmaker, I figured I would make actions for it.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14572
  • Official Playmaker Support
    • View Profile
Re: Nao Robot and playmaker
« Reply #1 on: May 14, 2014, 09:58:41 PM »
Hi,

 I would create a proxy component for this, move all the actual management of the nao classes and calls into a regular monobehavior, and then from custom actions compose them calls. Make that monobehavior a singleton, and as a prefab so that you only need one per scene or if you plan to control several robots, maybe you'll need some higher level of abstraction with a reference to the robot from the action back to the singleton, or a component for each robot.

 Custom actions runs in a very difference thread then monobehavior and coroutines an ienumerators sometimes do not work as expected.

 I am currently facing the same issue with a difference package, and compositing is solving everything.

 Have a go and let me if that works better.

bye,

 Jean