Jump to content

Recommended Posts

Posted (edited)

Hi, 

 

I have been working a simple speed based steering project using Lego powered up app(v3.6.0) and a Technic Hub (88012) and 2 Technic XL motors.  I can't seem to get the programming blocks to behave in a sensible manner.  If anyone has any pointers on how to get these blocks to work it would be appreciated. Most of my efforts have been based on guesses, trial and error, and the few references I can find online.  My program and controls are as follows,

photo_2021-03-16_13-55-48.resized.jpg.40635cd6f4a98a17b02f7ba7f4b74a56.jpg

photo_2021-03-16_13-14-27.resized.jpg.917b1e733325511416d6410f631601a2.jpg

My expected/desired behavior is that when the joy stick is 

- to the top both tracks are 100% forward

- to the Bottom both tracks are 100% backwards

- to the left - left tracks is backwards and right track is fowards

- to the right - right tracks is backwards and left track is fowards

The actual behavior is 

- to the top both tracks barely crawl forward

- to the Bottom both barely crawl  backwards

- to the left - left tracks is backwards and right track is fowards (seems correct)

- to the right - right tracks is backwards and left track is fowards (seems correct)

(note the axis of the joystick are reversed from what I think they should be but that gives close to desired results.)

 

According to this reference https://racingbrick.com/powered-up-code-block-guide-full/ (the only one that I can find on the powered up blocks, although it is for an older version of the app. ). 

Sets the speed (-100..100) of a pair of tacho motors on the defined ports (AB or CD) with the steering direction (-100..100) defining a tank steering style behavior. 0 sets equal power to both outputs, 50 only powers one motor and 100 powers the motors in opposite directions. Positive-negative value for steering defines the direction.

Which match the the values I see on the guages. 

The build looks as follows.  No tracks untill I can get the motors to go correctly. 

photo_2021-03-16_13-14-22.resized.jpg.87ea9a8ba50ca36e087be28077e2fbb7.jpgphoto_2021-03-16_13-14-16.resized.jpg.a1ff721b7091bc2c8634a51f8073d3e4.jpg

 

 

 

photo_2021-03-16_13-36-22.resized.jpg

Edited by Cian Montgomery
Remove extra image.
Posted

Hi,

the outputs of the joystick are X and Y and not the radius r. This results in 0 power if the stick is on the max left or max right (Y = 0 if stick moves on the horizontal X-axis).

You can use the left/right output for steering as you did, but you have to calculate the current radius r as input for the power:

r = sqrt(x²+y²)

-> go to the white tab, you can find the square-root under "adv" (advanced), plus and square are directly available.

 

Hope this helps.

Posted

Thanks for the response,  Mapping the radiusof the joystick position to the velocity in place of the y axis improves the behavior.   

The full expression to map to the speed input is  (|y|/y)*SQRT(y^2 + x^2)

Here is an image of the final program.

sbs.jpg.0f4146f5fafd2748db418a5f6944f4fe.jpg

There is still an issue with the direction of on of my motors. I suspect that that has to do with the gearing I am using rather then the control code. 

 

 

 

 

 

 

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