Welcome, Guest. Please login or register.
Did you miss your activation email?

Username: Password:


Pages: [1] 2 3   Go Down

Author Topic: PDK IR rebuild with instructions  (Read 27344 times)

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
PDK IR rebuild with instructions
« on: September 03, 2009, 08:17:08 AM »

I have used the PDK to set up my tv remote as a controller for pleo.
To do this i rebuilt the the IR sensor.p and .upf to understand them better ,here they are:

Sensor.p

//
//
// ir_remote_test sensors.p rebuilt by justbede
//
//
// Copyright(c) 2008 Ugobe, Inc.
//

// Native functions
//
#include <Log.inc>
#include <Script.inc>
#include <Sensor.inc>

#include <String.inc>
#include <Motion.inc>

#include "motions.inc"

// called once on entry
//
public init()

{
    // disable all messages except ours ('script:')

    log_disable(MSG_ALL);
    log_enable(MSG_SCRIPT);
    
    

    printf("IR REMOTE TEST\nCompatible with Acroname R278-IR-REMOTE NEC-protocol remote control.\n");


}


// called on each sensor trigger
//

public on_sensor(time, sensor_name:sensor, value)

{

    switch (sensor)

    {

    case SENSOR_IR:

        {

            new imsg[16];


            sensor_read_data(SENSOR_IR, imsg);

                    
            printf("=== SENSOR_IR, msg received %s ===\n", imsg);


            
if (string_compare(imsg, "1600") == 0)      // '1' key

            {

                printf("KEY 1\n");

            }


            else if (string_compare(imsg, "1500") == 0) // '2' key

            {

                printf("KEY 2\n");

            }

            else if (string_compare(imsg, "1400") == 0) // '3' key

            {

                printf("KEY 3\n");

            }


            else if (string_compare(imsg, "0E00") == 0) // '4' key

            {

                printf("KEY 4\n");

            }

            else if (string_compare(imsg, "0D00") == 0) // '5' key

            {

                printf("KEY 5\n");

            }

            else if (string_compare(imsg, "0C00") == 0) // '6' key

            {

                printf("KEY 6\n");

            }

            else if (string_compare(imsg, "0A00") == 0) // '7' key

            {

                printf("KEY 7\n");

            }

            else if (string_compare(imsg, "0900") == 0) // '8' key

            {

                printf("KEY 8\n");

            }

            else if (string_compare(imsg, "0800") == 0) // '9' key

            {

                printf("KEY 9\n");

            }

            else if (string_compare(imsg, "4004") == 0) // 'up' key

            {

                printf("KEY up\n");
                motion_play(mot_com_walk_fs)

            }
        

            else if (string_compare(imsg, "4404") == 0) // 'mdl' key

            {

                printf("KEY mdl\n");

            }

            else if (string_compare(imsg, "0400") == 0) // '12' key

            {

                printf("KEY 12\n");

            }

            else if (string_compare(imsg, "0100") == 0) // '13' key

            {

                printf("KEY 13\n");

            }

            else if (string_compare(imsg, "0000") == 0) // '14' key

            {

      // this may not occur since we filter 0 IR values
                printf("KEY 14\n");
            }

            else
 
           {

                printf("Unhandled key\n");

            }

        }

    }

// returning true will cause the sensor to be reset. if we do not

// do this, we will continue to be called, unless we do an explicit resetSensor call



    return true;

}


// called when we exit, just before unloading
//

public close()


{

    printf("close\n");

}

ir_remote_test.upf

<ugobe_project name="sensor">   //rebuilt by justbede
  <set-default name="INCLUDES" value="" />


  <options>

  <include value="./include:../../include"/>

  <tools>

   <pawn value="pawncc %i -S128 -O2 -V2048 -C- %I -o%o TARGET=100"/>

    </tools>

    <directories>

      <build value="build"/>

      <include value="include"/>

    </directories>

  </options>



  <set-default name="MEDIA" value="../../media" />


  
  <set name="COMMANDS" value="${MEDIA}/commands"/>

  <set name="MOTIONS" value="${MEDIA}/motions"/>

  <set name="SOUNDS" value="${MEDIA}/sounds"/>


  
  <resources>



        <!-- Scripts -->
    <script path="sensors.p"/>


        <!-- Motions -->
    <motion path="${MOTIONS}/com_walk_fs.csv" />



  </resources>


