Jump to content

Recommended Posts

Posted

Hello everyone, 

I'm actually completely new to this community. I'm working on a small project including the Lego Liebherr 13000 crane. It was very fun to build btw. 

So I'm required to kinda replace the Lego Technic app used to control the crane by a raspberry pi. I successfully managed to connect my raspberry pi to the hubs via bluetooth. So far so good.

I also managed to do some testing with very simple commands and functions to see if I could control the motors, no problem.

But I need your help for something more complex (actually I have no idea if it's hard at all, I'm fr a beginner I hope this doesn't sound stupid or anything lol).

So in the Lego Technic app you can "calibrate" the crane, like initialize it in a specific position by setting the different parts of the crane to their limit. The thing is, I don't know how to replicate this calibration process in my code. All I do is send basic instructions like setting the speed of the different motors for a specific amount of time.

But for example, let's say I make one motor (the muffle one for example, idk what it's called actually but I'm referring to the part of the crane attached to a rope which lifts stuff) rotate at a specific speed for 5 seconds. And let's say that the rope is already set up to its limit, which would mean that if the motor continues to rotate, the muffle (again correct me if I'm wrong, sorry about that my vocabulary is still bad) would just retract on itself even while reaching its limit, while in the Lego Technic app, if one part of the crane reaches their limit, the calibration process seems to detect it and makes the motor rotate in the opposite direction to set it up correctly.

I hope you can understand me, I'm aware that my description is very vague and I wish I could express myself better haha but yeah basically what I need help for is finding a way to replicate the calibration process of the Lego Technic app but in my python code. 

If you need any more information please let me know! 

Thank you in advance for your help :)

Posted (edited)

In Pybricks I use the run_untill_stalled command to calibrate. Store motor angle/rotations on either end and keep track of them or reset the angle and don't go past it.
Pybricks uses Python so may translate one on one to your Raspberry, not sure if your Raspberry would need the Pybricks firmware installed on the hubs. Pybricks has example projects and commands documented and it should be possible to operate the crane with Pybricks firmware and standard PU remote only (no devices).

Edited by Berthil
Posted
On 9/19/2023 at 12:11 PM, Berthil said:

In Pybricks I use the run_untill_stalled command to calibrate. Store motor angle/rotations on either end and keep track of them or reset the angle and don't go past it.
Pybricks uses Python so may translate one on one to your Raspberry, not sure if your Raspberry would need the Pybricks firmware installed on the hubs. Pybricks has example projects and commands documented and it should be possible to operate the crane with Pybricks firmware and standard PU remote only (no devices).

Hello again!

While the pybricks library looks interesting, I'm actually using the bricknil library and I was wondering if there was any alternative with this library instead of the pybricks one. I've done some research but only found a few basic functions like set_speed or ramp_speed and a few more. 

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...