Skip to content

Commit

Permalink
examples, platform: fixup after trig changes
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Klotzbuecher <mk@mkio.de>
  • Loading branch information
kmarkus committed Jan 6, 2020
1 parent 65fef33 commit 3b8320e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 37 deletions.
20 changes: 10 additions & 10 deletions docs/user/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ the libraries
#define WEBIF_PORT "8810"
#define DOUBLE_STR "double"
#include "ptrig_config.h"
#include "trig_spec.h"
#include "ptrig_period.h"
#define LEN_VEC(a) (sizeof(a)/sizeof(a[0]))
int main()
Expand Down Expand Up @@ -662,15 +662,15 @@ trigger block, we have to configure the order of blocks,
len= 3;
ubx_data_resize(d, len);
printf("data size trig blocks: %li\n",d->type->size);
((struct ptrig_config*)d->data)[0].b = plat1;//ubx_block_get(&ni, "plat1")
((struct ptrig_config*)d->data)[0].num_steps = 1;
((struct ptrig_config*)d->data)[0].measure = 0;
((struct ptrig_config*)d->data)[1].b = control1;
((struct ptrig_config*)d->data)[1].num_steps = 1;
((struct ptrig_config*)d->data)[1].measure = 0;
((struct ptrig_config*)d->data)[2].b = logger1;
((struct ptrig_config*)d->data)[2].num_steps = 1;
((struct ptrig_config*)d->data)[2].measure = 0;
((struct trig_spec*)d->data)[0].b = plat1;//ubx_block_get(&ni, "plat1")
((struct trig_spec*)d->data)[0].num_steps = 1;
((struct trig_spec*)d->data)[0].measure = 0;
((struct trig_spec*)d->data)[1].b = control1;
((struct trig_spec*)d->data)[1].num_steps = 1;
((struct trig_spec*)d->data)[1].measure = 0;
((struct trig_spec*)d->data)[2].b = logger1;
((struct trig_spec*)d->data)[2].num_steps = 1;
((struct trig_spec*)d->data)[2].measure = 0;
Port connection
~~~~~~~~~~~~~~~
Expand Down
7 changes: 4 additions & 3 deletions examples/platform/platform_launch/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ubxmoddir = ${UBX_MODDIR}


ACLOCAL_AMFLAGS= -I m4
ubxmod_PROGRAMS = platform_main
platform_main_SOURCES = $(top_srcdir)/libubx/ubx.h main.c
platform_main_CFLAGS = -I${top_srcdir}/libubx @UBX_CFLAGS@
platform_main_SOURCES = main.c
platform_main_CFLAGS = @UBX_CFLAGS@ \
-I${top_srcdir}/../../../std_blocks/trig/types/

platform_main_LDFLAGS = -module -avoid-version -shared -export-dynamic @UBX_LIBS@ -ldl -lpthread
46 changes: 22 additions & 24 deletions examples/platform/platform_launch/main.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <ubx.h>
#include <ubx/trig_utils.h>

#define WEBIF_PORT "8810"
#define DOUBLE_STR "double"
#include "ptrig_config.h"

#include "ptrig_period.h"
#include "signal.h"

#define LEN_VEC(a) sizeof(a)/sizeof(a[0])

int main()
Expand Down Expand Up @@ -87,21 +89,18 @@ int main()
/* logger configuration */
d=ubx_config_get_data(logger1, "filename");
char filename[]="/tmp/platform_time.log";
len = strlen(filename)+1;
ubx_data_resize(d, len);
strncpy((char *)d->data, filename, len);
ubx_data_resize(d, strlen(filename)+1);
strcpy((char *)d->data, filename);

d=ubx_config_get_data(logger1, "report_conf");
char report_conf[]="{{ blockname='plat1', portname='pos'},{ blockname='control1', portname='commanded_vel'}}";
len = strlen(report_conf)+1;
ubx_data_resize(d, len);
strncpy((char *)d->data, report_conf, len);
ubx_data_resize(d, strlen(report_conf)+1);
strcpy((char *)d->data, report_conf);

d=ubx_config_get_data(logger1, "separator");
char separator[]=",";
len = strlen(separator)+1;
ubx_data_resize(d, len);
strncpy((char *)d->data, separator, len);
ubx_data_resize(d, strlen(separator)+1);
strcpy((char *)d->data, separator);

/* ptrig config */
d=ubx_config_get_data(ptrig1, "period");
Expand All @@ -112,27 +111,26 @@ int main()

d=ubx_config_get_data(ptrig1, "sched_policy");
char policy[]="SCHED_OTHER";
len = strlen(policy)+1;
ubx_data_resize(d, len);
strncpy((char *)d->data, policy, len);
ubx_data_resize(d, strlen(policy)+1);
strcpy((char *)d->data, policy);
d=ubx_config_get_data(ptrig1, "sched_priority");
*((int*)d->data)=0;

d=ubx_config_get_data(ptrig1, "trig_blocks");
len= 3;
ubx_data_resize(d, len);
((struct ptrig_config*)d->data)[0].b= plat1;
((struct ubx_trig_spec*)d->data)[0].b= plat1;
/*As alternative: the block can be retieved by name:
*(struct ptrig_config*)d->data)[0].b= ubx_block_get(&ni, "plat1")*/

((struct ptrig_config*)d->data)[0].num_steps = 1;
((struct ptrig_config*)d->data)[0].measure = 0;
((struct ptrig_config*)d->data)[1].b= control1;
((struct ptrig_config*)d->data)[1].num_steps = 1;
((struct ptrig_config*)d->data)[1].measure = 0;
((struct ptrig_config*)d->data)[2].b= logger1;
((struct ptrig_config*)d->data)[2].num_steps = 1;
((struct ptrig_config*)d->data)[2].measure = 0;
*(struct ubx_trig_spec*)d->data)[0].b= ubx_block_get(&ni, "plat1")*/

((struct ubx_trig_spec*)d->data)[0].num_steps = 1;
((struct ubx_trig_spec*)d->data)[0].measure = 0;
((struct ubx_trig_spec*)d->data)[1].b= control1;
((struct ubx_trig_spec*)d->data)[1].num_steps = 1;
((struct ubx_trig_spec*)d->data)[1].measure = 0;
((struct ubx_trig_spec*)d->data)[2].b= logger1;
((struct ubx_trig_spec*)d->data)[2].num_steps = 1;
((struct ubx_trig_spec*)d->data)[2].measure = 0;



Expand Down

0 comments on commit 3b8320e

Please sign in to comment.