</ugobe_project>

To get this to work with my own tv remote i built the original scripts put it in pleo turned him on and hooked him up to dinomite, i then pointed my tv remote at his nose dinomite then brought up a message saying something like ir signal recieved and listed a 4 digit code for the signal. I wrote the code down turned pleo off edited the sensors.p so that one of the "else...if" functions read as this:

else if (string_compare(imsg, "4004THIS IS MY REMOTE CODE FOR UP") == 0) // 'up' key

            {

                printf("KEY up\n");
            }

Now when pleo was hooked up to dinomite with new script in him when i press up on the remote, the DM monitor reads KEY: up. To then add function to the input i added this to afore edited code:
            
else if (string_compare(imsg, "4004") == 0) // 'up' key

            {

                printf("KEY up\n");
                motion_play(mot_com_walk_fs)

            }
Now with the skit in pleo, he walks forwards on command from the tv remote. Add extra code to make pleo do what you wish via remote :D I am now working on getting pleo to control my television so that as part of a drive program he will use the control to up his properties, heres an example. Pleo is feeling a little sad, he turns the tv on and puts a comedy channel on this will up his happiness property.

Video linked below!

http://www.youtube.com/watch?v=nhfhQVJiZ3w
« Last Edit: September 03, 2009, 08:59:13 AM by justbede »
Logged


Innvo Labs, creating life since 2009

Dadio

  • Pleozoologist
  • * Posts: 247
  • Male
  • Robotics, is the sincerest form of flattery!
Re: PDK IR rebuild with instructions
« Reply #1 on: September 03, 2009, 08:32:33 AM »

Very cool justbede.  ;)

I don't know if I can duplicate and improve on your success. ^-^

Keep up the good work and keep us posted I'm looking forward to the video.  :)

Dadio 8)
Logged
PLEO's Forever!
Take Good Care!  - from Dadio 8)  & Stoney [img width=200 height=50 alt=]http://bobthepleo.com/forums/MGalleryItem.php?id=1183[/img]

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #2 on: September 03, 2009, 09:01:42 AM »

This is all stuff i want to eventually post in file format with decent tutorials but at the moment i need to sort out the health of my computer, don't want to be sharing any nasties :p
Logged
Innvo Labs, creating life since 2009

mweed

  • Grand Poobah
  • Triassic pleo master
  • ***** Posts: 1758
  • us Male
  • Pleo(s): Bob, Mopey
  • : Tomat Harvest Festivals
    • Professor
    • Wile_E_Coyote
    • Dr_Bunsen_Honeydew
    • Snoopy
    • Bob the Pleo
Re: PDK IR rebuild with instructions
« Reply #3 on: September 03, 2009, 09:28:28 AM »

This is cool stuff!

What you need to do is finish off the programming of the controls so that

 left arrow = walk left
 right arrow = walk right
 down arrow = back up
 the numbers 0-9 play sounds (bark, moo, growl, etc.
  Have some fun!  program as much as possible,

Then post the personality as a compiled URF with a list of commands and the make/model of your TV so that people can set their universal remote to mtach the code on your pleo, and VOILA!!  You've published the first remote control personality for pleo!!!!

Logged

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #4 on: September 03, 2009, 12:22:33 PM »

lmao without seeing what you said mweed i have done exactly that but i am also including a volume control and maybe some dances heh.
p.s thanks for the U.remote idea  ;D
« Last Edit: September 03, 2009, 12:26:33 PM by justbede »
Logged
Innvo Labs, creating life since 2009

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #5 on: September 03, 2009, 01:18:55 PM »

if anyone has decent anti-virus software i'd really like the file checked before by someone else before i post it because i really don't trust my laptop at the moment.
Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK IR rebuild with instructions
« Reply #6 on: September 03, 2009, 03:49:47 PM »

Haha that is absolutely awesome!

If you can Justbede download AVG free edition, its the best free anti virus out there, it often picks up viruses my subscription to Norton misses :o
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #7 on: September 03, 2009, 05:33:57 PM »

my problemis my norton ran out a couple of weeks ago  (its been a lazy couple of weeks  :D)  heh ill definitely give it a go oh and thanks for the awesome, made my day :)
Logged
Innvo Labs, creating life since 2009

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #8 on: September 03, 2009, 05:49:44 PM »

