#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.
#Steps
-
Follow the instructions to have Robulab working specified in this tutorial.
-
Open the image you created on the previous step and download the LRP code[1]
Gofer it smalltalkhubUser: 'jfabry' project: 'LiveRobotProgramming'; configuration; loadDevelopment
-
Download the code with the example by executing the following snippet on a workspace:
GOFER SCRIPT
-
Let's check everything is ok before launching LRP UI:
- You are connected to UBNT network
- You started
roscore
in a terminal. - You have cleaned processes by executing
ProcessesCleaner clean
(poner link) - You started the driver node for kompai.
-
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 ofLrpharosPackage
. Due to the live feature of LRP, it needs to have an unique instance of the package (which contains the nodes).LrpharosPackage uniqueInstance
-
Open the LRP UI by right-clicking the World and selecting ** Live Robot Programming **. It will open a window like this:
** SCREENSHOT PENDING **
-
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) )
-
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.
-
To trigger it add the following line at the end of the script:
(spawn simple forward)
-
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 **
- 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.
[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.
video
https://www.youtube.com/watch?v=_JBJyUvmzzc&feature=youtu.be