Detecting collision for a wheeled robot. #244
Replies: 5 comments 21 replies
-
Have been trying this code, without effect. # Main
print("Start: BCar")
light.on(brightness = light_intensity)
motor_left.control.stall_tolerances(car_speed, stall_time)
motor_right.control.stall_tolerances(car_speed, stall_time)
while True:
drive_base.drive(car_speed, car_fwd_turn_rate)
if motor_left.control.stalled() or motor_right.control.stalled():
drive_base.stop()
drive_base.straight(car_reverse) The parameters may need fine tuning, but not even if I hold one or the two motors by and, I can trigger the stalled condition. Not sure if I can access motor_XX.control.stalled() while the drive_base is running. |
Beta Was this translation helpful? Give feedback.
-
Still regarding the usage of IMU to detect a collision, still wondering if this would be feasible... Prime and Inventor hubs support tap detection with their native firmware tap detection, which work fine with relative weak taps. Hence it should a matter to find out how this is implemented. On this regard I've also another question. Which are the acceleration units returned by IMU sensor with Pybricks?
1G ~= 9,81 m/s2 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I had another idea, which was to monitor current consumption using hub.battery.current(). I got it easily working using unregulated motor but current with regulated motor is much more shaky and would need better filtering to get it working. In the charts attached, yellow is the unfiltered current, pink is shortly damped current, blue is heavily damped one. |
Beta Was this translation helpful? Give feedback.
-
Separately, we've discussed detecting collision by looking at the motors/wheels. I'm starting to look at exposing the approximation of the load/effort in the user API. In essence, this tells you how much feedback torque the motor delivers. It is kind of similar to Video.10-02-2021.11.40.34.movIt seems to work quite well in this test. (There's nothing particularly special about this vehicle design; it's just the segway I built earlier with some support wheels. But it does not need to be flat.) Like acceleration, the raw load estimate is a bit noisy, but in this example I've filtered it a bit, giving a tradeoff between accuracy and response time. Using it would be fairly straight forward: load = my_motor.control.load()
if load > threshold_value:
do_something() I think I'll let this method return values in millinewtonmeters. You could then use @ZPhilo's motor page to get some ideas for thresholds. Ideas? Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Hi,
Generally I'm trying to detect collision events for a wheeled robot. It can be a fixed obstacle or in the limit another moving car, but lets keep it simple to start.
I've planned to use the IMU from TechnicHub to detect a deceleration, but the fact is that even considerable speed and high sampling rates, the acceleration readings doesn't seem to stand out from the IMU readings noise level.
Another possibility would be to try detecting the wheels slow down. However my experience tells me me that even in front of an obstacle, a relative light weight car keeps its wheels running as if it was moving freely...
This regardless if it is a varnished parquet, ceramic tiles or ABS like the large 8x16 tiles.
I may try playing with stall_tolerances method in Control Class, but I've some doubts this could successfully solve the problem.
Any ideas you'd like to suggest?
Below the code I'm using to log the IMU readings in the console. For the case of my prototype, the significant readings should appear mostly on Y axis.
I've tried with larger wait times as it was my intention, trying even to remove the wait to increase the sampling to the maximum so I won't miss the collision event, without success.
BTW, I've also experienced another problem.
Sometimes when I stop the program, drivebase motors keep running forever. I may eventually stop them with a long press on hub's green button, but sometimes really need to remove the batteries so that the program can be stopped.
Beta Was this translation helpful? Give feedback.
All reactions