ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Wes G's profile - activity

2021-10-31 18:37:30 -0500 marked best answer Rosserial deserialization error when receiving Serial2

I'm very close to getting my robot project working the way I had hope. A summary of the structure is that I have a Raspberry Pi 2 connected to 2 Arduino MEGAs: 1 for motor control and sensor connectivity and another for interfacing with an NMEA0183 marine sensor. I have been able to receive serial data from the sensor separately but when I connect to ROS and rosserial, I get the following error:

Traceback (most recent call last): File "/opt/ros/melodic/lib/rosserial_python/serial_node.py", line 89, in <module> client.run()

File "/opt/ros/melodic/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 540, in run self.callbackstopic_id

File "/opt/ros/melodic/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 111, in handlePacket m.deserialize(data)

File "/home/ubuntu/ros_ws/devel/lib/python2.7/dist-packages/floatbot_msgs/msg/_Float64Stamped.py", line 110, in deserialize genpy.message.DeserializationError: unpack requires a string argument of length 4

[depth_serial_node-3] process has died [pid 4523, exit code 1, cmd /opt/ros/melodic/lib/rosserial_python/serial_node.py __name:=depth_serial_node __log:=/home/ubuntu/.ros/log/2770e2da-3a91-11ec-9518-0f4138ab90b7/depth_serial_node-3.log]. log file: /home/ubuntu/.ros/log/2770e2da-3a91-11ec-9518-0f4138ab90b7/depth_serial_node-3*.log

Here is the loop() function of my Arduino code:

void loop() {
     nh.spinOnce();

    if (isConnected && !nh.connected()) {
    relayOutput(false);
    } else if (nh.connected()) {
    t.update();

    if (Serial2.available()) {
        parser << Serial2.read();
    }
   }
   isConnected = nh.connected();
}

When I remove the parser section (that is read from Serial2), I don't get a crash but of course that means my data is no longer read. The Float64Stamped is a custom message type.

2021-10-31 18:37:27 -0500 answered a question Rosserial deserialization error when receiving Serial2

As usual after spending time working on this and writing a question, I was able to find the right answer and get it work

2021-10-31 18:37:27 -0500 received badge  Rapid Responder (source)
2021-10-31 17:17:06 -0500 asked a question Rosserial deserialization error when receiving Serial2

Rosserial deserialization error when receiving Serial2 I'm very close to getting my robot project working the way I had

2021-06-07 04:39:36 -0500 received badge  Nice Answer (source)
2021-05-27 23:30:54 -0500 received badge  Teacher (source)
2021-05-27 20:42:30 -0500 answered a question ROS 1 on Ubuntu server 18.04.

I am running ROS1 on a Raspberry Pi 2 (ARM chip) with Ubuntu 18.04 and it has worked out quite well. If you're able to i

2021-05-27 20:42:30 -0500 received badge  Rapid Responder (source)
2021-05-27 19:26:14 -0500 received badge  Popular Question (source)
2021-05-15 20:59:49 -0500 asked a question Rosserial arduino CMake unable to link libraries

Rosserial arduino CMake unable to link libraries I've had an extremely difficult time compiling my Arduino code using CM

2018-03-07 22:03:16 -0500 received badge  Famous Question (source)
2018-02-06 13:05:50 -0500 commented answer How to write a node in iOS?

Hey that's interesting, thanks for pointing those out. I'll have to see what it can do a little later.

2018-02-06 12:47:37 -0500 answered a question How to write a node in iOS?

Hello! This might be an older question but since the previous answer references the library I wrote (RBSManager) I thoug

2016-06-03 00:29:31 -0500 received badge  Famous Question (source)
2016-05-05 08:22:44 -0500 received badge  Famous Question (source)
2015-11-19 10:08:04 -0500 received badge  Famous Question (source)
2015-11-19 10:08:04 -0500 received badge  Notable Question (source)
2015-10-03 06:26:30 -0500 received badge  Famous Question (source)
2015-06-22 01:28:25 -0500 marked best answer Rosserial make_libraries missing custom message

