Jump to content

Recommended Posts

Posted

Hi!

A question to those who have already used the Lego Wireless Protocol to control Lego PoweredUp hubs. As far as I understand, PU motors have two positions. An absolute angle relative to an external fixed zero point (the point marked on angular motors), between -180 and 180 degrees, and a position relative to a preset value, which starts out as 0 when the hub is turned on or when the motor is connected to the hub and can remember multiple complete turns (not limited to 180 or 360 degrees). It is possible to query these values from the motors as sensor inputs (corresponding to 'POS' and 'APOS' input modes, APOS being the angle, and POS being the position relative to the preset), and I can confirm these work as intended, I get the absolute angle correctly, and I get 0 for the relative position on startup, and they change appropriately as the motor rotates.

In the protocol, there's an output command called GotoAbsolutePosition. I'd expect by the name that it moves to a specific absolute angle, but instead it seems to move to a specific position relative to the preset value.

My question is how to move the motor to a specific absolute angle? I know that I could use the preset to set it to the angle at startup, and then just use GotoAbsolutePosition, but for that I need to do querying/setting of motor modes/values, which I want to avoid on startup (also, I want to be able to switch output modes while having the motor input query set to a fixed more). Ideally, it should be possible to do this without switching modes and altering the preset value, since the motor does know its absolute angle internally (as confirmed by the querying). Does anyone know what commands achieve this? It should be similar to all other output commands, without requiring any querying. Thanks!

BTW, if you think this question has a higher chance to be answered on another part of the forum, please let me know!

Posted

If that is possible, you could skip initial callibrations in, for instance, steering, insn't it? But I think all lego models have an initial callibration step.... 

Maybe if you rotate the motor while it is desconnected it can't keep track of its current position? Just guessing...

Perhaps @Pybrickscould help us about that? 

6 minutes ago, vascolp said:

If that is possible, you could skip initial callibrations in, for instance, steering, insn't it? But I think all lego models have an initial callibration step.... 

Ah, forget about callibration, callibration is there because when we build it we don´t  need to care with motor position, any position will do.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...