Skip to content

Instantly share code, notes, and snippets.

@pestefo
Last active August 29, 2015 14:05
Show Gist options
  • Save pestefo/64236a0b5870046eee9d to your computer and use it in GitHub Desktop.
Save pestefo/64236a0b5870046eee9d to your computer and use it in GitHub Desktop.
Robulab started to learn LRP

#Robulab started to learn LRP

The objective of this tutorial is to be able to create a behaviour for Robulab described using Live Robot Programming.

VIDEO PENDING

#Steps

  1. Follow the instructions to have Robulab working specified in this tutorial.

  2. Open the image you created on the previous step and download the LRP code[1]

     Gofer it
     	smalltalkhubUser: 'jfabry' project: 'LiveRobotProgramming';
     	configuration;
     	loadDevelopment
    
  3. Download the code with the example by executing the following snippet on a workspace:

     GOFER SCRIPT 
    
  4. Let's check everything is ok before launching LRP UI:

    1. You are connected to UBNT network
    2. You started roscore in a terminal.
    3. You have cleaned processes by executing ProcessesCleaner clean (poner link)
    4. You started the driver node for kompai.
  5. Our example needs a PhaROS node subscribed to /kompai2/pose and another node publishing on /command_velocity, to do so you need to create a instance of LrpharosPackage. Due to the live feature of LRP, it needs to have an unique instance of the package (which contains the nodes).

     LrpharosPackage uniqueInstance
    
  6. Open the LRP UI by right-clicking the World and selecting ** Live Robot Programming **. It will open a window like this:

** SCREENSHOT PENDING **

  1. Now, copy&paste the following script into the left pane (You can find it also in LrpharosPackage class>>lrpSimple)

     (var robulab := [LrpharosPackage uniqueInstance])
     (var stop := [0])
     (machine simple
     	(state forward
     		(onentry [robulab value forward: 0.1])
     	)
     	(state stop
     		(onentry [robulab value stop])
     	)
     	(state finish
     		(onentry [robulab value stop])
     	)
     
     	(on forceStop *-> finish t-finish)
     	(event forceStop [stop value = 1])
     
     	(ontime 2000 forward -> stop t-f)
     	(ontime 1000 stop -> forward t-s)
     )
    
  2. Now we are almost close to launch the script. Before that you should be aware to have ways to stop it in an emergency case: have a remote joystick or just switch it off.

  3. To trigger it add the following line at the end of the script:

     (spawn simple forward)
    
  4. An alternatively way to stop the robot using the LRP UI is by setting the stop variable to 1 in the ** Variables: ** pane.

** SCREENSHOT PENDING **

  1. After stopping the robot, if you want to re-start it you have to click * Reset Int. * button in the bottom of the left pane.

NOTES

[1] Roassal font stuff Cada vez que se hace process cleaner se borra el proceso de LRP así que hay cerrar el ui que está abierto. Después de ejecutar kompai hay que resetear el singleton LRP.

@mcamp
Copy link

mcamp commented Aug 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment