rctoris / jrosbridge Goto Github PK
View Code? Open in Web Editor NEWA Native Java EE rosbridge Client
Home Page: http://robotwebtools.org/
License: Other
A Native Java EE rosbridge Client
Home Page: http://robotwebtools.org/
License: Other
im getting:
[INFO] [rosbridge_websocket]: Client disconnected. 0 clients total.
[INFO] [rosbridge_websocket]: Client connected. 1 clients total.
[ERROR] [rosbridge_websocket]: [Client 1] [id: advertise:/my_publisher:0] advertise: std_msgs/String is not a valid type string
im using exactly the same code from the readme page:
Ros ros = new Ros("localhost");
ros.connect();
Topic echo = new Topic(ros, "/echo", "std_msgs/String");
Message toSend = new Message("{\"data\": \"hello, world!\"}");
echo.publish(toSend);
My Configuration:
ROS: ros-dashing
Client Lib: from Here (im running Client lib on an Android device)
example1: create a add_two_ints service ?
example2:create a add_two_ints client ?
when i use jrosbridge, it occurs a difficult problem to me, i write a node using python which controls robot to take a picture and subscribes a topic, at the same time, i want to write a client using jrosbridge to publish on above topic and get the image through the topic, however i have no idea how to complete such tasks, is there any simple solutions?
Hi,
I would like to send a message sensor_msgs/Range
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;
public interface Range extends org.ros.internal.message.Message {
static final java.lang.String _TYPE = "sensor_msgs/Range";
static final java.lang.String _DEFINITION = "# Single range reading from an active ranger that emits energy and reports\n# one range reading that is valid along an arc at the distance measured. \n# This message is not appropriate for fixed-range obstacle detectors, \n# such as the Sharp GP2D15. This message is also not appropriate for laser \n# scanners. See the LaserScan message if you are working with a laser scanner.\n\nHeader header \t# timestamp in the header is the time the ranger\n\t\t \t# returned the distance reading\n\n# Radiation type enums\n# If you want a value added to this list, send an email to the ros-users list\nuint8 ULTRASOUND=0\nuint8 INFRARED=1\n\nuint8 radiation_type # the type of radiation used by the sensor\n\t\t \t# (sound, IR, etc) [enum]\n\nfloat32 field_of_view # the size of the arc that the distance reading is\n\t\t \t# valid for [rad]\n\t\t \t# the object causing the range reading may have\n\t\t \t# been anywhere within -field_of_view/2 and\n\t\t \t# field_of_view/2 at the measured range. \n # 0 angle corresponds to the x-axis of the sensor.\n\nfloat32 min_range # minimum range value [m]\nfloat32 max_range # maximum range value [m]\n\nfloat32 range # range data [m]\n\t\t \t# (Note: values < range_min or > range_max\n\t\t \t# should be discarded)\n";
static final byte ULTRASOUND = 0;
static final byte INFRARED = 1;
std_msgs.Header getHeader();
void setHeader(std_msgs.Header value);
byte getRadiationType();
void setRadiationType(byte value);
float getFieldOfView();
void setFieldOfView(float value);
float getMinRange();
void setMinRange(float value);
float getMaxRange();
void setMaxRange(float value);
float getRange();
void setRange(float value);
}
http://docs.ros.org/api/sensor_msgs/html/msg/Range.html
I will create the implementation and later, I will send a PR with this message and previous one: sensor_msgs/LaserScan
#21
Many thanks in advance.
Juan Antonio
I'm trying to subscribe and listen to the ROS topic from a maven project using jrosbridge
.
Here's my message handler:
public void handleMessage(Message message)
{
System.out.println(message.toString());
}
I publish messages from ROS side with the 1 kHz rate.
The program crashes with:
[WARNING] thread Thread[Grizzly-kernel(1) SelectorRunner,5,roboy.io.TestVision] was interrupted but is still alive after waiting at least 15000msecs
[WARNING] thread Thread[Grizzly-kernel(1) SelectorRunner,5,roboy.io.TestVision] will linger despite being asked to die via interruption
[WARNING] thread Thread[Grizzly-worker(1),5,roboy.io.TestVision] will linger despite being asked to die via interruption
[WARNING] NOTE: 2 thread(s) did not finish despite being asked to via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=roboy.io.TestVision,maxpri=10]
java.lang.IllegalThreadStateException
at java.lang.ThreadGroup.destroy(ThreadGroup.java:778)
at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:328)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.162 s
[INFO] Finished at: 2017-03-31T23:46:10+02:00
[INFO] Final Memory: 13M/259M
I've tried -Dexec.cleanupDaemonThreads=false
flag for mnv exec:java
but the program never reaches the handleMessage
function then.
Any suggestions how I could fix it?
UPD: I get the same exception even with ROS message sent once
Unfortunately the library does not work with android. I have investigated this issue a bit and noticed that project tyrus v1.2.1 is used. This version uses some classes which are not part of the android-java (core) libraries (for example javax.naming.InitialContext).
Just loading the missing libraries to the android core libraries does not simply work and results in alot of pain with the dalvik compiler.
By using tyrus v1.5 this issue seems to be resolved (https://java.net/jira/browse/TYRUS-256).
Just changing the maven dependency to use the newer tyrus version is not working, too since the api seems to have changed a bit.
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
android如何使用这个库?
I have solved this issue by updating the tyrus websocket client to the latest version (1.13.1). This is caused because of the used version 1.2.1 tyrus websocket library. It doesn't clean the failed open sockets.
Support for actions has recently been added in the rosbridge protocol.
Specifically the following ROS Operations have been added in the ROSBRIDGE_PROTOCOL.md.
It would be great to add support for actions also in the client side.
Hi,
I would like to send a message sensor_msgs/Imu
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;
public interface Imu extends org.ros.internal.message.Message {
static final java.lang.String _TYPE = "sensor_msgs/Imu";
static final java.lang.String _DEFINITION =
"# This is a message to hold data from an IMU (Inertial Measurement Unit)\n#\n
# Accelerations should be in m/s^2 (not in g\'s), and rotational velocity should be in rad/sec\n#\n
# If the covariance of the measurement is known, it should be filled in (if all you know is the \n
# variance of each measurement, e.g. from the datasheet, just put those along the diagonal)\n
# A covariance matrix of all zeros will be interpreted as \"covariance unknown\", and to use the\n
# data a covariance will have to be assumed or gotten from some other source\n#\n
# If you have no estimate for one of the data elements (e.g. your IMU doesn\'t produce an orientation \n
# estimate), please set element 0 of the associated covariance matrix to -1\n
# If you are interpreting this message, please check for a value of -1 in the first element of each \n
# covariance matrix, and disregard the associated estimate.\n\nHeader header\n\ngeometry_msgs/Quaternion orientation\nfloat64[9] orientation_covariance
# Row major about x, y, z axes\n\ngeometry_msgs/Vector3 angular_velocity\nfloat64[9] angular_velocity_covariance
# Row major about x, y, z axes\n\ngeometry_msgs/Vector3 linear_acceleration\nfloat64[9] linear_acceleration_covariance
# Row major x, y z \n";
std_msgs.Header getHeader();
void setHeader(std_msgs.Header value);
geometry_msgs.Quaternion getOrientation();
void setOrientation(geometry_msgs.Quaternion value);
double[] getOrientationCovariance();
void setOrientationCovariance(double[] value);
geometry_msgs.Vector3 getAngularVelocity();
void setAngularVelocity(geometry_msgs.Vector3 value);
double[] getAngularVelocityCovariance();
void setAngularVelocityCovariance(double[] value);
geometry_msgs.Vector3 getLinearAcceleration();
void setLinearAcceleration(geometry_msgs.Vector3 value);
double[] getLinearAccelerationCovariance();
void setLinearAccelerationCovariance(double[] value);
}
I will create the implementation and later, I will send a PR with this message and previous one: sensor_msgs/LaserScan
#21
Many thanks in advance.
Juan Antonio
Does this java client library work with rosbridge ros2 ?
This library seems to be quite old
I use ant to compile the source code of jrosbridge, and get the jar file. Then i compile the code in the "REDAME.md" using the above jar file and there is no errors. However when i run the classes, the follow errors appears, the problems occurs in the method ros.connect(), can anyone tell me the reason and the solution.
[java] Exception in thread "main" java.lang.RuntimeException: Could not find an implementation class.
[java] at javax.websocket.ContainerProvider.getWebSocketContainer(ContainerProvider.java:73)
[java] at edu.wpi.rail.jrosbridge.Ros.connect(Unknown Source)
[java] at DemoJROSB.main(Unknown Source)
[java] Java Result: 1
Hi all,
I am trying to subscribe the map, costmap and tf data from remote platform and republishing on my machine. TF data publishing rate is as same as remote platforms publishing rate untill I started publishing to map and costmap. I am not able to find out the root cause!! But I tried reducing the rate of publishing of costmap and map. Then at some rate, my platforms TF rate is as same as remote platforms rate.
I know My english is bad. But I hope you understand my problem!! Help me!! It is important to me
Thanks in advance
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.