Skip to content

Instantly share code, notes, and snippets.

@Cifro
Created April 25, 2012 12:35
Show Gist options
  • Save Cifro/2489436 to your computer and use it in GitHub Desktop.
Save Cifro/2489436 to your computer and use it in GitHub Desktop.
Problem with service ports...
// In OnExecute() function in joystick RTC i have something like this:
if (this.naoPosesConsumer.IsValid)
{
if (this.joystick.ButtonPressed(7))
{
this.naoPosesConsumer.Proxy.InitialPose();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRTM.Core;
using Aldebaran.Proxies;
namespace NaoMotionRTC
{
class NaoPosesInitialisation: INaoPosesInitialisation
{
private MotionProxy motion;
public void setMotionProxy(MotionProxy motion)
{
this.motion = motion;
}
public void InitialPose()
{
if (this.motion != null)
{
Console.WriteLine("InitialPose called.");
// exception raised here O.o
if (this.motion.walkIsActive())
{
this.motion.stopWalk();
}
float HeadYawAngle = 0;
float HeadPitchAngle = 0;
// etc... settings for angles.
this.motion.angleInterpolationWithSpeed("Body", angles.ToArray(), 0.3f);
}
else
{
Console.WriteLine("[InitialPose()] Motion proxy is not connected. Call setMotionProxy() method first.");
}
}
public void StandPose()
{
throw new NotImplementedException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment