Jump to content
THIS IS THE TEST SITE OF EUROBRICKS!
THIS IS THE TEST SITE OF EUROBRICKS!

sunspot

Eurobricks Vassals
  • Joined

  • Last visited

  1. Thanks Carsten. Interestingly, my experience was a little different. I was able to access both acceleration and position using "import hub" rather than "import MShub" within the Mindstorms (robot inventor) app and using the other imports that are default for Mindstorms robot inventor. BUT, the syntax was different than what you wrote. In my environment, hub.status has no function "get", and instead I had to use p1, p2, p3 = hub.motion.position() #the above are pitch, roll and yaw but I haven't figured out which is which yet ax, ay, az = hub.motion_accelerometer_filter() #or leave off _filter and get noisier output I guess these differences are because I am using the Mindstorms app, rather than downloading whatever you use for Spike Prime? Maybe?
  2. Thanks, @Skookumjim , @Tcm0 , and @Munchkin255 ! Very cool! And great that it's actually very easy (though not intuitive) to switch between Mindstorms Robot Inventor features and Spike Prime features, just import hub instead of import MSHub!
  3. Sorry to ask a dumb newbie type question, but can you tell me how to access the acceleration data in python or in the word blocks? With Mindstorms Robot Inventor, I can see the instantaneous acceleration values in the ap, but I've only been able to access pitch, roll, and yaw, and not the accelerations, via code.
  4. In the MINDSTORMS app on the word-block side, sin() and cos() appear to work as expected, with the argument in degrees. But tan() does not give the right answer with the argument in degrees or in radians. For example, I'm getting tan(30) = -2.1e-7 and tan(30*3.14157/180) = -0.075, when I expect tan(30 degrees) = 0.58. If I switch over to text based input, math.tan() works as expected, with radians as input. Is anybody else confused by this in the word blocks or maybe already figured out what I'm overlooking?
  5. @PellewalleBrainstorming a few ideas, maybe one of them might give you the seed of the solution to your problem. These have various tradeoffs between bulk and precision, so I don't know if any works for you. (1) The hub detects its own yaw. If the thing you're rotating can include the hub itself, rotating on a low-friction turntable, you could read the yaw to use in your program. (2) you could convert the rotation of what you want to rotate to linear motion using a pinion gear on the axle of rotation and a rack or set of tread links, or using a pulley or whatever rotational-to-translational mechanism you like, and then use the distance sensor. (3) the thing you rotate could include a multi-colored disk or platform and you could use the color sensor to determine which zone is close to it, if you only need a few discreet rotational zones, like a game spinner. (4) or the thing you rotate could be a colored beam and after you set it (without using the motor), you then use a motor to spin a separate beam with the color sensor on it, in a parallel plane with a colinear axle, use the color sensor to find the colored beam, and the motor's positional sensor to tell you the angle required to find the beam.
  6. Not sure I entirely followed what you wanted, but maybe 30553/57360 or 30552, which have axle hole on one end and the click hinge connector on the other. (30553 & 57360 have 2 fingers and 30552 has 1 finger).
  7. How about using yaw? I've only used word blocks, but I know you can access and test the yaw of the 6-axis accelerometer in the P-brick. You could set yaw to zero when it starts going, and then continually test for yaw going out of range -5 to 5 (or whatever). Figuring out how to adjust the motor speed to compensate is left as an exercise to the reader :) ... Edited later: I was intrigued and tried it out. Using word blocks it's even easier than I thought, by adapting Tricky's line-following code, like this: first Set yaw to zero, then inside a repeat loop or other loop Start moving 2x(0-yaw) ; then outside the loop again Stop moving.
  8. You might also want to take another look at step 21 of building the body, which might potentially be confusing and could lead to something like that. Note that the inset box is showing you to do two things, not just align the motors but ALSO line up the turntable before meshing the gears.
  9. As a followup, I realized my motor was not miscalibrated and it's actually pretty unlikely to calibrate it wrong. Since you put an axle in when you lock the motor for calibrating, there are only 4 possible orientations; that is, it is very unlikely to be miscalibrated by a few degrees. If you think this might be the case, it's probably more likely something you misunderstood in the program (that was my problem) or a building error. For troubleshooting, it is nice to be able to check the motors are zeroed properly, and I found a quicker way to check it without unbuilding anything (*). In the extended word-block menu is a block for "go shortest path to position 0". You can set this to operate one motor or multiple motors. To get this option if you are only seeing the short menu, there should be a "show all blocks" drop-down arrow at the bottom of your block menu. You can make a new project for this operation or put it in a new stack in your existing program triggered by some sensor you are not already using (perhaps tapping the P-block). This does move the motors, so make sure it's safe, for instance by moving it away from the edge of the table or picking it up in your hand, etc. (*) The caveat to "without unbuilding anything" is that if your motor is physically prevented from going to zero, of course it won't. If that might be the case, you probably want to unbuild to free up the motor before testing the zero position. If it is physically prevented from going to zero, that might be intentional, but it also might be a clue about a building error.
  10. Hi! (Newbie question) I got LEGO Mindstorms 51515 for Xmas a few days ago and I love it! Straight out of the box, the Mindstorms App prompts you to calibrate the motors (or rather it calls it "updating" the motors). For one of the four motors, I didn't do such a great job and the zero position is a little bit off. I would like to recalibrate it, but after much searching, I just can't locate the option on the Mindstorms app. Can anyone please help me figure out how to trigger the motor calibration sequence again from the Mindstorms App after the initial installation? Thanks!
Sponsored Links