6011706 W

This is the course wiki for 601.17/599.17, 2006 Winter. This wiki should be used to ask questions, post resources or findings, to answer existing questions, and so forth.

Locked screen issue

When you finish working in the lab please make sure you've logged out of the machine and not left it "locked" under your account!!!

Playing Sound Files

Hey, we were wondering two things: 1) How do we play a recorded file in Java? 2) If we have recorded a file from the Aibo and saved it to a wave file, how can we play it. Should we just be trying to play continuous audio or take the input stream we are getting and play it right away.

Thanks for any help

Ryan, Tyler

Hello Everyone,

I was wondering if any one could help with a problem that my group is having. It seems that when we sent the walk command to the aibo it reacts to the command perfectly until I tell it to turn. Then it turns fine but if i send it a walk forward command or reverse command it spins and kinda walks forward. Any help in this problem would be greatly appreciated.

Thanks

Jer


Hmm.. I'm not clear on the exact problem here. So walking back and forth works.. then turning works fine (you should be able to turn while still moving forward). but if you try to do the walk forward/backward again it just does somethiung strange? (spins and kinda walks forward). One thing i'd try is to lower the values you're sending to the aibo. Its possible that you're sending beyond its range of acceptance for the motion commands and messing something up. With this behaviour, you shoudl be able to constantly send any kind of walk command to the walk engine, so I can't see that being the problem. I think it simply overrides your command with the new one.

Look at my .cs code i posted way below. I think i left my walk code in there so you can see what kind of numbers i'm sending to the AIBO. if its not in there, let me know an di'll look it up.

Good luck

Jim

Preparing Wave Files

In order to configure the sound files properly, you can use the linux program "sox" as follows:
$ sox originalFile.wav -r 16000 -c 1 -w newFile.wav

If you want to know where this leads you to, and also, what other options you have, you might want to ask the manual pages.
$ man sox

Cheers, Basti


Thanks basti for the advice.

Jim

Starting the Microphone Server

Does anyone have code as to how to start the microphone server in the same way you'd start the raw cam server?

Tim


Hi Tim. If you look at the code for starting the raw cam server or the walk behaviour, you'll notice that the !root "Tekkkotsu".... command is simply a map to where the behaviour is in the Controller gui menu. You can simply follow the same syntax and give the menu path to the microphone server. If my explanation isn't clear, let me know and i'll write an example tomorrow.

Jim


Hey Jim. I guess I'm looking at the TekkotsuMon setup file and trying to understand the difference:

	addItem((new BehaviorSwitchControl<RawCamBehavior>("Raw Cam Server",false)));
	addItem(new BehaviorSwitchControlBase(MicrophoneServer::GetInstance()));

so an example would be nice.

Thanks, Tim


Hey Tim, The code you are looking at simply adds the items to the tekkotsumon menu and has nothing to do with starting the code. SOMETIMES, when an item is added to the menu, they put a ->start() on the BehaviourSwitchControl to have the control initially start. I am not sure how you are starting your raw cam server, but in the code I provided, i started it by sending a command to the GuiCommand TCP connection (port 10020). The command syntax varies, but here is a basic rundown of how you can toggle menu items:

send:

!root PathToItem. So, for example,

private const string CMDToggleVision = "!root \"TekkotsuMon\" \"Raw Cam Server\"\r\n"; private const string CMDToggleHeadPoint = "!root \"TekkotsuMon\" \"Head Remote Control\"\r\n"; private const string CMDToggleWalk = "!root \"TekkotsuMon\" \"Walk Remote Control\"\r\n";

The first command string looks in the "TekkotsuMon" menu and start the "Raw Cam Server" behaviour. The second one starts the head remote control, etc.

I dont have a tekkotsu-handy AIBO at this instant, so I can't look in the menu directly for you. However, you can simply find where the behaviour is in the Tekkotsu Mon and program a command as the ones above.

!root "Menu1" "Submenu" ... "Submenu" "Behaviour Name"

Also, MAKE SURE to put the \r\n at the end as this is the windows end-of-lnie format that the protocol uses.

As for the difference between the two commands above, one creates a templated instance of a behaviour, while the other uses a function to make one. I'm not sure what the real effect of this, or why the microphone server offers this instance.. It shouldn't matter though in how you use it.

