Notifications
Clear all

Emergency Stop System Logic - Motor Control Board  

Page 3 / 6
  RSS

DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 1 year ago
Posts: 652
2020-04-24 8:01 pm  

@starnovice

Actually I find the code to be the hard part.

To me working with electronics is a lot like golf - it's the perfect combination of relaxation and frustration!

😠

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
starnovice
(@starnovice)
Estimable Member
Joined: 1 year ago
Posts: 170
2020-04-24 8:09 pm  

@dronebot-workshop I played a lot of golf, learned a lot of swear words 😀 

Pat Wicker (Portland, OR, USA)


ReplyQuote
byron
(@byron)
Reputable Member
Joined: 1 year ago
Posts: 376
2020-04-24 8:48 pm  

@dronebot-workshop

I perused the @dronebot-workshop code that was posted above and could not see that an interrupt handler was created.  So did the EM stop work as expected with this code?  Blue smoke or anything exciting happened? 😀  I think you indicated it was a work in progress so maybe this is expected.  I was not following your code so my code snippet posting is not really relevant to your DB1 code, but just to illustrate checking of a flag set by an interrupt works well.  But I will be looking at your finished code for some more inspiration. 

Im interested in your circuit board changes, not that I'm creating a similar one, but I'm endeavouring to learn what extra bits like a small capacitors can do to a seemingly small and complete circuit. Maybe your forthcoming article on Oscilloscope use will shed some light on what one should be looking out for.  I don't know how you have time for golf 😎.


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 1 year ago
Posts: 652
2020-04-24 8:52 pm  
Posted by: @byron

think you indicated it was a work in progress so maybe this is expected.

You are correct, this code does not have any Emergency Stop interrupt handler, it was a work in progress. The purpose of today's experiment is to add one.

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 1 year ago
Posts: 652
2020-04-24 8:54 pm  
Posted by: @byron

I don't know how you have time for golf 😎.

Actually it's been decades since I golfed, gave it up in the 80s.  Probably just as well, I wasn't exactly Phil Michelson!

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
byron
(@byron)
Reputable Member
Joined: 1 year ago
Posts: 376
2020-04-24 9:11 pm  
Posted by: @dronebot-workshop

I wasn't exactly Phil Michelson!

Ahh well, to may of us drontboteers you are the tiger woods of the electronics playground.  (probably there's a better top man than tiger these day but I don't follow golf - surly it not Michelson though). Anyway enough from me as I don't want to interrupt your interrupts coding. 

 


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 1 year ago
Posts: 652
2020-04-24 10:18 pm  
Posted by: @byron

Anyway enough from me as I don't want to interrupt your interrupts coding. 

 

Actually I was just interrupted by squirrels!

My neighbor rang the doorbell to tell me that squirrels had built a nest in her daughter's car because she hadn't driven it for four days. As I park beside her daughter and haven't run my car since February she suggested I check under my hood.

Sure enough, I've been squirreled!  No nest, but there are remnants of insulating foam everywhere.  I don't think they munched on the wires and hoses as they did on Mehgans car.  But it's a mess.

Obviously, with the current COVID-19 situation, I can't do anything about it, and the car is drivable - I just went for a short test drive around the block. 

Now I'm looking for mothballs to put under the car to keep the buggers away.

This car has been nothing but bad luck!

  • Bought it at the beginning of December
  • Drove it three times
  • Someone hits it in my private parking spot, while I was inside cooking diner!
  • Took it to be repaired in January - they did a nice job
  • Drove it two more times
  • Pandemic hits the world and I had to park it in February
  • Now it's been attacked by squirrels

 

Nothing more I can do about that, so back to the coding.  Next DroneBot Workshop project will be a squirrel repeller!

🤓

Bill

 

 

"Never trust a computer you can’t throw out a window." — Steve Wozniak


Spyder liked
ReplyQuote
Spyder
(@spyder)
Prominent Member
Joined: 1 year ago
Posts: 843
2020-04-25 12:37 am  

@dronebot-workshop

Obviously I'm missing something here. Cuz right now, you've got the arduino controlling the motors, so, with the remote for the arduino being currently irrelevant due to the fact that it's just for testing, and that's not yer endgame, what purpose is the raspberry pi gonna serve ?

Is the Pi ultimately gonna send signals to the arduino, and then the arduino is gonna send signals to the motor coontrollers ?

Cuz if that's the case, I seem to be skipping a step, as I'm going right from the pi to the motor controllers

I'd like to know cuz I'm about to start trying to create the i2c junction panel


ReplyQuote
starnovice
(@starnovice)
Estimable Member
Joined: 1 year ago
Posts: 170
2020-04-25 8:28 am  

@spyder In my mind the PI was going to run the ROS core and coordinate signals with the rest of the robot.

Pat Wicker (Portland, OR, USA)


Spyder liked
ReplyQuote
Spyder
(@spyder)
Prominent Member
Joined: 1 year ago
Posts: 843
2020-04-25 12:18 pm  

@starnovice