I'm getting into ROS and rosserial for my robot, which will use an Arduino for low level processing. Creating a custom message is important, but so far I've hit a roadblock in which rosserial cannot generate the header file for my custom message.

I've been following the tutorials to create and build .msg files and after it all, rosmsg can find and display my messages correctly. However if I run make_libraries, only the standard messages from ROS are installed.

~/ros_workspace$ rosrun rosserial_arduino make_libraries.py ~/sketchbook/libraries

Exporting to ~/sketchbook/libraries
[my_project]: Not found
...

The end result only says messages could not be generated for map_msgs, and does not include my package. I suspect I'm missing a source command somewhere, but my familiarity with ROS prevents me from knowing when and which folder to run it. Any help greatly appreciated!

2015-04-18 15:07:55 -0500 received badge  Notable Question (source)
2015-03-16 08:14:39 -0500 commented answer devel/setup.bash not setting path to src

I ended up resetting my WS into a fresh one, so I suspect this problem is just an artifact of my environment. In the end I learned a lot more about dependencies so I guess it was a win?

2015-03-16 08:13:02 -0500 received badge  Notable Question (source)
2015-03-15 16:02:44 -0500 received badge  Popular Question (source)
2015-03-15 12:18:50 -0500 commented question devel/setup.bash not setting path to src

Updated the question as requested. That was just after sourcing /opt/ros/indigo/setup.bash and /devel/setup.bash so I find it weird that both /install and /devel are being listed on the package path

2015-03-14 18:58:08 -0500 asked a question devel/setup.bash not setting path to src

My rosserial project is progressing but I've hit a problem where sourcing ~/ros_ws/devel/setup.bash doesn't seem to change the path correctly. The symptom of this is that rospack list shows my custom packages using the path ~/ros_ws/install/share/custom_package and when running catkin_make, my custom messages are ignored because the packages can't be found (for building rosserial messages). I've tried clearing the workspace by sourcing /opt/ros/indigo/share but even when sourcing /devel after that, the paths are shown as /install.

I don't really get why it might not be sourcing the path correctly.

EDIT: posted variables as requested

declare -x ROSLISP_PACKAGE_DIRECTORIES="/home/human/ros_ws/devel/share/common-lisp" 
declare -x ROS_DISTRO="indigo"
declare -x ROS_ETC_DIR="/opt/ros/indigo/etc/ros" 
declare -x ROS_IP="192.168.0.148" 
declare -x ROS_MASTER_URI="http://192.168.0.148:11311/" 
declare -x ROS_PACKAGE_PATH="/home/human/ros_ws/install/share:/home/human/ros_ws/install/stacks:/home/human/ros_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks" 
declare -x ROS_ROOT="/opt/ros/indigo/share/ros" 
declare -x ROS_TEST_RESULTS_DIR="/home/human/ros_ws/build/test_results"
2015-03-11 12:54:19 -0500 received badge  Notable Question (source)
2015-03-11 08:06:55 -0500 answered a question catkin rosserial_arduino not generating custom package messages

Answers and comments here pointed me in the correct direction, which turned out to be sourcing my workspace correctly. I cleared the /devel and /build folders, then ran source <ws>/install/setup.bash and catkin_make. No custom message errors were reported. I updated my firmware code, compiled and uploaded and now I'm in business.

2015-03-10 20:01:04 -0500 commented answer Using inotools to upload to Arduino

Marking this question the answer, because it directed me to the catkin wormhole. After a day though, it's working!

2015-03-10 20:00:24 -0500 received badge  Scholar (source)
2015-03-10 16:55:28 -0500 commented answer catkin rosserial_arduino not generating custom package messages

I suspected it was related to sourcing, so after finding this answer I sourced /install/setup.bash and that first problem seems to be solved. Now to import 3rd party Arduino libs

