Commit b03d89c8 authored by Tommy Olofsson's avatar Tommy Olofsson
Browse files

Values translated and encoded.

parent 812e3c34
......@@ -11,3 +11,5 @@ cmake_install.cmake
devel/
gtest/
srv_gen/
src/signals.py
*.pyc
......@@ -28,3 +28,13 @@ rosbuild_gensrv()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
# set_source_files_properties(src/signals.py PROPERTIES GENERATED true)
# add_custom_command(
# OUTPUT src/signals.py
# DEPENDS lc/signals.py
# COMMAND java -jar /home/tommy/src/labcomm/compiler/labComm.jar --python=src/signals.py lc/signals.lc
# )
# add_custom_target(do_always ALL COMMAND src/signals.py)
execute_process(COMMAND java -jar /home/tommy/src/labcomm/compiler/labComm.jar --python=src/signals.py lc/signals.lc)
sample struct {
int aua_id;
struct {
struct {
double x;
double y;
double z;
} position;
struct {
double x;
double y;
double z;
double w;
} orientation;
} pose;
} start;
......@@ -5,14 +5,20 @@ import rospy
from optparse import OptionParser
import sys
from ros_extctrl.srv import ExtCtrlStart
import labcomm
import signals
class OrcaBridge(object):
def __init__(self, address, port):
# ORCA setup
# TODO: Talk to Mahdi about the simulik signals to use.
#self._orca_conn = orca.connection(address, port)
#self._orca_enc_start = self.orca_conn.open_input(['some_sample'])
#self._orca_enc_start = self.orca_conn.open_input(['start'])
# Dummy setup
self._orca_enc_start = labcomm.Encoder(
labcomm.StreamWriter(open('enc.lcbin', 'w')), 'LabComm2006')
self._orca_enc_start.add_decl(signals.start.signature)
# ROS setup
# Wrapper to use member funcion as service callback.
......@@ -22,9 +28,18 @@ class OrcaBridge(object):
ExtCtrlStart, cb)
def _orca_start(self, req):
# TODO: Init. labcomm type and send to simulink.
# self._orca_enc_start.encode(lc_data, lc_type)
print(req)
st = signals.start()
st.aua_id = req.aua_id;
st.pose = {
'position': {'x': req.pose.pose.position.x,
'y': req.pose.pose.position.y,
'z': req.pose.pose.position.z},
'orientation': {'x': req.pose.pose.orientation.x,
'y': req.pose.pose.orientation.y,
'z': req.pose.pose.orientation.z,
'w': req.pose.pose.orientation.w}
}
self._orca_enc_start.encode(st, signals.start.signature)
return req.aua_id
def run(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment