Updating Coordinate matrix

Hi,

I am currently working on a rover that runs on an Arduino Uno, and I am having some trouble with creating a coordinate matrix for navigation. Essentially, the coordinate matrix's job is to be updated every rotation of the wheel, and just store variables representing the home base that it has to return to (0,0) and coordinates where the rover detected certain obstacles. How would I go about making this matrix?

Thanks

So you have a fixed ground base referential (X,Y) and your vehicle is moving within this 2D space and you want to calculate and maintain the position of objects (obstacles or home base) in the vehicle referential?

Is that the question ?

A 2 dimensional array would be the obvious choice but memory is limited. What magnitude are the coordinates to be stored and how many of them are there on each axis ?

Yeah, pretty much

some reading:

why is a matrix needed?
why not maintain a position relative to the origin x,y?

    x += dx;
    y += dy;

I think OP wants to maintain objects positions in the coordinate system relative to the vehicle.

you could have dx and dy at 0 because you just rotated in place so the route back home or the location of the obstacles have rotated and you need a 2D rotation matrix applied to all objects coordinates to bring them back to the vehicle's coordinate system

it's probably easier to think in terms of fixed coordinate system so that obstacles have an absolute, non changing position and maintain the position and rotation of the vehicle (a vector) in this global coordinate system.

why relative to the vehicle?

dx and dy could be determined for each update of the vehicle's position.

don't understand the need to for calculating a rotation

Sounds like you just need a list.

You must have missed:

why not a list of coordinates for the rover itself and any obstacles.

atan() can be used to determine the angle between the rover and any desired target position (e.g an obstacle, origin) using the dx/dy between the two points.

Because @cedarlakeinstruments suggested std::list. OP is using an Uno, the STL is not available.

Actually, I suggested a list.

I linked to the std::list because I figured the next question would be "what's a list?" and that page has a good explanation. If I just linked to a CS definition of a list, it would most likely be ignored. This way there's a snowball's chance that OP would learn something.

Alternates to std::list - List - Arduino Reference

Two potential hiccups with this method (dead reckoning) that can lead to errors:

  1. Wheel slip
  2. Differential travel of wheel when turning the rover

if OP wanted key points to be always relative to the vehicle's coordinate system then you need to account for vehicle's rotation (vehicle can be at the same global location but heading in different ways)

in this example, for the first picture the rock would be negative Y in the car's coordinate system but if you rotate the car the rock would be in the positive Y. Yet the car is still at the same (X,Y) point in the global fixed referential.

yes, that make sense. that updates the position, both angle and distance.

but why relative to the vehicle?
as the vehicle moves, each stored position must be updated

maintaining positions relative to origin allows both angle and distance to easily be calculated w/o rotation

i'm curious about this application

yes that was my point before too ➜

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.