سؤال

I'm currently working with the NAO robotic system developed by Aldebaran Robotics, what I am trying to do is on the fly change the values of a behaviour file for our study. These files are stored as: /behaviours/filename.xar

These files have a fair amount of code in them, and I want to be able to modify the values of each motor on the fly.

 ....
<ActuatorCurve name="value" actuator="HeadPitch" recordable="1" mute="0" unit="-1">
    <Key frame="15" value="16.9607" />
    <Key frame="20" value="16.9607" />
    <Key frame="25" value="16.8198" />
    <Key frame="30" value="16.9607" />
    <Key frame="35" value="16.8198" />
    <Key frame="40" value="16.9607" />
    <Key frame="45" value="16.8198" />
    <Key frame="50" value="16.9607" />
    <Key frame="55" value="16.8198" />
</ActuatorCurve>
...

There are various other ActuatorCurves for different motors in the shoulders, arms, hands, legs, etc of the robot. I'm trying to to figure out a way in which I would be able to open this file, search and find the values in say the HeadPitch motor, modify said values, and save the file.

I know that the users here like code to be shown as what I have done so far, but I haven't written anything yet. I'm just in the process of trying to figure out what the best way is to go about this.

There is always the possibility of creating multiple files at 100% head nodding, 110%, etc. However this is time consuming, and just takes up unnecessary room on the robots hard drive.

هل كانت مفيدة؟

المحلول

There's many way to do that.

What you request should be something like: - open file - parse file using minidom as the format is xml - change it - save it

But depending of the frequency of your changes, it's not a good idea (cpu consuming).

A better way would be to load/parse/change, but then instead of saving it, you could directly send your new timeline to the motion module using motion.angleInterpolationBezier.

Other ways are to export your timeline to python using the "Export motion to clipboard" then to use pure python to modify your timeline like arrays, save it, ...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top