Updated:

This page contains notes from my various tests and experiments. It is a raw record of what I did, without correction for errors, or later update for things that I learn. Use at your own risk.

Jetbot ROS2 #2: Use jetbot locally

I have the camera working locally. Now I want to get the existing work (that had been done in Docker) working locally.

Dependencies

I have not been following ROS2 practices for dependencies. Can I start to do that?

I have both pip and apt dependencies. How to express those? Somewhere I recall a list of possible supported dependencies. Where was that? https://github.com/ros/rosdistro/blob/master/rosdep/base.yaml

2022-03-10

I had to split non-ROS2 dependencies into a separate install script.

PanTilt now works. googleTTS runs but produces not sound. I need to configure audio in this new OS instance.

It was simple, just adding asound.conf seemed to do it.

2022-03-28

I put BDBD back together, now sound playback is not working. The basic test is this:

aplay /usr/share/sounds/alsa/Front_Center.wav

That runs, but no sound comes out. This may be a permission problem, because this works:

sudo aplay /usr/share/sounds/alsa/Front_Center.wav

though it also complains about ‘Home directory not accessible: Permission denied’


but it I do ```su``` followed by the command, still works but bo error. So it seems to be a permission problem.


Looking at seeedstudio webpage I got a hint of how to specify devices. With that hint, this works:

```bash
 aplay -D plughw:2,0 /usr/share/sounds/alsa/Front_Center.wav

meaning that it may not be a permission issue, but a config issue.

With -v I get more details:

 kent@nano:/etc/udev/rules.d $ aplay -v /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 24000
  period_size  : 6000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : GETTIMEOFDAY
  period_step  : 1
  avail_min    : 6000
  period_event : 0
  start_threshold  : 24000
  stop_threshold   : 24000
  silence_threshold: 0
  silence_size : 0
  boundary     : 6755399441055744000

for the non-working. For the working,

 kent@nano:/etc/udev/rules.d $ aplay -v -D plughw:2,0 /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Plug PCM: Rate conversion PCM (16000, sformat=S16_LE)
Converter: libspeex (external)
Protocol version: 10002
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 24000
  period_size  : 6000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 6000
  period_event : 0
  start_threshold  : 24000
  stop_threshold   : 24000
  silence_threshold: 0
  silence_size : 0
  boundary     : 6755399441055744000
Slave: Route conversion PCM (sformat=S24_3LE)
  Transformation table:
    0 <- 0
    1 <- 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 16000
  exact rate   : 16000 (16000/1)
  msbits       : 16
  buffer_size  : 8000
  period_size  : 2000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2000
  period_event : 0
  start_threshold  : 8000
  stop_threshold   : 8000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
Slave: Hardware PCM card 2 'ReSpeaker 4 Mic Array (UAC1.0)' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S24_3LE
  subformat    : STD
  channels     : 2
  rate         : 16000
  exact rate   : 16000 (16000/1)
  msbits       : 24
  buffer_size  : 8000
  period_size  : 2000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2000
  period_event : 0
  start_threshold  : 8000
  stop_threshold   : 8000
  silence_threshold: 0
  silence_size : 0
  boundary     : 9007199254740992000
  appl_ptr     : 0
  hw_ptr       : 0

So somehow I am using pulse audio, and that is not working.

I restarted nano, checked:

systemctl --user status pulseaudio

and it is not running. If I start it, then aplay works.

I did:

systemctl --user enable pulseaudio

and rebooted. pulseaudio is now restarted - but sound is not working.

I found info on how to set default device for pulseaudio. So I created a file /home/kent/.config/pulse with this content:

.include /etc/pulse/default.pa
set-default-sink alsa_output.usb-SEEED_ReSpeaker_4_Mic_Array__UAC1.0_-00.analog-stereo

After systemctl --user restart pulseaudio then speaker-test worked. I’m going to try with a cold boot. … Worked.

But what does not work now is arecord. I need to do the same thing there.

2022-03-29

pacmd list-sources

4 source(s) available.
    index: 0
	name: <alsa_output.usb-SEEED_ReSpeaker_4_Mic_Array__UAC1.0_-00.analog-stereo.monitor>
...

so I assume I need:

set-default-source alsa_output.usb-SEEED_ReSpeaker_4_Mic_Array__UAC1.0_-00.analog-stereo.monitor

Added this to /home/kent/.config/pulse/default.pa, did systemctl --user restart pulseaudio then ~/github/rkent/bdbd2_jl_ws/src/bdbd2/bdbd2_jetbot/scripts/atest.sh Did not work.

I can make the recording work using arecord -v -D plughw:2,0 -d 5 -f s32_LE -r 16000 /tmp/test.wav so the issue is specifying the default.

I also tried in default.pa “set-default-source alsa_output.usb-SEEED_ReSpeaker_4Mic_Array__UAC1.0-00.analog-stereo.monitoralsa_input.usb-SEEED_ReSpeaker_4Mic_Array__UAC1.0-00.multichannel-input” but that also did not work.

Before I give up, I’m going to install the old OS and see how it works. Previous reinstall (bdbd2) speaker-test did not work, and atest.sh did not exist.

Summary of sound setup:

1) Make sure pulseaudio starts 2) Configure default pulseaudio source

In bdbd, we use aplay to default device for playback. Recording searches for the device, so default arecord is not needed. I can’t get arecord to work, so I deleted its test from atest.sh