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

DRos's profile - activity

2021-12-27 08:50:46 -0500 received badge  Taxonomist
2020-04-09 02:01:10 -0500 received badge  Famous Question (source)
2019-04-11 06:39:31 -0500 commented question Help fixing error with ROSWeb and rosbridge. 'module' object has no attribute 'get_topics'

Hi I've also just started to experiment with this package and have exactly the same problem. Did you find any solution y

2019-03-14 14:34:30 -0500 received badge  Famous Question (source)
2019-03-14 14:34:30 -0500 received badge  Notable Question (source)
2019-03-14 14:34:30 -0500 received badge  Popular Question (source)
2019-01-21 17:55:37 -0500 received badge  Famous Question (source)
2019-01-21 17:55:37 -0500 received badge  Notable Question (source)
2018-12-11 07:32:41 -0500 received badge  Famous Question (source)
2018-08-24 04:36:54 -0500 commented answer Publish a numpy.array in a UInt8MultiArray in python

Ahh yes, it's carried over from another node. Poor documentation, my bad!

2018-08-24 04:36:33 -0500 received badge  Notable Question (source)
2018-08-24 04:20:34 -0500 edited question Circular Dependency - Matlab Simulink

Circular Dependency Hi all, I'm trying out the Matlab Simulink Robotics Systems Toolbox and I'm getting a circular depe

2018-08-24 04:20:13 -0500 commented answer Publish a numpy.array in a UInt8MultiArray in python

Thanks for this. Using the talker example and numpy_msg(Floats) as a message type worked perfectly. Thank you!

2018-08-24 04:19:21 -0500 marked best answer Publish a numpy.array in a UInt8MultiArray in python

Hi all,

Pretty new to python and ROS. I have a node that subscribes to some data, in the callback it then does some calculations on that data and creates a new np.array. I then want to publish this new array in a UInt8MultiArray with a fixed size so that I can receive it with another node and send it over UDP.

The example below doesn't include the calculations but the output of the code at the moment is

[[  31.41386309  292.95704286    2.44705586]]
<type 'numpy.ndarray'>

I need to send these values with a fixed length over a Uint8MultiArray so that I can pack it and send it over UDP. I've tried multiple ways but can't seem to get it to work. I was wondering if someone can help with some example code or ideas/best ways.

#!/usr/bin/env python

import rospy
from std_msgs.msg import UInt8MultiArray
import struct
import math
import numpy as np


def callback(data):
    #Calculations before to create enu with data from callback.
    enu = **
    print(enu)
    print(type(enu))
    pub_packet.publish(gps_enu)

def lla2enu():
    global gps_enu, pub_packet
    rospy.init_node('lla2enu', anonymous=True)
    rate = rospy.Rate(250) # 10hz
    rospy.Subscriber("packet", UInt8MultiArray, callback)
    pub_packet = rospy.Publisher('gps_enu', UInt8MultiArray, queue_size=10)
    rospy.spin()

if __name__ == '__main__':
    try:
        lla2enu()
    except rospy.ROSInterruptException:
        pass

Any help is much appreciated. Thanks guys.

2018-08-24 04:19:07 -0500 edited question Circular Dependency - Matlab Simulink

Circular Dependency Hi all, I'm trying out the Matlab Simulink Robotics Systems Toolbox and I'm getting a circular depe

2018-08-24 04:19:07 -0500 received badge  Editor (source)
2018-08-24 04:16:40 -0500 asked a question Circular Dependency - Matlab Simulink

Circular Dependency Hi all, I'm trying out the Matlab Simulink Robotics Systems Toolbox and I'm getting a circular depe

2018-08-24 02:25:44 -0500 received badge  Enthusiast
2018-08-24 02:25:44 -0500 received badge  Enthusiast
2018-08-22 07:42:59 -0500 received badge  Popular Question (source)
2018-08-22 07:07:57 -0500 commented question Publish a numpy.array in a UInt8MultiArray in python

Thanks gvdhoorn, I'll take a look at the links you've mentioned below with the numpy support in rospy and the Point/Pose

2018-08-22 05:51:41 -0500 commented question Publish a numpy.array in a UInt8MultiArray in python

These values represent a local x,y,z value in metres.

2018-08-22 05:46:49 -0500 commented question Publish a numpy.array in a UInt8MultiArray in python

Thanks a lot for the replies. What msg type would you recommend for a topic that just wants to publish 3 float values?

