Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Program / Control your Robobuilder robot with LISP !

Korean company maker of Robot kits and servos designed for of articulated robots. Re-incarnation of Megarobotics.
93 postsPage 4 of 71, 2, 3, 4, 5, 6, 7
93 postsPage 4 of 71, 2, 3, 4, 5, 6, 7

What do you think of using Lisp / L# and Robobuilder?

Poll ended at Fri Dec 25, 2009 12:13 am

(it love !)
3
75%
Bring back GOTO !
0
No votes
"Emacs is written in Lisp, which is the only computer language that is beautiful. "
1
25%
"the most intelligent way to misuse a computer"
0
No votes
 
Total votes : 4

Post by l3v3rz » Tue Apr 06, 2010 9:02 pm

Post by l3v3rz
Tue Apr 06, 2010 9:02 pm

Yes PlayPose will do it, but as you say it really want to be passed a LISP list. The code you want is something like this:

Code: Select all

 (= servoPostions (new "Byte[]" 16))

 (.SetValue servoPostions (coerce 125 "Byte") 0)
 (.SetValue servoPostions (coerce 70   "Byte") 1)
 (.SetValue servoPostions (coerce 20   "Byte") 2)
 (.SetValue servoPostions (coerce 55   "Byte") 3)

; etc - set all 16 values to what you want (you could build this as function (toByteArray)

 (tolist servoPostions )  ; this will display the numbers

; now set time and number of steps

  (= duration 200)      ; 200 ms
  (= numberSteps 10) ; number of intermediates

 (.PlayPose wck duration numberSteps servoPositions true)

; subsequent PlayPose - use false at end and it will move from where the last one finished



Triggers will still work - as they actually work at PlayPose level (which is called by PlayFile.

Edit: Here's a functions to do it

Code: Select all
(def toByteArray (pos1)
   "Converts a list into an array of Bytes[]"
   (with (temp (new "Byte[]" (len pos1)))
   (for i 0 (- (len pos1) 1)
     (do
         (.SetValue temp (coerce (nth pos1 i) "Byte") i)
     )
   )
   temp
   )
)


So you can now go (for example) :

(.PlayPose wck 300 10 (toByteArray '(125 4 30 5)) true)

I'll add this to the utilities library
Yes PlayPose will do it, but as you say it really want to be passed a LISP list. The code you want is something like this:

Code: Select all

 (= servoPostions (new "Byte[]" 16))

 (.SetValue servoPostions (coerce 125 "Byte") 0)
 (.SetValue servoPostions (coerce 70   "Byte") 1)
 (.SetValue servoPostions (coerce 20   "Byte") 2)
 (.SetValue servoPostions (coerce 55   "Byte") 3)

; etc - set all 16 values to what you want (you could build this as function (toByteArray)

 (tolist servoPostions )  ; this will display the numbers

; now set time and number of steps

  (= duration 200)      ; 200 ms
  (= numberSteps 10) ; number of intermediates

 (.PlayPose wck duration numberSteps servoPositions true)

; subsequent PlayPose - use false at end and it will move from where the last one finished



Triggers will still work - as they actually work at PlayPose level (which is called by PlayFile.

Edit: Here's a functions to do it

Code: Select all
(def toByteArray (pos1)
   "Converts a list into an array of Bytes[]"
   (with (temp (new "Byte[]" (len pos1)))
   (for i 0 (- (len pos1) 1)
     (do
         (.SetValue temp (coerce (nth pos1 i) "Byte") i)
     )
   )
   temp
   )
)


So you can now go (for example) :

(.PlayPose wck 300 10 (toByteArray '(125 4 30 5)) true)

I'll add this to the utilities library
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by pepep » Fri Apr 09, 2010 9:20 pm

Post by pepep
Fri Apr 09, 2010 9:20 pm

Hello again!

I try the .PlayPose method, but I thing that something is wrong (perhaps, I don't know what but ...).

I bulid this functions:
Code: Select all

(= rstep (list    '(123 156 212 80 108 126 73 40 150 141 68 44 40 138 208 195)
            '(130 165 201 81 115 134 81 31 147 149 72 44 40 145 209 201)
            '(132 171 197 83 117 137 86 28 148 152 78 43 41 154 209 206)
            '(132 175 195 87 117 139 91 27 152 154 87 43 43 164 209 211)
            '(132 178 197 91 117 137 95 28 157 152 97 43 48 172 209 213)
            '(130 179 201 95 115 134 96 31 161 149 105 43 53 179 210 214)
            '(127 178 206 98 112 130 95 35 166 145 111 42 57 182 210 214)
            '(124 175 212 100 109 127 92 40 170 142 113 42 59 183 210 214))
)

(= lstep (list    '(124 175 212 100 109 127 92 40 170 142 113 42 59 183 210 214)
            '(120 172 217 102 105 123 88 46 170 138 111 42 57 182 210 214)
            '(116 167 221 103 101 120 83 51 169 135 106 43 53 179 210 214)
            '(113 162 224 102 98 118 77 55 167 133 97 43 48 173 209 213)
            '(111 157 225 98 96 118 73 57 163 133 87 43 43 164 209 211)
            '(113 153 224 93 98 118 70 55 159 133 79 43 41 154 209 206)
            '(116 152 221 89 101 120 69 51 155 135 72 44 40 146 209 201)
            '(120 153 217 84 105 123 70 46 152 138 69 44 40 140 208 197)
            '(123 156 212 80 108 126 73 40 150 141 68 44 40 138 208 195))
)


(def lpose (dur stp pos)
   (if (or pos)
      ( do (car pos)
         (.PlayPose wck dur stp (toByteArray (car pos)) true)
         ;(prl (car pos))
         (lpose dur stp (cdr pos))
      )
   )
)

(lpose 15 2 rstep) (lpose 15 2 lstep)


and I get a very slowly movement: the robot wait a lot to start the move, suddenly it finish the first move, and is slowly with the second ...

Do you know any answer to that?

Thanks

PD: First at alll I download the last "Lsharp with Robo....zip" file
Hello again!

I try the .PlayPose method, but I thing that something is wrong (perhaps, I don't know what but ...).

I bulid this functions:
Code: Select all

(= rstep (list    '(123 156 212 80 108 126 73 40 150 141 68 44 40 138 208 195)
            '(130 165 201 81 115 134 81 31 147 149 72 44 40 145 209 201)
            '(132 171 197 83 117 137 86 28 148 152 78 43 41 154 209 206)
            '(132 175 195 87 117 139 91 27 152 154 87 43 43 164 209 211)
            '(132 178 197 91 117 137 95 28 157 152 97 43 48 172 209 213)
            '(130 179 201 95 115 134 96 31 161 149 105 43 53 179 210 214)
            '(127 178 206 98 112 130 95 35 166 145 111 42 57 182 210 214)
            '(124 175 212 100 109 127 92 40 170 142 113 42 59 183 210 214))
)

(= lstep (list    '(124 175 212 100 109 127 92 40 170 142 113 42 59 183 210 214)
            '(120 172 217 102 105 123 88 46 170 138 111 42 57 182 210 214)
            '(116 167 221 103 101 120 83 51 169 135 106 43 53 179 210 214)
            '(113 162 224 102 98 118 77 55 167 133 97 43 48 173 209 213)
            '(111 157 225 98 96 118 73 57 163 133 87 43 43 164 209 211)
            '(113 153 224 93 98 118 70 55 159 133 79 43 41 154 209 206)
            '(116 152 221 89 101 120 69 51 155 135 72 44 40 146 209 201)
            '(120 153 217 84 105 123 70 46 152 138 69 44 40 140 208 197)
            '(123 156 212 80 108 126 73 40 150 141 68 44 40 138 208 195))
)


(def lpose (dur stp pos)
   (if (or pos)
      ( do (car pos)
         (.PlayPose wck dur stp (toByteArray (car pos)) true)
         ;(prl (car pos))
         (lpose dur stp (cdr pos))
      )
   )
)

(lpose 15 2 rstep) (lpose 15 2 lstep)


and I get a very slowly movement: the robot wait a lot to start the move, suddenly it finish the first move, and is slowly with the second ...

Do you know any answer to that?

Thanks

PD: First at alll I download the last "Lsharp with Robo....zip" file
pepep
Savvy Roboteer
Savvy Roboteer
Posts: 38
Joined: Sun Mar 28, 2010 7:14 pm

Post by l3v3rz » Fri Apr 09, 2010 10:29 pm

Post by l3v3rz
Fri Apr 09, 2010 10:29 pm

You need to get replace the true with false at the end of PlayPose. If its set true it will read the current position of the servos. Also the duration should be longer, thats the total time - its divided by the number of steps - so dur/stp >= 25. (not 15/2)

cheers
You need to get replace the true with false at the end of PlayPose. If its set true it will read the current position of the servos. Also the duration should be longer, thats the total time - its divided by the number of steps - so dur/stp >= 25. (not 15/2)

cheers
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by pepep » Sat Apr 10, 2010 9:45 am

Post by pepep
Sat Apr 10, 2010 9:45 am

Great!

Code: Select all
(def panda ()
   (while (not (Console.KeyAvailable))
          (do    (lpose 1 1 rstep)(lpose 1 1 lstep)
         )
   )
)


Are the triggers system active in the current RobobuilderLisp.dll? My current version is 7.0, but I think that source is more recently that .dll ...
Great!

Code: Select all
(def panda ()
   (while (not (Console.KeyAvailable))
          (do    (lpose 1 1 rstep)(lpose 1 1 lstep)
         )
   )
)


Are the triggers system active in the current RobobuilderLisp.dll? My current version is 7.0, but I think that source is more recently that .dll ...
pepep
Savvy Roboteer
Savvy Roboteer
Posts: 38
Joined: Sun Mar 28, 2010 7:14 pm

Post by l3v3rz » Sat Apr 10, 2010 11:03 am

Post by l3v3rz
Sat Apr 10, 2010 11:03 am

I think they should work - but have rebuilt and uploaded the file.

When the trigger fires PlayPose should immediately return .

[Edit: BTW - It will return false to indicate it was halted - if no trigger fires it returns true. So you can test this in your keyboard loop]

Make sure you have activated the trigger and also associated the trigger with the created wck object (created by dcmodeOn)

P.s This looks really good - looks like you will have continuous walking going very soon !
I think they should work - but have rebuilt and uploaded the file.

When the trigger fires PlayPose should immediately return .

[Edit: BTW - It will return false to indicate it was halted - if no trigger fires it returns true. So you can test this in your keyboard loop]

Make sure you have activated the trigger and also associated the trigger with the created wck object (created by dcmodeOn)

P.s This looks really good - looks like you will have continuous walking going very soon !
Last edited by l3v3rz on Sat Apr 10, 2010 12:01 pm, edited 1 time in total.
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by pepep » Sat Apr 10, 2010 12:01 pm

Post by pepep
Sat Apr 10, 2010 12:01 pm

Thanks!

I try a continuos movement only interrupt for the trigger rise, but ...

... the dcmodeOn / dcmodeOff necesary for verify the triggers is a slowly action, and interrupt the natural movement get with .PlayPose .. is the same (no really the same but I don't get good responses) that the interval was hight or low, every time dcmodeOff is raise, the robot interrumpt its natural movement ...

Ps: there is and error in .print method, It give an exceptiom message ..

Cheers!
Thanks!

I try a continuos movement only interrupt for the trigger rise, but ...

... the dcmodeOn / dcmodeOff necesary for verify the triggers is a slowly action, and interrupt the natural movement get with .PlayPose .. is the same (no really the same but I don't get good responses) that the interval was hight or low, every time dcmodeOff is raise, the robot interrumpt its natural movement ...

Ps: there is and error in .print method, It give an exceptiom message ..

Cheers!
pepep
Savvy Roboteer
Savvy Roboteer
Posts: 38
Joined: Sun Mar 28, 2010 7:14 pm

Post by l3v3rz » Sat Apr 10, 2010 12:06 pm

Post by l3v3rz
Sat Apr 10, 2010 12:06 pm

Thanks - Have fixed the print error in the latest one uploaded. What do you have the trigger timer value set too?

PS. Can you send me the code so I can have a look over it - I have sent a message with my email address in.

cheers
Thanks - Have fixed the print error in the latest one uploaded. What do you have the trigger timer value set too?

PS. Can you send me the code so I can have a look over it - I have sent a message with my email address in.

cheers
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by l3v3rz » Sat Apr 10, 2010 5:24 pm

Post by l3v3rz
Sat Apr 10, 2010 5:24 pm

Good news is there is a bug in the trigger code - I haven't found it but I can replicate. If you let it run for a while - all of a sudden its speeds up and runs at full pelt !!! After that it works correctly - so it must be down to the timer that triggers the event handler = (I'll get bug fix out asap and let you know)

Its cool watching it at run BTW - I used

Code: Select all
(def panda ()
   (while (not (Console.KeyAvailable))
          (do    (lpose 25 1 rstep)(lpose 25 1 lstep)
         )
   )
)


So 25ms duration / 1frame

Edit: The time count used to check if it needs to test for an event is only set to zero if Playpose bool is true - but you only want this true for the first call so it initialises reading current servo positions. After that use PlayPose false.

Code: Select all
(= ff true) ; global

(def lpose (dur stp pos)
   (if (or pos)
      ( do
         (.PlayPose wck dur stp (toByteArray (car pos)) ff)
         (= ff false)
         ;(prl (car pos))
         (lpose dur stp (cdr pos))
      )
   )
)

(def panda ()
   (= ff true)
   (while (not (Console.KeyAvailable))
          (do    (lpose 25 1 rstep)(lpose 25 1 lstep)
         )
)


This should should work for now - I'll add a specific reset into the library in next drop.

I would think if you change the value 25 to be longer on one stride than the other you may also be able to steer the bot.


Have fun!

PS updated site with new RobobuilderLib - also added Lisp file based on the above (works for me - but remove cv18 function form playpose for your robot configuration (I have hip kit)

http://code.google.com/p/robobuildervc/ ... tions.lisp
Good news is there is a bug in the trigger code - I haven't found it but I can replicate. If you let it run for a while - all of a sudden its speeds up and runs at full pelt !!! After that it works correctly - so it must be down to the timer that triggers the event handler = (I'll get bug fix out asap and let you know)

Its cool watching it at run BTW - I used

Code: Select all
(def panda ()
   (while (not (Console.KeyAvailable))
          (do    (lpose 25 1 rstep)(lpose 25 1 lstep)
         )
   )
)


So 25ms duration / 1frame

Edit: The time count used to check if it needs to test for an event is only set to zero if Playpose bool is true - but you only want this true for the first call so it initialises reading current servo positions. After that use PlayPose false.

Code: Select all
(= ff true) ; global

(def lpose (dur stp pos)
   (if (or pos)
      ( do
         (.PlayPose wck dur stp (toByteArray (car pos)) ff)
         (= ff false)
         ;(prl (car pos))
         (lpose dur stp (cdr pos))
      )
   )
)

(def panda ()
   (= ff true)
   (while (not (Console.KeyAvailable))
          (do    (lpose 25 1 rstep)(lpose 25 1 lstep)
         )
)


This should should work for now - I'll add a specific reset into the library in next drop.

I would think if you change the value 25 to be longer on one stride than the other you may also be able to steer the bot.


Have fun!

PS updated site with new RobobuilderLib - also added Lisp file based on the above (works for me - but remove cv18 function form playpose for your robot configuration (I have hip kit)

http://code.google.com/p/robobuildervc/ ... tions.lisp
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by pepep » Sun Apr 11, 2010 10:51 am

Post by pepep
Sun Apr 11, 2010 10:51 am

Ok, (panda) with triggers works fine now. I try with a timer of 1000, the motion was continue, and more or less 1000 ms (1025 I think by the trace information) it stop a little (less than 0.5") and continue.

.print don't work yet:
Code: Select all
> (.print trg)
Trigger status : On
exception - La cadena de entrada no tiene el formato correcto.
null
>


Thanks!

PS I answer at tour private message shortly.
Ok, (panda) with triggers works fine now. I try with a timer of 1000, the motion was continue, and more or less 1000 ms (1025 I think by the trace information) it stop a little (less than 0.5") and continue.

.print don't work yet:
Code: Select all
> (.print trg)
Trigger status : On
exception - La cadena de entrada no tiene el formato correcto.
null
>


Thanks!

PS I answer at tour private message shortly.
pepep
Savvy Roboteer
Savvy Roboteer
Posts: 38
Joined: Sun Mar 28, 2010 7:14 pm

Post by l3v3rz » Sun Apr 11, 2010 11:33 am

Post by l3v3rz
Sun Apr 11, 2010 11:33 am

Can you check the version number on the lib - its definitely fixed on my version
Code: Select all
> (.version (.GetName (reference "RobobuilderLib")))
1.8.5.0
>    (.print     trg)
Trigger status : Off
Timer          = 250 ms
X= :  :  : Off
Y= :  :
Z= :  :
P=30   : 60   :    : On
S=   :    :    : Off
I=   : Off
null
>


PS - great to hear its work - are you going to post a video :)
Can you check the version number on the lib - its definitely fixed on my version
Code: Select all
> (.version (.GetName (reference "RobobuilderLib")))
1.8.5.0
>    (.print     trg)
Trigger status : Off
Timer          = 250 ms
X= :  :  : Off
Y= :  :
Z= :  :
P=30   : 60   :    : On
S=   :    :    : Off
I=   : Off
null
>


PS - great to hear its work - are you going to post a video :)
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by pepep » Sun Apr 11, 2010 3:57 pm

Post by pepep
Sun Apr 11, 2010 3:57 pm

Again, problems with downloads in Firefox ... I don't know why firefox mantain in cache old versions of files and don't download the new ones ... Well, test and work perfectly!

One question: sometime, my robot disconnect by itself (the blue light down and the green light below turn on), and the only process to reactivate it is turn off and on again.
In this situation, is possible to reactivate the comunication from L# without close and opne the console again, loading all the work until this moment?

Thanks!
Again, problems with downloads in Firefox ... I don't know why firefox mantain in cache old versions of files and don't download the new ones ... Well, test and work perfectly!

One question: sometime, my robot disconnect by itself (the blue light down and the green light below turn on), and the only process to reactivate it is turn off and on again.
In this situation, is possible to reactivate the comunication from L# without close and opne the console again, loading all the work until this moment?

Thanks!
pepep
Savvy Roboteer
Savvy Roboteer
Posts: 38
Joined: Sun Mar 28, 2010 7:14 pm

Post by l3v3rz » Sun Apr 11, 2010 4:07 pm

Post by l3v3rz
Sun Apr 11, 2010 4:07 pm

Great!

You shouldn't need to reactivate - just re-run (run_robobuilder "COMx") and it will reconnect to COMx port. (and print out S/n and version to show it has connected)

Incidentally in zip file the LsharpConsole.exe has been 'hacked'- if it sees boot.lisp in its current directory it will auto load and run. So I have a boot file that pre-loads the core functions:

Code: Select all
(prn "Boot loader")
(load "final.lisp")
(load "wckutils18.lisp")
(load "utilities.lisp")


Save a bit effort every time I start up.
Great!

You shouldn't need to reactivate - just re-run (run_robobuilder "COMx") and it will reconnect to COMx port. (and print out S/n and version to show it has connected)

Incidentally in zip file the LsharpConsole.exe has been 'hacked'- if it sees boot.lisp in its current directory it will auto load and run. So I have a boot file that pre-loads the core functions:

Code: Select all
(prn "Boot loader")
(load "final.lisp")
(load "wckutils18.lisp")
(load "utilities.lisp")


Save a bit effort every time I start up.
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by pepep » Sun Apr 11, 2010 4:41 pm

Post by pepep
Sun Apr 11, 2010 4:41 pm

Definitively, I HATE firefox!! why don't download the last version? Why I need to download with MSIE??? Well ...

Ok, boot.lisp is GREAT! I tried with init.lisp, init.lp, and others possibilities ... Thanks again!

And YES, reload run_robobuilder (renamed to RB3) the console reconnect with the robot; I get and exception message, but reconnect OK.

Cheers!
Definitively, I HATE firefox!! why don't download the last version? Why I need to download with MSIE??? Well ...

Ok, boot.lisp is GREAT! I tried with init.lisp, init.lp, and others possibilities ... Thanks again!

And YES, reload run_robobuilder (renamed to RB3) the console reconnect with the robot; I get and exception message, but reconnect OK.

Cheers!
pepep
Savvy Roboteer
Savvy Roboteer
Posts: 38
Joined: Sun Mar 28, 2010 7:14 pm

Post by l3v3rz » Sun Apr 11, 2010 5:27 pm

Post by l3v3rz
Sun Apr 11, 2010 5:27 pm

Mine doesn't throw an exception - so you might check you have latest final.lisp The key routine is connect - should look like this:

Code: Select all
(def connect (pn)
  "Initialise connection to robobuilder"
  (prn "connecting to " pn)
 
  (if (not (bound 'sport))
     (= sport (new "SerialPort"))
  )
  (if (.Isopen sport)
     (.Close sport)
  )
  (.set_BaudRate sport 115200)
  (.set_PortName sport pn)
  (.set_WriteTimeout sport 500)
  (.set_ReadTimeout  sport 500)
  (= pcr (new "RobobuilderLib.PCremote" sport))
)


I think the exception might be thrown by serial port, Ive added a couple of test to see if it exists and close it if open, in the latest version


PS you can add the line following line to boot.lisp - and you'll see the version each time it boots:

(.version (.GetName (reference "RobobuilderLib")))
Mine doesn't throw an exception - so you might check you have latest final.lisp The key routine is connect - should look like this:

Code: Select all
(def connect (pn)
  "Initialise connection to robobuilder"
  (prn "connecting to " pn)
 
  (if (not (bound 'sport))
     (= sport (new "SerialPort"))
  )
  (if (.Isopen sport)
     (.Close sport)
  )
  (.set_BaudRate sport 115200)
  (.set_PortName sport pn)
  (.set_WriteTimeout sport 500)
  (.set_ReadTimeout  sport 500)
  (= pcr (new "RobobuilderLib.PCremote" sport))
)


I think the exception might be thrown by serial port, Ive added a couple of test to see if it exists and close it if open, in the latest version


PS you can add the line following line to boot.lisp - and you'll see the version each time it boots:

(.version (.GetName (reference "RobobuilderLib")))
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by l3v3rz » Wed Apr 14, 2010 5:24 pm

Post by l3v3rz
Wed Apr 14, 2010 5:24 pm

I have added some extra functionality to the LSharp.NET code to make things a little easier (LSharpConsole.exe/Lsharp.dll) :

1. I've added a try catch finally functionality (try fn catch finally)
Code: Select all
> (def foo (x y)
     (try
         (prn "Ans = " (/ x y))  ; main function
         (prn "caught error")   ; catch
         (prn "done")              ; finally
))
LSharp.Function
> (foo 8 4)
Ans = 2
done
"done"
> (foo 8 0)
caught error
done
"caught error"


2. I've put a trap in to stop recursive functions overflowing and crashing out.

Code: Select all
> (def foo (x) (pr "x"  (foo x)))
LSharp.Function
>> (def foo (x) (pr "x"  (foo x)))
*** redefining foo
LSharp.Function
> (foo 5)
overflow!! -



3. I've added a very simple Trace capability - setting DEBUG cause functions to be traced i.e.

Code: Select all
> (= DEBUG 1)
> (foo 8 4)
trace: (foo 8 4) : (x y)
trace: () :
trace: (/ 8 4) : & xs
trace: return : 2
trace: (prn Ans =  2) : (& xs)
trace: (stdout) :
trace: return : System.IO.TextWriter+SyncTextWriter
Ans = 2
trace: (progn 2) : & xs
trace: return : 2
trace: return : 2
trace: (progn 2) : & xs
trace: return : 2
trace: return : 2
trace: () :
trace: (prn done) : (& xs)
trace: (stdout) :
trace: return : System.IO.TextWriter+SyncTextWriter
done


You can turn trace off by unassigning DEBUG via another new feature - (ubound 'DEBUG).

Also this version supports load of boot.lisp on startup and has support for mono on linux.

Download from usual place: http://robobuildervc.googlecode.com/fil ... derLib.zip

l3v3rz
I have added some extra functionality to the LSharp.NET code to make things a little easier (LSharpConsole.exe/Lsharp.dll) :

1. I've added a try catch finally functionality (try fn catch finally)
Code: Select all
> (def foo (x y)
     (try
         (prn "Ans = " (/ x y))  ; main function
         (prn "caught error")   ; catch
         (prn "done")              ; finally
))
LSharp.Function
> (foo 8 4)
Ans = 2
done
"done"
> (foo 8 0)
caught error
done
"caught error"


2. I've put a trap in to stop recursive functions overflowing and crashing out.

Code: Select all
> (def foo (x) (pr "x"  (foo x)))
LSharp.Function
>> (def foo (x) (pr "x"  (foo x)))
*** redefining foo
LSharp.Function
> (foo 5)
overflow!! -



3. I've added a very simple Trace capability - setting DEBUG cause functions to be traced i.e.

Code: Select all
> (= DEBUG 1)
> (foo 8 4)
trace: (foo 8 4) : (x y)
trace: () :
trace: (/ 8 4) : & xs
trace: return : 2
trace: (prn Ans =  2) : (& xs)
trace: (stdout) :
trace: return : System.IO.TextWriter+SyncTextWriter
Ans = 2
trace: (progn 2) : & xs
trace: return : 2
trace: return : 2
trace: (progn 2) : & xs
trace: return : 2
trace: return : 2
trace: () :
trace: (prn done) : (& xs)
trace: (stdout) :
trace: return : System.IO.TextWriter+SyncTextWriter
done


You can turn trace off by unassigning DEBUG via another new feature - (ubound 'DEBUG).

Also this version supports load of boot.lisp on startup and has support for mono on linux.

Download from usual place: http://robobuildervc.googlecode.com/fil ... derLib.zip

l3v3rz
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

PreviousNext
93 postsPage 4 of 71, 2, 3, 4, 5, 6, 7
93 postsPage 4 of 71, 2, 3, 4, 5, 6, 7