2015-03-10 16:52:30 -0500 received badge  Supporter (source)
2015-03-10 09:24:02 -0500 received badge  Popular Question (source)
2015-03-10 08:45:37 -0500 commented answer catkin rosserial_arduino not generating custom package messages

I tried that, but unfortunately it didn't help. I think you might be right about an internal shell, but I don't know how to source inside that one.

2015-03-10 08:44:16 -0500 received badge  Enthusiast
2015-03-09 22:26:28 -0500 asked a question catkin rosserial_arduino not generating custom package messages

I've made good progress with building my Arduino projects with CMake, but have hit a snag. My project uses custom messages in a separate package, and using make_libraries.py separately, everything works as expected. Cleaning the workspace and running catkin_make verbose=1 robot_arduino_firmware_sensors where robot_arduino is my arduino package and firmware_sensors is my c++ path (firmware/sensors.cpp). I can see the make_libraries script running, with the Arduino messages generated, except at the bottom is failed to generate libraries for the following packages: robot_msgs. That of course means that compiling my Arduino firmware fails.

Most information seems to say I should source indigo's setup.bash, which works when using make_libraries.py separately but I can't seem to include that in the catkin script. Seeing as it works correctly when separate, I suspect that may be the only issue. Anyone have a suggestion?

2015-03-09 07:22:04 -0500 commented answer Using inotools to upload to Arduino

That's great, I'll have to look into that more.

2015-03-09 07:20:49 -0500 received badge  Popular Question (source)
2015-03-08 21:30:35 -0500 asked a question Using inotools to upload to Arduino

My robot project uses a headless Ubuntu install for ROS, with a networked Ubuntu VM for doing GUI ROS tasks, and I'd like to be able to edit and upload Arduino firmware from SSH directly.

I managed to get ino installed to do Arduino compiling but it stalls repeatedly because it can't find ros.h. Has anyone successfully uploaded rosserial firmware with ino or any other command line utility? I've coped the ros_libs folder into the ino workspace lib folder but that doesn't help.

2015-01-22 01:30:08 -0500 received badge  Student (source)
2014-12-04 14:12:30 -0500 received badge  Popular Question (source)
2014-11-24 17:56:07 -0500 answered a question rosserial_arduino avoid lost messages

I'm going through something similar with my project. I suggest upping the baud rate (this answer explains how to do that), making sure you aren't sending or receiving too much data and limit the publishing rate to the minimum. I'm exploring the limits of the Arduino MEGA with my current system and with the different encoders, sensors and motor outputs, I may have to move to a second Arduino in the future.

2014-11-20 21:32:08 -0500 asked a question rosserial_arduino failed to create service server

I'm filling out functionality of my Arduino controller and want to make an empty service for updating parameters. I'm mimicking the ros_lib examples but whenever I launch the serial node I get a message about "Creation of service server failed: 'NoneType' object has no attribute srv".

There are other questions here that are somewhat similar but nothing recent. I'm using rosserial 0.6 with ROS Indigo so from what I can tell rosserial supports services but I've yet to make it work. I've looked at the python code for serial_node but it's a little difficult to tell where the "srv" error comes from.

Server callback function

void paramUpdateCallback(const Empty::Request & request, Empty::Response & response) { ... }

Server definition

ros::ServiceServer<Empty::Request, Empty::Response> parameterUpdate("/arduino/updateparams", &paramUpdateCallback);

ROS init

nh.advertiseService(parameterUpdate);
2014-11-18 23:38:33 -0500 received badge  Notable Question (source)
2014-09-09 23:26:51 -0500 received badge  Popular Question (source)
2014-09-09 08:03:24 -0500 commented question Max frequency to look up parameters

On the page about the parameter server, it says "Cached parameters are a significant speed increase (after the first call), but should be used sparingly to avoid overloading the master." I'm not sure why it overloads, though

2014-06-05 23:34:15 -0500 received badge  Famous Question (source)