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

Moon's profile - activity

2020-12-30 06:33:42 -0500 received badge  Famous Question (source)
2020-10-25 11:52:25 -0500 received badge  Notable Question (source)
2018-06-23 00:48:02 -0500 received badge  Famous Question (source)
2017-12-22 15:52:25 -0500 received badge  Notable Question (source)
2017-12-22 15:52:25 -0500 received badge  Popular Question (source)
2017-11-19 19:32:28 -0500 received badge  Popular Question (source)
2017-06-21 15:15:12 -0500 received badge  Famous Question (source)
2017-06-20 05:08:59 -0500 asked a question ros node output signals on Tx of Raspberry Pi

ros node output signals on Tx of Raspberry Pi I'm working on a module which communicates with the Raspberry Pi through T

2017-06-20 02:18:23 -0500 marked best answer navigation stack and static map

what is the importance of static map in navigation stack?? and what if it doesn't exist??

2017-06-20 02:18:04 -0500 commented question How to generate 2D map using kinect?

I missed the odometry .. but now I found hector map which can generate a map with handheld sensor without the odometry

2017-06-20 02:16:02 -0500 received badge  Famous Question (source)
2017-05-24 12:57:32 -0500 received badge  Notable Question (source)
2017-05-24 10:24:28 -0500 received badge  Popular Question (source)
2017-05-06 08:22:04 -0500 asked a question navigation stack and static map

navigation stack and static map what is the importance of static map in navigation stack?? and what if it doesn't exist?

2017-05-06 05:16:24 -0500 asked a question How to generate 2D map using kinect?

How to generate 2D map using kinect? I'm implementing the navigation stack, and now I'm trying to replace the map server

2016-11-05 16:28:05 -0500 received badge  Famous Question (source)
2016-05-25 10:48:02 -0500 received badge  Notable Question (source)
2016-05-18 03:08:00 -0500 received badge  Famous Question (source)
2016-05-09 10:54:54 -0500 received badge  Notable Question (source)
2016-04-29 16:40:46 -0500 commented question array as response in python

the output of print repr(resp.tree) is like: {0: 0.0, 1: 0, 2: 0, 3: 0, 4: 2, 5: 'A', 6: 0, 7: 0.0, 8: 0, 9: 2, 10: 0, 11: 4, 12: 'B', 13: 0, 14: 1.0, 15: 0, 16: 4, 17: 0, 18: 6, 19: 'A', 20: 0, ....

2016-04-29 16:39:28 -0500 commented question array as response in python

it's just a part of the server

2016-04-27 10:49:48 -0500 received badge  Popular Question (source)
2016-04-27 10:33:36 -0500 commented question array as response in python

sorry, what do you mean??

2016-04-27 10:09:31 -0500 commented question array as response in python

I updated the question with a part of my sever code but I think the problem is due to that rospy treats uint32[] data as a bytes, which is the Python representation for byte data ... but I don't know how to solve it :(

2016-04-27 08:10:53 -0500 commented answer 2D array as service response

I did , thanks a lot :) and this the question if want to help http://answers.ros.org/question/23304...

2016-04-27 08:10:53 -0500 received badge  Commentator
2016-04-27 08:09:28 -0500 asked a question array as response in python

I'm writing a service which has an array as response my problem is when I print the received array in my client it printed as

(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100)

and this is not the data that I assigned to it in server.

my client code

    #!/usr/bin/env python

import sys
import rospy
from moon.srv import *

def st_client(x):
    rospy.wait_for_service('st')

    try:
    s = rospy.ServiceProxy('st', st)
    resp1 = s(x)
    step = resp1.step
    cell = resp1.tree
    print cell[1]
    print cell 
    return resp1
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

def usage():
    return "%s [x y]"%sys.argv[0]

if __name__ == "__main__":
    if len(sys.argv) == 3:
        x = int(sys.argv[1])
        print "test"
    else:
        print usage()
        sys.exit(1)

    st_client(x)
    print "Done"

my .srv file

uint32 a
---
uint32 step
int32[] tree

part of my server code

#!/usr/bin/env python

from moon.srv import *
import rospy
import math 

step= 2
MegaCellsNo = pow(12/(2*step),2)

def handle_st(req):

    for k in range(0, len(x)-1):
        for M in range(0, len(Positions[0])-1):
            #print "toto"
            if k%2==0 and M%2==0:          # X even & Y even
                Mcell = function(k,M)
                cell[i] = Mcell
                i += 1
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions[k][M] 
                i += 1 
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions[k][M+1]
                i += 1 
                cell[i] ='A'
                i += 1 
                cell[i] = 0
                i += 1

            if k%2==0 and M%2!=0:       # X even & Y odd
                Mcell = function(k,M)
                cell[i] = Mcell
                i += 1
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions[k][M] 
                i += 1 
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions[k][M+1]
                i += 1 
                cell[i] ='B'
                i += 1 
                cell[i] = 0
                i += 1

            if k%2!=0 and M%2!=0:      # X odd & Y odd
                Mcell = function(k,M)
                cell[i] = Mcell
                i += 1
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions[k][M] 
                i += 1 
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions[k][M+1]
                i += 1 
                cell[i] ='C'
                i += 1 
                cell[i] = 0
                i += 1

            if k%2!=0 and M%2==0:     # X odd & Y even
                Mcell = function(k,M)
                cell[i] = Mcell
                i += 1
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions[k][M] 
                i += 1 
                cell[i] = x[k]
                i += 1 
                cell[i] = Positions ...
(more)
2016-04-27 07:19:30 -0500 commented answer 2D array as service response

I mean how to write it in server but I found this way resp=stResponse()
resp.step = 7 resp.data = cell #cell is an array in my server code return resp

but I have another problem now: when I tried to print the received array in client it is printed as (1,2,3,4,..) not as the data that was assigned?

2016-04-27 07:14:49 -0500 received badge  Popular Question (source)
2016-04-27 06:11:42 -0500 commented answer 2D array as service response

if I chose the second possibility ; do you know how to return step and data to my client node ??

2016-04-27 06:04:15 -0500 marked best answer 2D array as service response

I want to use a service that has a 2D array response

this is my .srv file

uint32 a

---
uint32[][] tree

catkin_make error:

genmsg.base.InvalidMsgSpec: invalid field: Currently only support 1-dimensional array types: uint32[][]
2016-04-27 06:04:15 -0500 commented answer 2D array as service response

thanks . :)