POZYX guided rover tracking on flight data screen not matching actual path... Update -2

I set up my POZYX system according to http://ardupilot.org/copter/docs/common-pozyx.html except I placed my anchors in a trapazoidal shape. The LAT, Long and YAW is set per the instructions.

But on the MP my rover tracks backwards/incorrectly/weird. So to make my rover track almost correctly, I’ve made the following two changes to original POZYX Arduino Pixhawk sketch:

1) Original Code

// send all beacon config to ardupilot
void send_beacon_config()
{
beacon_config_msg msg;
msg.info.beacon_count = NUM_ANCHORS;
for (uint8_t i=0; i<NUM_ANCHORS; i++) {
msg.info.beacon_id = i;
msg.info.x = anchors_x[i];
msg.info.y = anchors_y[i];
msg.info.z = heights[i];
send_message(MSGID_BEACON_CONFIG, sizeof(msg.buf), msg.buf);
}
Serial.println(“Sent anchor info”);
}

My modifications: I switched the X & Y data

// send all beacon config to ardupilot
void send_beacon_config()
{
beacon_config_msg msg;
msg.info.beacon_count = NUM_ANCHORS;
for (uint8_t i=0; i<NUM_ANCHORS; i++) {
msg.info.beacon_id = i;
msg.info.x = anchors_y[i];
msg.info.y = anchors_x[i];
msg.info.z = heights[i];
send_message(MSGID_BEACON_CONFIG, sizeof(msg.buf), msg.buf);
}
Serial.println(“Sent anchor info”);
}

2) I did the same for the following:

// send vehicle’s position to ardupilot
void send_vehicle_position(coordinates_t& position, pos_error_t& pos_error)
{
vehicle_position_msg msg;
// sanity check position
if (position.x == 0 || position.y == 0) {
return;
}
msg.info.x = position.y;
msg.info.y = position.x;
//msg.info.z = position.z;
msg.info.z = 0;
msg.info.position_error = pos_error.xy;
send_message(MSGID_POSITION, sizeof(msg.buf), msg.buf);
}

Is this something that is fixable in the MP coding or ???

Thanks

RoboBill

Update: I now have the anchors in a rectangular shape, but still have incorrect paths.

  1. According to the Loiter Arduino sketch, the anchor ID values increase according to the “N” pattern. Are the anchor ID values translated to decimals to determine order? In the sketch, that doesn’t seem to be the case.

  2. Is this 3.2 forum the best place to get help with the POZYX & MP interfaces?

Update 2 Switching from EKF 3 to EKF 2 seems to make things work much better.

1 Like

Hi, I’m trying to figure out similar problems.

If you stand near the anchor 0 and look at the anchor 1, do you have the anchor 2 on your left or on your right?

How did you set BCN_ORIENT_YAW?

For me… the Y axis is always to the left. As for the Yaw, I first followed the instructions but was never confident of the reading given on the MP. Then I found a web site that gave me headings. Since my POZYX system and its anchors are outside, I was able to determine the correct Yaw within a few degrees.

BTW For some unknown reason, when I switched back to EKF 3, things are working better.

So I suppose you put the position of the anchor 0 and anchor 1 looking on a satellite map in a website like this https://acscdg.com/ and you read the azimuth/bearing from there. It seems ok, but check if it’s coherent with the compass readings.
Or are you setting BCN_ORIENT_YAW to the bearing from anchor 0 to anchor 2?

From http://ardupilot.org/copter/docs/common-pozyx.html#placing-the-anchors it seems that the anchor 2 has to be on the right (looking from anchor 0 to anchor 1)

I used https://developers.google.com/maps/documentation/javascript/examples/geometry-headings between the 0 anchor and the Y anchor to determine YAW.

For me:
#0 anchor is at 0,0
#1 anchor is at x,0
#2 anchor is at 0,y
#3 anchor is at x,y

So YAW is from #0 to #2, which is to my left if I’m at #0 looking at #1.

Whats confusing is the anchor ID order. Per @rmackay9, his “N” pattern instructions say #0, #2, #1, #3. But the Arduino code does NOT appear to follow that pattern.

His anchors are declared as:
0x601C, // (0,0)
0x6020, // x-axis
0x6057, // y-axis
0x605E};

If I understand he “N” pattern instructions correctly, it should be:

0x601C, // (0,0) decimal equivalent of 24604… 1st of “N” pattern
0x6057, // x-axis decimal equivalent of 24663… 3rd of “N” pattern
0x6020, // y-axis decimal equivalent of 24608… 2nd of “N” pattern
0x605E}; // decimal equivalent of 24670… 4th of “N” pattern

Please show me the error of my thinking.

Thanks

RoboBill

Not thinking about the x,y axis for a moment, to me seems that in this image the orange text says to place the anchors in the N pattern with ascending IDs (0, 1, 2, 3), so:

  1
          3
0
        2

If this is true, the BCN_ORIENT_YAW is on anchors 0-1 and when you are at 0 and look at 1 you have anchor 2 on your right.

Let me know if you agree

I see your point. And now I’m more confused cuz for as long as I can remember, the y axis was always “to the left” of (or CCW to) the x axis. So for whatever reason, the x axis is now going from 1156 to 256B and the y axis is from 1156 to 3325.

I wonder why it’s set up like that? That may be why I have to tweak my Arduino sketch as noted above. I’ll change per this discussion and let you know.

Thanks for your input.

RoboBill