Right once i've sorted out the anti-vi stuff this is what i intend for the remote functions:
Forwards
right
back
left
6 sounds
3 dances/ tricks one of them is the amazing play dead skit from pleosaurus rex
volume control has been taken out as i was coding something wrong and it was making everything lag
Some where along the line i smell a tutorial.

ps sorry for filling your fine forum with lots of code Mike  :D
Logged
Innvo Labs, creating life since 2009

mweed

  • Grand Poobah
  • Triassic pleo master
  • ***** Posts: 1758
  • us Male
  • Pleo(s): Bob, Mopey
  • : Tomat Harvest Festivals
    • Professor
    • Wile_E_Coyote
    • Dr_Bunsen_Honeydew
    • Snoopy
    • Bob the Pleo
Re: PDK IR rebuild with instructions
« Reply #9 on: September 03, 2009, 08:38:53 PM »

Fill away!!!  the more the merrier.
Logged

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK IR rebuild with instructions
« Reply #10 on: September 03, 2009, 08:48:24 PM »

Sounds great, let me know if you need any custom motions :) I don't think the volume control is a big loss really, the Pleo button works fine :) I don't think I have ever used the volume button on my Pleo's except by accident :P
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #11 on: September 04, 2009, 11:07:33 AM »

Hehe i agree always seemed a bit needless. www very tempting which of your skits would you say showed off pleos movement best?

ps thanks for the anti vi info guys i now have both avg and clamwin portable.
« Last Edit: September 04, 2009, 11:17:10 AM by justbede »
Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK IR rebuild with instructions
« Reply #12 on: September 04, 2009, 05:48:23 PM »

Quote
which of your skits would you say showed off pleos movement best?

Well none really since MySkit is a bit limited sometimes, but the Elvis one seems to be the most downloaded...

I know this would be really tricky and very complex but just wondered if it were even possible... is it possible to have an entire personality triggered by a remote..? As in you press a button and Pleo goes into Watchdog, press another and Pleo puts on the Pleosaurus personality etc, similar to how a D-rex works ;)
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #13 on: September 04, 2009, 06:35:20 PM »

got you on that, i've been using dinomite to re-make the pink the panther dance. Um i'm not sure, there might be a way to give buttons the power to switch between different files on an SD but i'm not sure if that's gunna need a reset or something. I'll have a good read through of the docs and a little play to see what i can come up with. It would certainly make for a cool feature. What i think would be possible for the future is maybe switching between sound resources on an sd. Pleo would have his default personality but you could switch between; cat, dog, dino etc.
Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK IR rebuild with instructions
« Reply #14 on: September 04, 2009, 07:04:27 PM »

Hehe that could be fun, people love it when my Pleo's moo, imagine if they could suddenly turn into a cat lol!
Logged
Eagerly awaiting Vector and Blue!

Dadio

  • Pleozoologist
  • * Posts: 247
  • Male
  • Robotics, is the sincerest form of flattery!
Re: PDK IR rebuild with instructions
« Reply #15 on: September 05, 2009, 01:08:35 AM »

"Rock On!"  ;) justbede. We're loving it! :)

Dadio  8)
Logged
PLEO's Forever!
Take Good Care!  - from Dadio 8)  & Stoney [img width=200 height=50 alt=]http://bobthepleo.com/forums/MGalleryItem.php?id=1183[/img]

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #16 on: September 05, 2009, 05:21:35 AM »