I hope this helps. If I have misunderstood your problem, please let me know :)

Jim

Look at the java code and see how the gui there does it. Im' sure you can send a command to the command port similar to the !root menu command used to start/stop behaviours. I didn't realise this earlier, but if the aibo is STARTED and not STOPPED, then the back menu is disabled automatically, As Jer suggested you can most likely take advantage of this.

Jim


As far as can remember you can get the aibo to start up in a "Running Mode" so you just need to look to where Tekottsu tells it to start up "Stopped" I think and don't quote me on it but i think it involves estop commands. Good Luck!

Jer

Back Buttons && AutoStart

We would like to use the back buttons for our project, but everytime you press a back button it changes the settings in the Controller GUI. Is there a way to disable this default behaviour for the back buttons?

We would also like to have our AIBO start our project without the need for the GUI. We modified the code in StartupBehavior_SetupModeSwitch.cc to the following:

addItem((new BehaviorSwitchControl<AutonomousProject>("Autonomous", bg, false)) ->start());

and added the "->start()" but we still have to click the running icon in the Controller GUI.

Thanks,

Akil, Navneet and Sebastian

Face LEDs

I've been trying to access and manipulate Aibo's face LEDs. Tekkotsu seems to support only 14 "chunks" of LED-bits for the face - not even allowing for changing their colours, nor allowing for covering the whole face panel with lights. My main source of information has been "ERS7info.h". Has anyone looked deeper into this matter, yet?

Thanks, Basti


Hi Basti,

  I did this quite a while ago, but as I remember, its a very weird setup. Certain things like you can only have certain banks on at once, and then you have to do bit twiddling to get each individual led. However, I can't remember the details. Here are a few things to check out:

http://www.cs.cmu.edu/~tekkotsu/dox/FlashIPAddrBehavior_8cc-source.html the FlashIP behaviour which uses the LEDs to show the IP. This code is kind of cryptic.

http://www.cs.cmu.edu/~tekkotsu/dox/FlashIPAddrBehavior_8h-source.html

http://www.cs.ualberta.ca/~bowling/classes/cmput412/lecture4-tekkotsu.ppt Slide 19 has an excellent exmaple of how to set LED X (the Xth LED)

Hope this helps. If you find any solution, please post it here.

Jim

Just wondering to the general public, when we want to use multiple TCP connections, using threads, do we have to continually open and close socket connections or can we open multiple sockets at the same time.

Thanks Jer, Rye, and Tye


Yes you can as long as they're on different ports and your threads close the connections when the threads terminate.

-Phillipa

---

Thanks again Phillipa

-Ryan, Jer, and Tyler

AUDIO

Finally, the audio mystery is solved. I have managed to hack together some java code to get the audio working. (Thanks to help from ruth).The file is attached at the bottom of this post. Keep in mind that i'm not a java coder and this really is hacked together. However, I am getting sound from the AIBO to a wave file.

ONE PROBLEM. I'm getting a clicking in the left ear. This may be due to my lack of java knowledge and how i'm approaching the file. If anyone manages to fix this, please let me know.

First: You need to start tekkotsu mon, connect to your aibo, and enable: Tekkotsu Mon, Microphone server.

Then, edit the file i posted and paste your IP in the variable host near the top of the file.

compile and run, it should save the audio to a file. if it doesnt work, try unstopping the aibo.

Jim

Files:AiboSound.tgz

<<<<<<<

First off, Thank you very much Phillipa, that was one of the issues that we had. Also thanks to Jim for helping us fix the other error we had. Turns out that we need to have

       writer.print("!root \"TekkotsuMon\" \"Raw Cam Server\"\r\n");

instead of:

       writer.print("!root \"TekkotsuMon\" \"Raw Cam Server\"");

This means alot considering it will not work without the \r\n.

Jer, Rye, Tye (we now have a chance)

