nrjl / lcm_to_ros Goto Github PK
View Code? Open in Web Editor NEWAutomatically generate ROS messages and corresponding republishers for LCM messages
Automatically generate ROS messages and corresponding republishers for LCM messages
Hi,
I'm trying to republish an lcm image topic to a rostopic using your lcm_to_ros repo.
But when I use the pipeline, after generating the header files and running the roslaunch file, I get the following error message:
error -1 decoding image_t!!!
Here is the lcm message definition file:
package image_types;
struct image_t
{
int32_t num_channels;
int32_t width;
int32_t height;
double image[num_channels][width][height];
}
Here is the file I'm using to publish the lcm image topic:
# %%
import numpy as np
import lcm
from image_types import image_t
# %%
lc = lcm.LCM()
# %%
msg = image_t()
msg.width = 10
msg.height = 3
msg.num_channels = 3
msg.image = np.random.rand(3, 10, 3).tolist()
# %%
lc = lcm.LCM()
lc.publish("image_topic", msg.encode())
Here is the config file I defined:
# --- Config file for generating ROS/LCM republishers ---
# This file is intended to be used with the rosrepub-gen
# script, which will (for each non-comment line of this
# file) attempt to generate C++ republisher code that
# republishes messages of a specified to to/from a ROS
# topic from/to an LCM topic.
# Each (non-comment) line of the file should contain four
# comma-separated fields:
# topic_name, msg_package, msg_type, direction
# LCM to ROS republisher with normal hash
#example_topic, exlcm, example_type, lcm2ros
# ROS to LCM republisher with overridden hash value
#other_topic, exlcm_rehash, example_type, ros2lcm
# LCM to ros image republisher
image_topic, image_types, image_t, lcm2ros
Should I be doing something with the rehashing? Is there something obvious that I messed up? I would appreciate some guidance.
Here is a link to a zip file of the catkin_ws I am using:
https://drive.google.com/file/d/121cILabY0NERJZgVgLz5OANH4mor7CFj/view?usp=sharing
Hi!
I followed the README using my custom message type mbot_encoder_t
package mbot_lcm_msgs;
struct mbot_encoder_t
{
int64_t utime;
int64_t leftticks;
int64_t rightticks;
int16_t left_delta;
int16_t right_delta;
}
rosmsg-gen.sh
, rosrepub-gen.sh
and catkin build
complete without error, but when I run roslaunch lcm_to_ros mbot_republishers.launch
this error message is printing error -1 decoding mbot_encoder_t!!!
Before any messages are even published to LCM? What is it attempting to decode?
FWIW my config looks like so:
# LCM to ROS republisher with normal hash
MBOT_ENCODERS, mbot_lcm_msgs, mbot_encoder_t, lcm2ros
Any help is much appreciated!
When I tried to run rosmsg-gen.sh
on a Mac, I got the following output:
$ ./rosmsg-gen.sh lcm/*.lcm
Processing LCM message file: lcm/example_type.lcm
Generating CPP message exlcm/example_type.hpp with lcm-gen...done.
Creating ROS message msg/example_type.msg...sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
done.
Creating new header exlcm_rehash/example_type.hpp with overridden hash: 0x0123456789abcdef done.
Processing LCM message file: lcm/simple_channel.lcm
Generating CPP message exlcm/simple_channel.hpp with lcm-gen...done.
Creating ROS message msg/simple_channel.msg...sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
sed: 1: "tmp": undefined label 'mp'
done.
No valid hash value found in lcm/simple_channel.lcm, no rehash methods generated.
The problem is sed -i
on OS X requires a backup file extension after the -i
Thanks for the hard work, this project works just fine.
I was wondering if you plan to add support for unsigned values, I have an example here for republishing messages from ROS to LCM with the VelodynePacket message.
The message is defined as follow:
rosmsg show velodyne_msgs/VelodynePacket
time stamp
uint8[1206] data
Only when I try to recreate this with your package I can get only as far as:
rosmsg show lcm_to_ros/velodyne_packet
time stamp
int8[1206] data
With result in the expected error
[ERROR] [1467982809.956284460]: Client [/lcm_to_ros/velodyne_packets_republisher] wants topic /lcm_to_ros/velodyne_packets to have datatype/md5sum [lcm_to_ros/velodyne_packet/08fc2f480f398e309323b41f1efa2fb9], but our version has [velodyne_msgs/VelodyneScan/50804fc9533a0e579e6322c04ae70566]. Dropping connection.
I could have an intermediate node to cast the data type for each point from unsigned to signed, but it doesn't seem right for the heavy amount of data I get in. Would you have any suggestion on how to solve this?
Hi,
I try to run your package and apparently need some modifications. When I try to compile after both ./rosmsg-gen.sh -a and ./rosrepub-gen.sh repub_configs/example_republishers.cfg, The catkin_make gives me several errors related with the includes (doesn't find any because of the path).
I don't know the best way to fix it but my first approach is:
1.- If the includes are not well linked, you must change the following files:
src/lcm2ros_default_republisher.cpp.in --> Search the line with:
#include "@PACKAGE_NAME@/@[email protected]"
and replace with:
#include "../@PACKAGE_NAME@/@[email protected]"src/lcm_rehash.hpp.in --> Search the line with:
#include "@OLD_PACKAGE_NAME@/@[email protected]"
and replace with:
#include "../@OLD_PACKAGE_NAME@/@[email protected]"src/ros2lcm_default_republisher.cpp.in --> Search the line with:
#include "@PACKAGE_NAME@/@[email protected]"
and replace with:
#include "../@PACKAGE_NAME@/@[email protected]"
And other problem is at the time to generate the ros msgs.
In the republisher doesn't find the autogenerated ros messages:
This error is basically that the catkin_make doesn't generate the messages. In order to allow the catkin_make create the ros messages,
edit the lcm_to_ros/CMakeLists.txt search:################################################
Declare ROS messages, services and actions
################################################
#FILE(GLOB rosMsgFiles RELATIVE "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/msg"
"${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/msg/*.msg")
#FOREACH(rosMsg ${rosMsgFiles})
MESSAGE( STATUS "Processing message file: ${rosMsg}" )
add_message_files( FILES ${rosMsg})
#ENDFOREACH(rosMsg)
#generate_messages(
DEPENDENCIES
std_msgs
#)
Comment all the lines and add the following:
add_message_files(
FILES
example_type.msg
simple_channel.msg
)generate_messages(DEPENDENCIES std_msgs)
All other scripts are good and The work is very nice. I hope we can do some trick in order to create sensor messages like laser and images.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.