I'm learning ROS and I'm trying to populate data from my server to spinner. my JSON is:

{"topic": "/waypoints", "msg": {"waypoints": [{"header": {"stamp": {"secs": 0, "nsecs": 0}, "frame_id": "map", "seq": 0}, "pose": {"position": {"y": -140.901899144836, "x": 44.36469369653882, "z": 0.0}, "orientation": {"y": 0.0, "x": 0.0, "z": 0.5062775131960053, "w": 0.8623706161692133}}, "name": "A"}, {"header": {"stamp": {"secs": 0, "nsecs": 0}, "frame_id": "map", "seq": 0}, "pose": {"position": {"y": -102.30524463734227, "x": 51.282396271771304, "z": 0.0}, "orientation": {"y": 0.0, "x": 0.0, "z": 0.6926372547579506, "w": 0.721286096719859}}, "name": "B"}]}, "op": "publish"}

And I've already serialized the msg type(data) of the waypoints

public class WaypointList {

public Header header;
public Pose pose;
public String name;
public int secs;
public int nsecs;
public Position position;
public Orientation orientation;
public float y;
public float x;
public float z;
public float w;
public Stamp stamp;
public String frameId;
public int seq;
public List<WaypointList> waypoints = null;

 * No args constructor for use in serialization
public WaypointList() {

 * @param waypoints
public WaypointList(List<WaypointList> waypoints, Stamp stamp, String frameId, int seq, float y, float x, float z, float w, Position position, Orientation orientation, int secs, int nsecs, Header header, Pose pose, String name) {
    this.header = header;
    this.pose = pose;
    this.name = name;
    this.secs = secs;
    this.nsecs = nsecs;
    this.position = position;
    this.orientation = orientation;
    this.y = y;
    this.x = x;
    this.z = z;
    this.w = w;
    this.stamp = stamp;
    this.frameId = frameId;
    this.seq = seq;
    this.waypoints = waypoints;

Now I'm trying to get the list of the waypoint names and display it to my spinner. Please help me out. Thanks in Advance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.