Here is my code to connect to the aibo. Should just create a TCP socket and tell it to start sending and then it uses a VisionPanel to start accepting UDP packets. Please let me know!!!

	public ControllerAibo() {
		gui = new JFrame();
		Container contentPane = gui.getContentPane();       //Need to add buttons and stuff
                gui.setLayout(null);
		gui.setSize(1255, 900);
		gui.setTitle("Bomb Squad");
		gui.setLocation(5,5);
          //*** Sets up information for VisionPanel****
                String[] passargs=new String[MAX];
                passargs[0]="UDP";
                try{
                      TCPsocket = new Socket("10.100.231", cameraPort);                        //cameraPort is 10011
                      BufferedReader reader = new BufferedReader(new InputStreamReader(TCPsocket.getInputStream()));
                      PrintWriter writer = new PrintWriter(TCPsocket.getOutputStream());
                      writer.print("!root \"TekkotsuMon\" \"Raw Cam Server\"");           //The command that Jim told us to Put in order for it to send
                      writer.flush();                                                        
                      String line;
                      System.out.println("TRYING");   
                      while((line = reader.readLine()) != null)
                      {
                        //JUST WAIT FOR IT TO SEND SOME something and then disconnect
                      }
                      TCPsocket.close();              
                }catch(IOException e){}

                camera = new VisionPanel("10.100.231", cameraPort, passargs);           //Calls the VisionPanel
                AiboVision();                                                           //Sets up the camera settings
                contentPane.add(camera);

          //**** Sets the Placement of the objects ***     
                Insets insets = gui.getInsets();
		camera.setBounds(90 + insets.left, 15 + insets.top, 500, 500); 

          //*****
                camera.getListener().addListener(this);
		(new StatusUpdateThread(this)).start();
		gui.show();                                 //SHOWS GUI

THANKS


(editted 03-24-06) The code above likely won't work because the Vision Panel has facilities to control its own networking connection. You should be able to pass it the arguments and then add it to the GUI and have it work. You might have better luck using the constructor that takes in host and then the rest of the arguments as an array of strings. Hope that helps.

Having a second look at this code, I noticed something that I didn't notice before. You guys are opening a TCP connection on the camera port to send the command. The command strings that Jim uses in his example should be sent on port 10020. Once the command string is sent you can induce a wait time and then try to open the connection on other ports(eg. vision, walking or head pointer ports).

-Phillipa

Audio Problems

Has anyone managed to connect to the audio port on the Aibo? We can't find anywhere that the MicrophoneClient class is being called in Tekkotsu Mon. We've tried sending a modification of the command for the raw cam to the command port before opening our connection and it still gets refused by the Aibo.

-Kamikaze Aibo Group

MARCH 18th - Video Feed using Java

For those people that are using java interfaces (I believe the other Bomb Squad Group), we are still stuck on the video feed and wondering if you can give us any help. We know we should be looking in the controllerGUI.java and the VisualGui.java files, but we must be missing something. Any help in this area would be most appreciated.

Ryan, Jer, and Tyler


Could you please give more detail? While I am not familiar with java, there may be higher level issues that are causing the problem. Are you getting the images from the AIBO Okay? did you check the C# networking code posted below?

Jim

March 13th - AIBO Lab Update

Hello, sorry for the delay. The carpet has been duct taped down and there is now cardboard in the lab to let the AIBO play on. PLEASE let me know if the cardboard proves to be too slippery.

Thanks

Jim

March 11th - AIBO Networking Code

Hello, Here is a snippet of c# code that I have used to connect to the AIBO over the network and to communicate with it (i.e., streaming video, walk/head control). Note that this code is a snippet and can not be run as-is. The code is quite messy, but it should be okay to work with. In particular, the section which extracts an image from a video stream packet may be useful.

AIBONetwork.cs

Jim.

http://aquarius.ils.albany.edu/robotics/Spring2006/Lecture3-Motion.ppt

Check out this link for some programming advice for motions and postures. Lists a few caveats and problems you can run into involving deadlock and shared memory pointers.

Jim

Has anyone managed to connect their GUI's to the aibo's yet? If you have, could you post how you got the connection estabilished.

Thanks


Each Tekkotsu behaviour is on a different port. some are UDP (like the video streaming) and others are TCP (like the head pointer). Most of the ports are listed in <Tekkotsu>/Shared/Config.h, though they're a bit cryptic to find (note that the variables are declared above and initialised below in the file). This config.h also lists for many behaviours if they use udp or tcp.

After connecting, it is up to you to get the network protocol. Its usually very very simple (including a single byte command or such). Read the TekkotsuMon and the Tekkotsu behaviour source code for specifics. Also be sure to check out the networking slides i placed on this wiki below as it talks about a few caveats such as Endienness for multi-byte primitives.

Since the client is written in whatever language you want, i can't really help with the client side code. What I CAN do, is later I will post a snippet of C# code that gets the camera images, and sends commands to the head pointer / walk / sound emission behaviours. This code is poorly written, however (I had about a week to do it for a course), and I hold no guarantees over its accuracy or correctness.

Jim

Hey all, We made some postures in the GUI's posture editor, and were wondering what steps we would need to go thruough so that we can get all the postures happen in a sequence. Do we do this with a Behaviour?

Thanks, Ian, Lena


http://www.cs.cmu.edu/~dst/Tekkotsu/Tutorial/postures.shtml

You can use a motion sequence, but rather than change joint values throughout the sequence you can load different postures. Take a close look at the page in the link above, it talks about this.

March 7th - Tunnel Issues Still

Were finding it hard to get through the tunnel without the carpets secured down, were also having a problem where the ears get stuck under the carpet when the aibo falls over in the tunnles and have no idea to fix this. We have also flipped the carpets over becuase they seem to be more grippy facing up.

Ian, Lena


We (*FINALLY*) got some duct tape. I'll go to the lab and tape down the carpets after class today.

March 6 - GUI Implementation

We're wondering what tools we should be using to implement our GUI. We're currently using Java similar to the TekkotsuMon GUI.

Lena, Stephen, Phillipa & Ian


There are no restrictions on the tools you are using for your interface implementation (as long as they are accessible in the lab). If I were you I would have chosen the tools that you are most knowledgeable with and focus most of the development efforts on the quality of the interface and the effectiveness it provides when approaching your Kamikaze bomb squad task.

I hope this helps, best, Ehud

Mar 5 - WaypointEngine

How do you include a Waypoint Walk file into your code? We created such a file in the Tekkotsu Monitor GUI, successfully ran it from the GUI. Also, we were able to load the file using WaypointEngine.LoadFile(...); We thought that by calling WaypointEngine.go(); afterwards, the Robot should walk according to the file. However, it stands still. Maybe there's another inbetween step necessary?

Akil, Sebastian and Navneet


I'm one of the Tekkotsu developers, I came across your course wiki today and thought I might drop a line regarding the WaypointEngine not moving question: the students need to make a WaypointWalkMC and add that to the MotionManager. WaypointEngine by itself is an abstract class for waypoint storage and management. WaypointWalkMC combines that with an actual walk motion command so the waypoints can be executed.

Hope your course is going well!

-ethan

Mar 3 - updates

Sorry for the delays on the wiki. I have (mostly) handled (i think) the questions you asked. See below

Jim

Feb 27th - Audio?

Anyone looked into capturing the audio from the mike? We're looking for the port number and packet structure.

-Tim


You may want to talk to Ruth in our class about that, I'm sure she has already coded that up. If you get it working, please share your results here. Also, you could check out the Tekkotsu source code directly.

Jim

We had the same difficulty...we are going to try to create our own walk. Will keep you posted with the results.

Jer, Rye, Ty

Has anyone managed to get the Aibo to walk through the obstacle course? We have tried with mixed success. It is very difficult to get the aibo to enter the tunnel, and walk on the folded tunnel fabric etc.

-Ian,Stephan,Lena & Phillipa


We added some carpet yesterday to the tunnels and it seems to work well. Today I will try and get some duct tape to firmly attach the carpet to the floor and to remove problems where the carpet overlaps. If there are any problems with this, please post them here.

Jim

. . .

  1. include "Behaviors/BehaviorBase.h"

//#include "Events/EventRouter.h"

  1. include "Sound/SoundManager.h"

//! DESCRIPTION class orangeLEDPosture : public BehaviorBase { public:

	//! constructor
	orangeLEDPosture() : BehaviorBase("orangeLEDPosture") {}

	virtual void DoStart() {
		BehaviorBase::DoStart(); // do this first (required)
		cout <<"orange LED posture" << endl;	
		SharedObject<PostureMC> c("orangeled.pos");
		MotionManager::MC_ID id2=motman->addPrunableMotion(c);//,MotionManager::kEmergencyPriority+1);
	}

. . .

If anyone has gotten to the point in the code where you load postures using the PostureMC, maybe if you could take a look at this code snipit. We used this code for our HelloWorld program successfully, but when we used it in another posture control program, it didn't recognize Posture MC. THis is the error:

In file included from StartupBehavior_SetupPostureSwitch.cc:7: orangeLEDPosture.h: In member function `virtual void orangeLEDPosture::DoStart()': orangeLEDPosture.h:21: error: PostureMC' undeclared (first use this function) orangeLEDPosture.h:21: error: (Each undeclared identifier is reported only once for each function it appears in.) orangeLEDPosture.h:21: error: template argument 1 is invalid orangeLEDPosture.h:21: error: ISO C++ forbids declaration of `c' with no type orangeLEDPosture.h:21: error: invalid conversion from `const char*' to `int' orangeLEDPosture.h:22: error: no matching function for call to MotionManager::addPrunableMotion(int&)' /home/projects/aibo/luterbaj/aibo/Tekkotsu_2.4.1/Motion/MotionManager.h:133: error: candidatesare: short unsigned int MotionManager::addPrunab leMotion(const SharedObjectBase&, float)

Thanks for your time guys.

Ryan, Tyler, and Jer


add #include "Motion/PostureMC.h"

to the top of that file. Let me know if it doesn't work.

Jim

Feb 20th - Sound Tracks Posted

Child Bomb

Feb 9th - Word of advice

Working with Tekkotsu is difficult. The code and interface is often not documented, sometimes wrongly documented, and there are many quirks. Considernig that for this project most groups will be dealing with vision, sound, walking, AND networking (often all simultaneously), I have to say that it will be a highly difficult task. In light of this, I highly recommend all groups to get started early, to allow yourself time for a few brick walls (you will hit some), and to allow me (Jim) and Dr. Sharlin to have the time to address any concerns you have.

Feb 9th - Additional Help

  • Networking:
    • There is little documentation on Tekkotsu networking. The slides which I had prepared for a lecture can be downloaded here.
    • As suggested on the tekkotsu website, you are best off reading the class reference for the wireless and socket classes directly. Link:

(Wireless) (Socket).

  • Vision:
    • The Tekkotsu website has a basic vision introduction here.
    • ... and a lower level vision discussion here.
    • The TekkotsuMon sourcecode offers great examples of how the vision can be implemented
  • Sound:
    • Playing basic sounds: link
    • Accessing the microphone can be done through the Microphone Server class link

Feb 6th - Slides from last week's lecture

Motion Walking

Feb 6th - Compilation problems

This note is in response to a few problems that have come up. It seems that tekkotsu simply gives cryptic compile error messages which do not seem to point out your problem. Heres the deal:

When you get the pages-long list of colourful warnings, pay close attention. Somewhere hidden in there, there may be red lines, indicating errors. Pay attention to these lines. In short, do not simply skip these warnings without paying attention. Why do so many of these warnings happen? I am not sure. They do not happen on my machine, so it must simply be the combination of the tekkotsu version and the compiler version installed on those machines.

Hope this helps

Jim

Hey Jim,

We are wondering if you could post some code on how to implement a posture control. We are having alot of difficulty with this concept.

Jeremy, Tyler and Ryan


I think this is the group I talked to in the lab, and we have it solved. However, for everone else, I'll give a quick rundown.

  • Try not to run motion commands in the StartupBehavior file. There are initialisation issues before and after your code, so it is best to put everything in your own behaviour.
  • Use the PostureMC class, and not the LoadPostureMC class. the LoadPostureMC is a TEKKOTSU GUI control which interfaces with various network ports and such to make the browsable interface in the controller gui
  • Look in project/ms/data/motion for *.pos files describing the built in postures
#include "Motion/PostureMC.h"

... and somewhere in yuor code... (maybe in dostart?)

SharedObject<PostureMC> pos("stand.pos");
pos_id=motman->addPrunableMotion(pos);

Note that you do not have to put the full path of stand, but you DO need to put the file extension.

Jim

Dear Jim,

I have been looking at some code and I have some questions about the led example code.

First of all I assume the below code defines a class called SampleBehavior that is public, and an extension of BehaviorBase.

class SampleBehavior : public BehaviorBase

And I don't understand this code and I was hoping you (or anybody) could please explain it to me.

  SampleBehavior() : BehaviorBase("SampleBehavior"),
  // Add an initializer for leds_id

leds_id(MotionManager::invalid_MC_ID)

  {}

Thanks, Ian

PPS, can anybody find a list of the different colour boxes that I can get?


This is the (unfortunately cryptic) c++ constructor syntax. First, it calles BehaviorBase constructor on the current object with the given paramater ("SampleBehavior"). Then, it initialises the following variables to the given values, with the variable(value) syntax. In the example you posted, it calls the parent-class constructor, then sets the class variable leds_id to the value MotionManager::invalid_MC_ID. Hope this helps. (as for the colour boxes on THIS site, just use the ones listed here. I think this is it)

Jim

Jan 27 - Mind 3

Mind 3 is now in the lab. Give it a try!

Jan 26 - Extra Resources

Did you know that the university has free online books, including books for programming? These are available here. In particular, the books on C++ found here may be useful. Thanks to Tim Au Yeung for the info.

In addition, CMU has a website with a variety of tekkotsu tutorials and sample programs here.

Jan 22 - AIBO Lab

Hello, I have JUST been informed that A) the lab will be cleaned soon, and that b) we have been given a piece of carpet to use. Please try and use this carpet whenever working with the AIBOs to minimise damage to them. Thanks!

Jan 18 - Hello World

Recommended 'Hello World' example: link


Jan 18 - Work Backups

NOTE: The local machines in the AIBO lab are NOT backed up. As such, it is recommended that you work from your home directory (~/) so that your work is backed up daily. The example below has been updated to work from your home directory.


Jan 17 - AIBO lab information.

The following information will help you get started on working with tekkotsu (Thanks to Deb at bugzilla for the help):

Aibonet is 10.100.0.xxx. The IPs of the computers and AIBOS are as follows:

  • PCs:
    • Cerberus .225
    • Sirius .226
    • Anubis .227
    • Orthrus .228
  • AIBOs:
    • 1 .230
    • 2 .231
    • 3 .232
    • 4 .233

Tekkotsu setup:

A 'pristine' tekkotsu is available in a protected folder : /usr/aibo/tekkotsu

To get a working copy, copy this folder to a location of your choice. For this intro, we will assume that you copied it to /home/uga/smithj/aibo (your home directory/aibo)

mkdir ~/aibo

cp -R /usr/aibo/tekkotsu/* ~/aibo

To finish the setup, the following changes are recommended: Edit ~/aibo/Tekkotsu_2.4.1/project/Environment.conf

TEKKOTSU_ROOT /home/uga/smithj/aibo/Tekkotsu-2.4.1
MEMSTICK_ROOT /media/usbdisk
OPENRSDK_ROOT /home/uga/smithj/aibo/OPEN_R_SDK

Edit ~/aibo/Tekkotsu_2.4.1/project/ms/open-r/system/conf/wlandflt.conf

HOSTNAME=dogname

Getting going:

  1. Compile the default tekkotsu project
    • cd ~/aibo/Tekkotsu_2.4.1/project
    • make (This may take a while)
    • Insert your memory stick into the stick reader/writer
    • make install
    • Remove the memory stick, and insert it into the AIBO.
    • Place the AIBO on a safe spot on the floor with its legs outstretched. Boot up the AIBO and wait until you hear a growling noise. (NOTE: If the AIBO crashes with 'death' music, make sure that the wlan switch next to the memory stick is set to on).
    • cd ~/aibo/Tekkotsu_mon_2.4.1/
    • ./ControllerGUI <DOGIP>

The Controller GUI should connect without any issues. Play with the controller gui, getting a feel for the various behaviours already implemented and the capabilities of the AIBO.


Jan 16

Tekkotsu Introduction slides are available here:

  Part 1 Part 2 Part 3