Gr_unpacked_to_packed_bb, modulation

Hi list,

I’m currently working on increasing my modulation from BPSK to (at
first) QPSK using the c++ api.
I have come across something I can’t really figure out by myself.

According to the api, gr_make_unpacked_to_packed_bb followed by
gr_chunks_to_symbols_bc should take care
of mapping bits to symbols.

Say I have a bit- vector source generating pseudo random bits, which is
connected to a
gr_unpacked_to_packed_bb. If I want to have 2 relevant bits “coming out”
of that
block, my best guess would be to set the parameter “unsigned int
bits_per_chunk = 2”
and then create a “gr_chunks_to_symbols_bc” with a symbol- table- std-
containing my (for now) four signal- points, and setting the dimension
parameter to 2.

Is this the intended way to do this? In any case, the only way I can get
the code to not get a runtime error from the
chunk_to_symbol_bc- block is to set “bits_per_chunk = 8” and
“dimension=2” which produces “packed bytes” in the range [0:1] and two
symbols per bit.
Quite the opposite of what I’m trying to do… To counter this I wrote a
block “pack_k_bits_bb”, which packs the lsb from k consecutive bytes
into one out- byte ( k <= 8 ).

I guess my question is how other people solved this same problem, I
can’t be the first one trying to use higher order modulations…

Anyone having any thoughts or suggestions, I’d be very happy to hear

Relevant code, without my custom block, below:

unsigned int bits_per_chunk = 8;
gr_endianness_t endianness = GR_MSB_FIRST;
d_packer = gr_make_unpacked_to_packed_bb(bits_per_chunk, endianness);

float t= sqrt(2)/2;

gr_complex c[] = {
gr_complex(-t, t), gr_complex(t, t),
gr_complex(-t,-t), gr_complex(t,-t)

d_mapper = gr_make_chunks_to_symbols_bc(d_constellation,2);