(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Using EusLisp (roseus) to control rtmtros robots

Description: This tutorial shows how to use roseus to control robots. This tutorial is basic level so it is not specific to rtmros-common robot, it also covers PR2, Nao, HRP2 users

Tutorial Level: BEGINNER

Next Tutorial: Using Euslisp(roseus) to control robot behavior through perception

Euslisp Setup

Install from deb

  • sudo apt-get install ros-hydro-roseus ros-hydro-roseus-msgs

Trouble shooting in installation (for roseus)

If you have already source of jsk-ros-pkg related packages, please remove or move these directories. For example,

rm -fr ~/ros/hydro/src/jsk-ros-pkg/jsk_roseus ~/ros/hydro/src/jsk-ros-pkg/jsk_pr2eus

Please specify your catkin workspace such as ~/ros/hydro/src including jsk_roseus and jsk_pr2eus repositories.

If you have already built these source repositories, please remove these. For example,

rm -fr ~/ros/hydro/build ~/ros/hydro/devel ~/ros/hydro/install

Trouble shooting in installation (for roseus-msgs)

If you have already roseus msg and srv files in home direcotry, please remove or move these directories. For example,

rm -fr ~/.ros/roseus/hydro

This is roseus msg and srv file directory generated on your PC. Please remove or move this.

hrpsys documentation

To learn more about hrpsys-base RTCs, please see hrpsys package and hrpsys samples.

rtmros_tutorials

Euslisp examples in this page require rtmros_tutorials/hrpsys_ros_bridge_tutorials package. To learn more about rtmros system, please see wiki.ros.org/rtmros_nextage/Tutorials/Programming

For example,

cd ~/ros/hydro/src
wstool set rtm-ros-robotics/rtmros_tutorials https://github.com/start-jsk/rtmros_tutorials.git --git
wstool update rtm-ros-robotics/rtmros_tutorials
cd ..
catkin_make --force-cmake --only-pkg-with-deps hrpsys_ros_bridge_tutorials

Using simulated robots from Euslisp

This example is to explain Euslisp interface for rtmros system.

Launch a simulator that "mimic"s a real robot

The window named as "hrpsys viewer" is hrpsys-simulator, which is a robot simulator based on OpenHRP3 dynamics engine.

$ rtmlaunch hrpsys_ros_bridge samplerobot.launch USE_UNSTABLE_RTC:=true

Running Euslisp process

If you run this command, you can start Euslisp interpreter process:

$ roseus `rospack find hrpsys_ros_bridge`/euslisp/samplerobot-interface.l

Create instance for Euslisp-ROS interface

  • If you execute this function on Euslisp command-line, you can inititalize Euslisp robot instance and Euslisp-ROS interface:
    irteusgl$ (samplerobot-init)
    irteusgl$ (objects (list *sr*))
    On Euslisp process,
    *sr*
    is a robot model instance for Euslisp, which is shown on Euslisp "IRT Viewer", and
    *ri*
    is a robot interface, which is interface for ROS robot system (rtm-ros-robot-interface class in Euslisp). Users can access simulated robots or real robots through *ri*.

Move robot joint angles on simulation

  • If you execute this command, joint angles of *sr* is changed and results of *sr* is displayed on "IRT Viewer":
    irteusgl$ (send *sr* :reset-pose)
    irteusgl$ (send *irtviewer* :draw-objects)
    At this moment, a simulated robot do not move. If you want to reflect joint angles on Euslisp to the simulated robot, please execute this command:
    irteusgl$ (send *ri* :angle-vector (send *sr* :angle-vector) 2000)

Access basic sensor values

  • Sensor values or controller commands are stored to *ri* by using :state method:
    irteusgl$ (send *ri* :state)
    In this method, spinOnce is called and subscribe topics related with sensor values or controller commands. After :state command execution, you can access these values from *ri*
  • Actual joint angles, which is correspond to /joint_states/position in ROS system.
    irteusgl$ (send *ri* :potentio-vector)
  • Actual force and moment value, which is correspond to /rhsensor, /lfsensor, and so on. These values can be obtained in the case of robots which has force sensors.
    ;; All values are sensor frame local.
    irteusgl$ (send *ri* :off-force-vector) ;; force-vector for all sensors
    irteusgl$ (send *ri* :off-force-vector :rleg) ;; force-vector for right leg (:rleg)
    irteusgl$ (send *ri* :off-moment-vector) ;; moment-vector for all sensors

This simulation example is Euslisp wrapper for hrpsys-base such as SampleRobot examples. start-jsk/hrpsys/samples is another examples for hrpsys-base. This examples are to use hrpsys-base python samples from roslaunch and rosrun.

See hrpsys_ros_bridge README page.

Wiki: rtmros_common/Tutorials/WorkingWithEusLisp (last edited 2017-04-28 01:38:44 by ShunichiNozawa)