Okay. So that doesn't change the fact that I still need the i2c junction panel... Good

Switching tracks

Moving on


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 1 year ago
Posts: 652
2020-04-25 12:24 pm  
Posted by: @starnovice

spyder In my mind the PI was going to run the ROS core and coordinate signals with the rest of the robot.

Yes, that is essentially correct. @spyder , check out this post to get some clarification.

 😎

Bill 

 

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
byron
(@byron)
Reputable Member
Joined: 1 year ago
Posts: 376
2020-04-27 3:44 pm  

@dronebot-workshop

I should be painting my bathroom ceiling, but having a tea break and seeking to extend I was musing on emergency stoppage.

When sending commands to the motors controller we could tell it to immediately go from full speed ahead to full speed reverse.  This is not desirable so we code in a more gentle approach to ramp up/down.  This ramping takes time during which time we may need to issue a different command.  For example a sensor indicates that the right hand corner is rapidly approaching a wall, so this signals the navigation layer to do something like a bit more right drive and a bit less left drive to swerve a bit to the left.  

This needs to happen immediately so if the previous command to the motors is still being ramped up then that needs to be cancelled in readiness for the new motor commands.  In the code snipped I showed previously the idea was that a flag was set (by an interrupt in this case as a way of quickly signalling from a navigation computer to a motor controller supervisor board) and the code continually polled the flag and stopped the motors if set, but the new motor commands would then follow. (and probably no-one read the code as it was not pointed out I failed to clear the flag having stopped the motors 🤨 ).  So this is a stop condition, but not really an emergency stop.

Then we have the emergence stop condition perhaps where the right hand sensor shows such a close proximity to the wall that an immediate stop is required and nothing else should happen until a reset is manually undertaken (hit a button or something).  Ok just fishing for some emergency stop scenarios serious enough for this to be warranted, in this case maybe the robot just slowly turns on the spot.   Other emergency conditions may be because the robot indicates it is no longer vertical, but is in a reclining horizontal position,  or perhaps a mechanical safety bar has been has been activated as its just hit granny on the leg.   I'm thinking that for these emergency conditions it may be prudent to go as far as cutting the power from the battery by tripping a contract breaker.

Ok back to painting 😥 


ReplyQuote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 1 year ago
Posts: 540
2020-04-29 3:51 pm  

@starnovice

Posted by: @starnovice

Yes the intent makes sense but you are still in the middle of a function call executing the last command and some how that function has to detect the stop and abort.  There is no other provision for cancelling that function.

Not so fast! 🙂

A temporary class can be used as a function that wraps up the command(s)... the command object can them be destructed in the interrupt routine under emergency condition(s)... I don't see why this wouldn't work?


ReplyQuote
starnovice
(@starnovice)
Estimable Member
Joined: 1 year ago
Posts: 170
2020-04-29 5:15 pm  
Posted by: @frogandtoad

Not so fast! 🙂

A temporary class can be used as a function that wraps up the command(s)... the command object can them be destructed in the interrupt routine under emergency condition(s)... I don't see why this wouldn't work?

So, you would have to construct the class every time you wanted to use it because you couldn't be sure it still existed.  I wonder what the overhead for the construction and destruction are and if it is appropriate to use in an interrupt routine that is just one of two interrupts. Actually, ignore that last part because the other interrupt is the encoder counter and it will stop when you stop the motors. Would also have to make sure you cleaned up any global variables involved.

Pat Wicker (Portland, OR, USA)


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 1 year ago
Posts: 652
2020-04-29 8:01 pm  

 

Posted by: @byron

Then we have the emergence stop condition perhaps where the right hand sensor shows such a close proximity to the wall that an immediate stop is required and nothing else should happen until a reset is manually undertaken (hit a button or something).  Ok just fishing for some emergency stop scenarios serious enough for this to be warranted, in this case maybe the robot just slowly turns on the spot.   Other emergency conditions may be because the robot indicates it is no longer vertical, but is in a reclining horizontal position,  or perhaps a mechanical safety bar has been has been activated as its just hit granny on the leg.   I'm thinking that for these emergency conditions it may be prudent to go as far as cutting the power from the battery by tripping a contract breaker.

I think cutting the power may be a bit excessive, as long as we can immediately stop the motors we can execute an emergency stop. 

Bear in mind that it's not expected to happen too often. The base unit is controlled either by the other layers or by someone using an external controller.  It's expected that the intelligence driving the robot is going to have already figured out how not to drive into a wall.   An emergency stop would occur when something unexpected happens, like something suddenly blocks the robot's path.

BTW, in case you think I've abandoned everyone I haven't, I've been dividing my time between household chores and coding for DB1. I have "cleaned up the previous code and am using it to test interrupts.

I actually have it now on GitHub but it' asset private at the moment, I want to get more code written before I make it public.  My household tasks have finally finished, so I'll be back at the coding and testing now, with hopes of releasing something tomorrow or Friday.

 

"Never trust a computer you can’t throw out a window." — Steve Wozniak


ReplyQuote
Page 3 / 6