heh as if my cats aren't confused enough, thanks dadio  :D
Logged
Innvo Labs, creating life since 2009

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #17 on: September 05, 2009, 03:39:23 PM »

Right ive decided instead of carrying on all the messing around i've been doing ill put the urf up tomorow without anything over the top like dances then ill add stuff like that in the next few days :D
Logged
Innvo Labs, creating life since 2009

Dadio

  • Pleozoologist
  • * Posts: 247
  • Male
  • Robotics, is the sincerest form of flattery!
Re: PDK IR rebuild with instructions
« Reply #18 on: September 06, 2009, 12:38:23 AM »

I'll be looking forward to it!  ;)

Dadio  8)
Logged
PLEO's Forever!
Take Good Care!  - from Dadio 8)  & Stoney [img width=200 height=50 alt=]http://bobthepleo.com/forums/MGalleryItem.php?id=1183[/img]

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #19 on: September 06, 2009, 06:53:15 PM »

Right heres the first build of the TV remote urf for Pleo.

Since this script uses my tv (which is an LG) as the remote for now you'll have to use a universal remote to use it. You should look for the codes for LG in the booklet that came with your remote. 
If you don't have a universal remote and have the PDK i'm making a tutorial for using your own TV remote with Pleo. It will include; the tutorial and the template sensor.p and main.upf needed for the project. The tut build uses the same resources as the universal.r build but also allows you to change them. The finished tutorial will be up tommorow.
It turns out one of the sounds doesn't like pleo's speakers so it sounds corrupted when playing so please don't worry about that, i'll get rid of it in the next upload.

I had wanted to find the code for my TV but i'm afraid i can't find it anywhere online or not, so if you get your universal remote to work with Pleo please post the code here, thanks.

Any problems or feedback on anything i might have forgotten or fudged give me a shout.

Pleo IR .urf first build

http://rapidshare.com/files/276612006/Pleo_IR.urf

Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK IR rebuild with instructions
« Reply #20 on: September 06, 2009, 07:45:42 PM »

Thank you so much for doing a tutorial as well, I will look forward to setting up one of my remotes to have a play with it :)
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #21 on: September 07, 2009, 03:52:45 AM »

Hehe no worries, i realise that universal remotes can be a right pain. Once i've got the tut and the version with the play dead skit in it, i'll get back to  getting Pleo to control TV's and intergration of both IR features into personalities. Can't wait to see what else people make with the IR stuff.
Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: PDK IR rebuild with instructions
« Reply #22 on: September 07, 2009, 06:40:44 AM »

I don't have a universal remote :P So I will need to alter the coding to work with one of my other remotes. The IR does hold a lot of potential, although just having a Pleo that can walk on command or perform a few tricks on command is fantastic. Especially when it comes to showing a guest Pleo you could tell Pleo to walk up to them and then say hello :) I'm sure it won't be long before someone does work out how to have Pleo switch personalities, or control their emotions. There's so much potential just there without even getting into all the other stuff in the PDK.

And you my friend, started it all ;)
Logged
Eagerly awaiting Vector and Blue!

Dadio

  • Pleozoologist
  • * Posts: 247
  • Male
  • Robotics, is the sincerest form of flattery!
Re: PDK IR rebuild with instructions
« Reply #23 on: September 07, 2009, 09:17:55 AM »

Man justbede! you've come through as promised. I also don't have a universal remote   ^-^

Not to worry I'm happy to wait for the Tut.  :)

Keep swinging dude!  ;D

Dadio  8)
Logged
PLEO's Forever!
Take Good Care!  - from Dadio 8)  & Stoney [img width=200 height=50 alt=]http://bobthepleo.com/forums/MGalleryItem.php?id=1183[/img]

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: PDK IR rebuild with instructions
« Reply #24 on: September 07, 2009, 12:25:49 PM »

Heh well this is definitely making me want to do more in the future woop, the tut shouldn't be long i hope everyone understands my typing etc lol
Logged
Innvo Labs, creating life since 2009
Pages: [1] 2 3   Go Up
 

SimplePortal 2.3.5 © 2008-2012, SimplePortal