2018-08-22 05:44:26 -0500 received badge  Popular Question (source)
2018-08-22 05:36:56 -0500 commented question Publish a numpy.array in a UInt8MultiArray in python

@gvdhoorn, thanks for the reply. Maybe I can manipulate the data inside enu to be of a specific size to guarantee the si

2018-08-22 05:23:39 -0500 edited question Publish a numpy.array in a UInt8MultiArray in python

Publish a numpy.array in a UInt8MultiArray in python Hi all, Pretty new to python and ROS. I have a node that subscribe

2018-08-22 05:19:36 -0500 received badge  Notable Question (source)
2018-08-22 05:19:21 -0500 asked a question Publish a numpy.array in a UInt8MultiArray in python

Publish a numpy.array in a UInt8MultiArray in python Hi all, Pretty new to python and ROS. I have a node that subscribe

2018-07-26 04:52:06 -0500 asked a question Bind a socket to a specific interface for UDP sending

Bind a socket to a specific interface for UDP sending Hi all, I've written a node that sends a datagram to a specific p

2018-07-25 01:58:40 -0500 commented answer Segmentation fault whilst trying to publish PointCloud

Sure, sorry about that. All done.

2018-07-25 01:58:03 -0500 marked best answer Segmentation fault whilst trying to publish PointCloud

Hi all,

I'm trying to publish a PointCloud so that I can visualise it in RViz, however even though my node will compile I get a segmentation fault when I run it.

#include <ros/ros.h>
#include <stdlib.h>
#include <sensor_msgs/PointCloud.h>

int main(int argc, char **argv){
        // Initialise ROS and set up a node
        ros::init(argc, argv, "send_numbers");
        ros::NodeHandle nh;

    //Creates the publisher, and tells it to publish to a topic
ros::Publisher pub = nh.advertise<sensor_msgs::PointCloud>("number", 5);
//initialise random function
srand (time(0));

//Sets the loop to publish at a rate of 1Hz
ros::Rate rate(1);

while(ros::ok()) {
 sensor_msgs::PointCloud msg;
     msg.header.stamp = ros::Time::now();
 msg.header.frame_id = "/map";
 for(unsigned int i  =  0; i < 100; ++i){
 msg.points[i].x = rand() % 10;
     msg.points[i].y = rand() % 10;
 msg.points[i].z = rand() % 2;
     }
 pub.publish(msg);
     rate.sleep();
}
}

This is my gdb output

   Reading symbols from devel/lib/number_output/number_output...done.
(gdb) r
Starting program: /home/dan/catkin_ws/devel/lib/number_output/number_output 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1855700 (LWP 21659)]
[New Thread 0x7fffe9054700 (LWP 21660)]
[

New Thread 0x7ffff1054700 (LWP 21661)]
[New Thread 0x7ffff0853700 (LWP 21666)]

Thread 1 "number_output" received signal SIGSEGV, Segmentation fault.
0x000000000040cdb0 in main (argc=1, argv=0x7fffffffdaa8)
    at /home/dan/catkin_ws/src/number_output/src/send_numbers.cpp:25
25       msg.points[i].x = rand() % 10;
(gdb)

Sorry for the funny format. I'm not sure what happened there. I'm new to ROS so if any help would be appreciated.

Thanks

2018-07-25 01:58:03 -0500 received badge  Scholar (source)
2018-07-24 19:23:58 -0500 received badge  Nice Answer (source)
2018-07-24 13:53:15 -0500 received badge  Popular Question (source)
2018-07-24 09:14:46 -0500 commented answer Segmentation fault whilst trying to publish PointCloud

Thanks for the reply Pete.

2018-07-24 09:07:56 -0500 received badge  Self-Learner (source)
2018-07-24 09:07:56 -0500 received badge  Teacher (source)
2018-07-24 09:06:22 -0500 answered a question Segmentation fault whilst trying to publish PointCloud

I think I worked it out, the msg.points array doesn't have a size allocated before assigning values to it. I had to put

2018-07-24 08:07:07 -0500 asked a question Segmentation fault on PointCloud node

Segmentation fault on PointCloud node Hi all, I'm trying to publish a PointCloud so that I can visualise it in RViz, ho

2018-07-24 08:07:07 -0500 asked a question Segmentation fault whilst trying to publish PointCloud

Segmentation fault whilst trying to publish PointCloud Hi all, I'm trying to publish a PointCloud so that I can visuali