Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Last active December 14, 2015 12:09
Show Gist options
  • Select an option

  • Save PierrickKoch/5084605 to your computer and use it in GitHub Desktop.

Select an option

Save PierrickKoch/5084605 to your computer and use it in GitHub Desktop.
my install genom3
#
# http://robotpkg.openrobots.org/install.html
# http://robotpkg.openrobots.org/robotpkg-wip.html
#
# I use ${HOME} as root of both `robotpkg` and `openrobots`
# I already installed ROS Fuerte from .deb's in `/opt/ros/fuerte`
# and `source /opt/ros/fuerte/setup.bash` in my ~/.bashrc
#
# stuff robotpkg told me to install
sudo apt-get install libxp-dev libmotif-dev libxerces-c-dev openjdk-6-jdk
cd ${HOME}
git clone git://git.openrobots.org/robots/robotpkg
cd robotpkg
git clone git://git.openrobots.org/robots/robotpkg-wip wip
cd bootstrap
./bootstrap --prefix=${HOME}/openrobots
# append Genom3 ROS configuration in robotpkg.conf
cat >> ${HOME}/robotpkg/bootstrap/robotpkg.conf << EOF
#### Genom3 ROS install patch
# use these lines only if ros is installed on your system
PREFER.ros = system
SYSTEM_PREFIX= /usr /opt/ros/fuerte
# end
PKGSET.bundle-genom3-tcl = wip/genomix wip/tcl-genomix shell/eltclsh
PKGSET_DESCR.bundle-genom3-tcl = "install all genom3 tcl"
PKGSET.bundle-genom3-oprs = supervision/openprs wip/transgen3 wip/genom3-openprs
PKGSET_DESCR.bundle-genom3-oprs = "install all genom3 oprs"
PKGSET.bundle-all-genom3 = wip/genom3-pocolibs wip/genom3-ros ${PKGSET.bundle-genom3-tcl} ${PKGSET.bundle-genom3-oprs}
PKGSET_DESCR.bundle-all-genom3 = "install all genom3 (ros and pocolibs)"
#### end Genom3 install patch
EOF
cd ${HOME}/robotpkg
make update-bundle-all-genom3
# append robotpkg setup in ~/.bashrc
cat >> ${HOME}/.bashrc << EOF
#### robotpkg setup
export PATH=$PATH:$HOME/openrobots/sbin:$HOME/openrobots/bin
export ROBOTPKG_BASE=$HOME/openrobots
export PKG_CONFIG_PATH=$HOME/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH
export PYTHONPATH=$PYTHONPATH:$HOME/openrobots/lib/python2.7/site-packages
#### end robotpkg setup
EOF
#
exit 0
#
# 1st demo
#
mkdir ~/genom_demo && cd ~/genom_demo/
cat > calc.gen << EOF
/* calculator */
component calc {
function add(in double a, in double b, out double c) {
codel doadd(in a, in b, out c);
};
};
EOF
genom3 -n calc.gen
genom3 -l
genom3 skeleton calc.gen
cd codels
# (!)
# TODO in calc_codels.c :
# replace "/* skeleton sample: insert your code */"
# by "*c = *a + *b;"
# (!)
# make main
cd ~/genom_demo/
autoreconf -vi
mkdir build && cd build/
../configure --prefix=$HOME/openrobots
make install
# make server
cd ~/genom_demo/
mkdir build-ros && cd build-ros/
genom3 ros/server ../calc.gen
cd ros
autoreconf -vi
./configure --prefix=$HOME/openrobots
make install
# make client
cd ~/genom_demo/
mkdir build-client && cd build-client/
genom3 ros/client/ros ../calc.gen
cd ros/client/ros/
autoreconf -vi
./configure --prefix=$HOME/openrobots
make install
# test
roscore & rospid=$!
sleep 2 # wait for roscore to init
~/genom_demo/build-ros/ros/calc-ros -b
rosservice call calc/add 1 2
kill $rospid
pkill calc-ros
# voila!
#
package require genomix
::genomix::connect localhost
genomix1 load calc
::calc::fibonacci {n 5}
::calc::fibo
::calc::fibonacci {n 6} &
::calc::fibo
::calc::fibonacci {n 7} &
::calc::fibo
package require genomix
::genomix::connect
genomix1 load mobileloco
::mobileloco::GotoPosition {goto_position {x 100 y -50}} &
::mobileloco::E_current_position
::mobileloco::E_current_position
::mobileloco::E_current_position
package require genomix
::genomix::connect
genomix1 load mobileloco
genomix1 load mobiledisp
::mobiledisp::connect_port E_current_position mobileloco/E_current_position
::mobileloco::GotoPosition {goto_position {x 50 y 50}} &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment