Cannot get PC to see LCM messages sent from Raspberry Pi 4

339 views
Skip to first unread message

Charles

unread,
Jun 19, 2020, 12:21:31 AM6/19/20
to Lightweight Communications and Marshalling
I'm new to LCM and was hoping that someone might be able to point me in the right direction. So far, the best I've been able to do is to send an LCM message and receive it on the same machine but cannot communicate between machines. Wireshark shows no data reaching my PC.

Here is my setup: I have a Raspberry Pi4 running Raspbian. LCM is installed and I have configured the URL by entering in the terminal:
  export LCM_DEFAULT_URL=udpm://239.255.76.67:7667?ttl=2

My Python3 send.py code is the same as the example code with only minor changes (I have put the sending message in a loop that runs once per second):

import lcm
from exlcm import example_t
from time import sleep

msg = example_t()
msg.timestamp = 0
msg.position = (1,2,3)
msg.orientation = (1,0,0,0)
msg.ranges = range(15)
msg.num_ranges = len(msg.ranges)
msg.name = "myMsg"
msg.enabled = True

while True:
lc = lcm.LCM()
lc.publish("myChannel", msg.encode())
sleep(1)

I can send this on the Pi and receive it on the Pi using a receiving script based on the LCM example code.

On the PC end, I was unable to get LCM installed on Windows (because cMake somehow refuses to see glib regardless of which directory I place the glib package in) so I instead installed a Virtual Machine on the PC running Ubuntu.
On the Ubuntu OS, I was able to install LCM and to send and receive messages using the same code as above. However, if I run the sending code on the Pi and the receiving code on the Ubuntu, nothing happens.
Likewise, when I run Wireshark on Windows, I cannot see any incoming data from the Pi. I have tried completely disabling the Windows Firewall, but that didn't make any difference.
I tried cloning the bot-lcm-tunnel because I saw someone in this group recommend that on another thread. However, it refuses to build on my Pi. I also tried to install lcm-spy on my Ubuntu VM, but it
wouldn't play nice with Java, so that tool is not available for troubleshooting.

Any pointers or recommendations? Thanks!
Message has been deleted
Message has been deleted

Charles

unread,
Jun 19, 2020, 11:29:48 AM6/19/20
to Lightweight Communications and Marshalling
Update: Problem resolved. I just had to bridge my VM so that it could read external ports.

ahmed

unread,
Jul 15, 2021, 9:18:29 AM7/15/21
to Lightweight Communications and Marshalling
Hi Charles,
I am also working on a project requiring communications between raspberry pi and a computer and I am having trouble setting the packages up as I have no knowledge to communications but also I am very new to using CMake and ubuntu os which are apparently very important here.so do you have any step-by-step tutorial that can help me or any detailed documentation on setting up the package? 
Thanks in advance
Ahmed

Charles Rumberger

unread,
Jul 17, 2021, 4:00:23 AM7/17/21
to lcm-...@googlegroups.com
Hello Ahmed,

The best tutorial that I remember is from the LCM project page, which you have likely already come across: http://lcm-proj.github.io/index.html
In the end, I did manage to get it to work to communicate between the Raspberry Pi and a virtual machine running Ubuntu on my desktop PC. Unfortunately, I don't remember any details of how I did the build other than following the guide at the LCM project home page. (I never did get it working in Windows, but the virtual machine gave me a way to work around that problem.) I found the following note that I wrote up to remind myself how to set up a new LCM channel, though it doesn't explain how to set up LCM in the first place. If you continue to have trouble, I can try to dig deeper into my notes and see if I wrote anything else down that might be helpful.
Good luck with your project!

(Here's my reminder on setting up the channel:)
''' This document describes how to set up a new lcm channel.'''

1) Create a .lcm file with the following format:

    package exlcm;
    struct example_t
    {
        int64_t  timestamp;
        double   position[3];
        double   orientation[4];
        int32_t  num_ranges;
        int16_t  ranges[num_ranges];
        string   name;
        boolean  enabled;
    }

Save with .lcm extension in the /lcm folder. To reduce confusion, the
file name should match the struct name.
For more info, see: https://lcm-proj.github.io/tut_lcmgen.html

2) Generate Python bindings by opening a Linux terminal in the /lcm
folder and entering the command:

$lcm-gen -p example_t.lcm

-p designates python bindings will be generated. Use the file name
in place of 'example_t.lcm'

3) A python file has now been generated in the lcm/exlcm folder. Unless
this folder has been added to the python script import path, the file will
need to be copied to the location where the python packages are installed.
Substituting the correct directory path, from the Linux terminal enter:

$cp -R lcm/exlcm/example_t.py .local/lib/python3.8/site-packages/exlcm

4) The '__init__.py' file is automatically updated by lcm-gen. This file
will need to be copied to same exlcm folder as the script was copied to
in step 3, replacing the previous version of '__init__.py'.


On Thu, Jul 15, 2021 at 9:18 AM ahmed <a7mady...@gmail.com> wrote:
This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.
--
You received this message because you are subscribed to the Google Groups "Lightweight Communications and Marshalling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lcm-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lcm-users/2d5a2668-80b1-4d4b-acdb-1c963315649dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages