Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to publish a message "sensor_msgs/LaserScan"? #21

Open
jabrena opened this issue Jul 13, 2017 · 3 comments
Open

How to publish a message "sensor_msgs/LaserScan"? #21

jabrena opened this issue Jul 13, 2017 · 3 comments

Comments

@jabrena
Copy link

jabrena commented Jul 13, 2017

Hi, I would like to send a message "sensor_msgs/LaserScan" but I don´t see the object in the package:
https://github.com/rctoris/jrosbridge/tree/develop/src/main/java/edu/wpi/rail/jrosbridge/messages
How to solve the problem?

In ROSJava exist this message but here, I didn´t find it:

package sensor_msgs;

import org.ros.internal.message.Message;
import std_msgs.Header;

public interface LaserScan extends Message {
    String _TYPE = "sensor_msgs/LaserScan";
    String _DEFINITION = "# Single scan from a planar laser range-finder\n#\n# If you have another ranging device with different behavior (e.g. a sonar\n# array), please find or create a different message, since applications\n# will make fairly laser-specific assumptions about this data\n\nHeader header            # timestamp in the header is the acquisition time of \n                         # the first ray in the scan.\n                         #\n                         # in frame frame_id, angles are measured around \n                         # the positive Z axis (counterclockwise, if Z is up)\n                         # with zero angle being forward along the x axis\n                         \nfloat32 angle_min        # start angle of the scan [rad]\nfloat32 angle_max        # end angle of the scan [rad]\nfloat32 angle_increment  # angular distance between measurements [rad]\n\nfloat32 time_increment   # time between measurements [seconds] - if your scanner\n                         # is moving, this will be used in interpolating position\n                         # of 3d points\nfloat32 scan_time        # time between scans [seconds]\n\nfloat32 range_min        # minimum range value [m]\nfloat32 range_max        # maximum range value [m]\n\nfloat32[] ranges         # range data [m] (Note: values < range_min or > range_max should be discarded)\nfloat32[] intensities    # intensity data [device-specific units].  If your\n                         # device does not provide intensities, please leave\n                         # the array empty.\n";

    Header getHeader();

    void setHeader(Header var1);

    float getAngleMin();

    void setAngleMin(float var1);

    float getAngleMax();

    void setAngleMax(float var1);

    float getAngleIncrement();

    void setAngleIncrement(float var1);

    float getTimeIncrement();

    void setTimeIncrement(float var1);

    float getScanTime();

    void setScanTime(float var1);

    float getRangeMin();

    void setRangeMin(float var1);

    float getRangeMax();

    void setRangeMax(float var1);

    float[] getRanges();

    void setRanges(float[] var1);

    float[] getIntensities();

    void setIntensities(float[] var1);
}

Many thanks in advance.

Juan Antonio

@rctoris
Copy link
Owner

rctoris commented Jul 13, 2017

This package implements a few example message packages for reference but not all of them. You would need to implement an additional messages that you need or just a generic JSON approach from the Message class itself.

@jabrena
Copy link
Author

jabrena commented Jul 13, 2017

Many thanks @rctoris,

Tomorrow using the idea from ROSJava Interface, I will try to publish a message from a LaserScan

If the POC goes well, do you like a PR?

Cheers

Juan Antonio

@jabrena
Copy link
Author

jabrena commented Jul 16, 2017

Hi @rctoris,

Finally, I could migrate the message to ROSBridge.

Here is the class:
https://github.com/ev3dev-lang-java/ros/blob/develop/src/main/java/edu/wpi/rail/jrosbridge/messages/sensor_msgs/LaserScan.java

Now, I can publish LIDAR data from a RPLidar on ROS using ROSBridge.

Cheers

Juan Antonio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants