Call Ros service java error

3 views (last 30 days)
sarra elghali
sarra elghali on 12 Mar 2018
Commented: sarra elghali on 14 Mar 2018
Hi, I'm trying to communicate between ros core installed in ubuntu and ros matlab installed in windows 10. runing rossvcclient, I get a java error , unless I can see the service name when I tape rosservice list. I had already generate custom message form my workspace.
  2 Comments
MathWorks Robotics and Autonomous Systems Team
Are you saying the comment:
>> rosservice list
Throws Java error if there is no rosservice present?
Can you give details using "code" and also "exact error" messages?
sarra elghali
sarra elghali on 14 Mar 2018
Hey, I think it's connexion network problem, i Tried to follow those steps that I found here https://fr.mathworks.com/matlabcentral/answers/196911-use-matlab-robotics-system-toolbox-to-receive-ros-message
I got the same problem here my steps : 1. I edited file C:\Windows\system32\drivers\etc\hosts and on Ubuntu /etc/hosts by adding : 92.168.65.82 UBUNTUPCIP 192.168.65.80 WINDOWSPCIP 2. I turned off all the firewalls on Window PC and Ubuntu PC 3. I have set environment variables on Ubuntu PC export ROS_MASTER_URI=http://UbuntuPCIP:11311 export ROS_IP=UbuntuPCIP 3. I tried to ping both windows and Ubutnu as said here http://wiki.ros.org/ROS/NetworkSetup # on matlab window command !ping 192.168.65.82
Pinging 192.168.65.82 with 32 bytes of data: Reply from 192.168.65.82: bytes=32 time=6ms TTL=64 Reply from 192.168.65.82: bytes=32 time=4ms TTL=64 Reply from 192.168.65.82: bytes=32 time=4ms TTL=64 Reply from 192.168.65.82: bytes=32 time=4ms TTL=64
  1. On Ubuntu
4. On Windows MATLAB, set the environment variables for ROS: setenv('ROS_MASTER_URI','http://192.168.65.82:11311') setenv('ROS_IP','192.168.65.80') rosinit result : The value of the ROS_MASTER_URI environment variable, http://192.168.65.82:11311, will be used to connect to the ROS master. The value of the ROS_IP environment variable, 192.168.65.80, will be used to set the advertised address for the ROS node. Initializing global node /matlab_global_node_33797 with NodeURI http://192.168.65.80:5348
5. create subscruiber: hw_status=rossubscriber('Niryo_one/hardware_status')
hw_status =
Subscriber with properties:
TopicName: '/Niryo_one/hardware_status'
MessageType: 'niryo_one_msgs/HardwareStatus'
LatestMessage: [0×1 HardwareStatus]
BufferSize: 1
NewMessageFcn: []
>> hwmesg=rosmessage(hw_status)
hwmesg =
ROS HardwareStatus message with properties:
MessageType: 'niryo_one_msgs/HardwareStatus'
Header: [1×1 Header]
RpiTemperature: 0
ConnectionUp: 0
ErrorMessage: ''
CalibrationNeeded: 0
CalibrationInProgress: 0
MotorNames: {0×1 cell}
MotorTypes: {0×1 cell}
Temperatures: [0×1 int32]
Voltages: [0×1 double]
HardwareErrors: [0×1 int32]
An emptymsg
5. I run roswtf command on ubuntu
<<
<<
>>
>>

Sign in to comment.

Answers (1)

sarra elghali
sarra elghali on 13 Mar 2018
this the java error I get when I run rossvcclient('/niryo_one/activate_learning_mode')
Mar 13, 2018 9:43:13 AM org.jboss.netty.channel.DefaultChannelPipeline
WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x730cfcfb] EXCEPTION: java.nio.channels.UnresolvedAddressException)
org.ros.exception.RosRuntimeException: java.nio.channels.UnresolvedAddressException
at org.ros.internal.transport.ConnectionTrackingHandler.exceptionCaught(ConnectionTrackingHandler.java:94)
at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:533)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:157)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:102)
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:55)
at org.jboss.netty.channel.Channels.connect(Channels.java:642)
at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:205)
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:230)
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:183)
at org.ros.internal.transport.tcp.TcpClient.connect(TcpClient.java:114)
at org.ros.internal.transport.tcp.TcpClientManager.connect(TcpClientManager.java:69)
Caused by: java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Unknown Source)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:139)
... 8 more
Failed to create a /niryo_one/activate_learning_mode service client.

Categories

Find more on Network Connection and Exploration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!