Initialising a scanning ultrasonic sensor
Posted: 27 Jan 2014, 13:39
Greetings from the Aussie tropics,
I'm new to this forum, and (almost) new to robotics, so please bear with me if I ask something obvious:
After failing to usefully complete several more 'handmade' robot builds, I've finally caved in and saved up and got myself a s/h NXT home edition (should have done it years ago). I've put together a basic robot with caterpillar tracks and a few sensors. So far so good, but I'm trying to get it to scan with an US sensor to the left and right before deciding which way to go. I know this has been done many, many times before so there must be solutions to problems which arise, but for the life of me I can't think of an elegant one for the problem I'm facing, so I hope someone can help me.
I've got it chuffing round the house, frightening the cat and mystifying the dogs and my husband, using only the two touch sensors rigged up to a sort of bumper bar across the front with the usual 'touch and reverse' loop, and I've got the US fixed on a transverse-mounted motor and ready to go, but I'm stuck on something simple: if I want it to scan say 90 deg left, then 90 deg right, then make a decision, for instance, how do I get it centred in the first place? I could centre it physically every time I turn it on and turn it loose, but that's rather defeating the purpose of autonomous movement. Any angle the Lego motor can measure is always going to be relative to where it starts measuring from, so it needs to centre itself relative to the robot's chassis before it can do any useful angle measuring.
Atm I have ( see photo, if I manage to get one uploaded ) a piece of cardboard fixed behind the US, and have the US programmed to swivel anticlockwise on startup to 'look over its left shoulder', so to speak, in 5 deg increments, until it sees something < 8 cm away (i.e. the card), and then swivel 180 deg clockwise, which brings it to approximately dead centre forwards every time.
It works well, but it's not pretty, not even by robot standards.
Any ideas for a better solution anyone?
/Users/lachlan/Desktop/P1040518.JPG
I'm new to this forum, and (almost) new to robotics, so please bear with me if I ask something obvious:
After failing to usefully complete several more 'handmade' robot builds, I've finally caved in and saved up and got myself a s/h NXT home edition (should have done it years ago). I've put together a basic robot with caterpillar tracks and a few sensors. So far so good, but I'm trying to get it to scan with an US sensor to the left and right before deciding which way to go. I know this has been done many, many times before so there must be solutions to problems which arise, but for the life of me I can't think of an elegant one for the problem I'm facing, so I hope someone can help me.
I've got it chuffing round the house, frightening the cat and mystifying the dogs and my husband, using only the two touch sensors rigged up to a sort of bumper bar across the front with the usual 'touch and reverse' loop, and I've got the US fixed on a transverse-mounted motor and ready to go, but I'm stuck on something simple: if I want it to scan say 90 deg left, then 90 deg right, then make a decision, for instance, how do I get it centred in the first place? I could centre it physically every time I turn it on and turn it loose, but that's rather defeating the purpose of autonomous movement. Any angle the Lego motor can measure is always going to be relative to where it starts measuring from, so it needs to centre itself relative to the robot's chassis before it can do any useful angle measuring.
Atm I have ( see photo, if I manage to get one uploaded ) a piece of cardboard fixed behind the US, and have the US programmed to swivel anticlockwise on startup to 'look over its left shoulder', so to speak, in 5 deg increments, until it sees something < 8 cm away (i.e. the card), and then swivel 180 deg clockwise, which brings it to approximately dead centre forwards every time.
It works well, but it's not pretty, not even by robot standards.
Any ideas for a better solution anyone?
/Users/lachlan/Desktop/P1040518.JPG