Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

electronic trigonometry?

Status
Not open for further replies.

Torpedo

New Member
im curious, if i was to build a walker robot, (not neccesarily autonimous, probably remote to start with) yet i wanted to be able to control its motions using maths to work out the position of each leg, mainly using COS, SIN, and TAN, posibly also in the inverse function, how would i go about getting a curcuit to do that? can a PIC do it?

if it can any code examples of the normal and inverse function would be brilliant, thanks :D
 
As it's a robot, speed isn't an issue, so there's plenty of time even for normal PIC's to do the maths. The PICList has maths routines, as does the EPE website. But I suspect you're probably making this a LOT harder than it needs to be?.
 
i was considering trying to put something together similar to the hexapod robot video on youtube, a little red one that walks around a cola bottle and can translate in the Y, Z and X axis and rotate about all three. its pretty impressive so i was thinking of trying to design something similar, but wanted to know if the sort of calculations i'd need could be done.
 
I guess it depends how frequently you want to update it. THat's still a lot of trig per leg though and a lot of legs. It's a bit pointless to do some of that if you have no plan on where you want the leg in real-time, otherwise you could do all the calculations for a set of pre-defined positions beforehand and stick them in a table. Seeing as how it's RC servos and you don't have external access to the actual position of the servo, there might be no real reason to dynamically calculate foot positions (at least not very frequently).
 
well i was thinking i didnt just want another walker that only goes on flat surfaces and only does steped up surfaces on the off chance you made its legs go high enough!
 
Torpedo said:
well i was thinking i didnt just want another walker that only goes on flat surfaces and only does steped up surfaces on the off chance you made its legs go high enough!

I still don't see any need, or reason, for trig. to do that?. Assuming you want to vary the height of the gait based on the terrain, you simply need some kind of sensor to identify the terrain type, and alter the gait accordingly.

There are plenty of examples of walking HEX robots on the net, as far as I'm aware none use trig. functions?, nor can I think of a reason why they would want to?.
 
THen you would need vision (really REALLY extremely good vision at that) to make trig useful so it knows where it wants it's foot in advance. I know the temptation of wanting to give your robot as much feedback as you can though. Add foot pressure sensors first, and something that can track the terrain. Probably best to slowly build up on top of a working model than to build it all at once.
 
You do realise that the Hexapod V4 is driven by a PC via a serial link !
**broken link removed**

Far more power than a PIC.
 
yngndrw said:
Far more power than a PIC.

Obviously! - but I doubt that's why it was done, as a PIC (or a couple of PIC's) has far more power than required anyway. Presumably it was used mostly as a remote control system?, for the purposes of filming.
 
yngndrw said:
You do realise that the Hexapod V4 is driven by a PC via a serial link !
**broken link removed**

Far more power than a PIC.

doesnt particularly matter, i thought it could be driven by an onboard system but either way im pretty sure they did make an onboard system which is in the video i posted above.

Thing is the question isnt why id want to do it, i'd just like to know how to do it!

which code forms that run on a pic are capable of doing the neccesary calculations, what code line i'll need to write to perform such!

i know it'd be very complex, but it has more uses than just a single walking machine, i mean for instance just a simple arm could be made alot more useful if you can calculate its exact position in space around it, which you'd need trig to do.
 
Torpedo said:
Thing is the question isnt why id want to do it, i'd just like to know how to do it!

which code forms that run on a pic are capable of doing the neccesary calculations, what code line i'll need to write to perform such!

Like I said back in the 3rd post in this thread, there is code on the PICList and the EPE website.

i know it'd be very complex, but it has more uses than just a single walking machine, i mean for instance just a simple arm could be made alot more useful if you can calculate its exact position in space around it, which you'd need trig to do.

Lookup tables would do just as well, and a LOT faster, although speed isn't likely to be an issue here. You would also need to consider how accurate RC servo's actually are - assuming you're looking at using those?.
 
Nigel Goodwin said:
Obviously! - but I doubt that's why it was done, as a PIC (or a couple of PIC's) has far more power than required anyway. Presumably it was used mostly as a remote control system?, for the purposes of filming.

I'd also like to point out that the PC can use features like hardware multi-threading and the object orientated programming in C++.

Nigel Goodwin said:
You would also need to consider how accurate RC servo's actually are - assuming you're looking at using those?.

They also make digital versions of the server which are more accurate especially when moving small distances.
 
Nigel Goodwin said:
Like I said back in the 3rd post in this thread, there is code on the PICList and the EPE website.

ah yes, id seen the pic list one already, was quite suprised just how complicated the routine actually is for a sine fuction.
 
yngndrw said:
I'd also like to point out that the PC can use features like hardware multi-threading and the object orientated programming in C++.

And how would that help?, it's not even as if Intel PC are very good at multi-tasking! :p

For that matter, what advantage would OOP give?.
 
PCs are better at multi-tasking than they used to be - gone are the days of the 286s.
 
yngndrw said:
They also make digital versions of the server which are more accurate especially when moving small distances.

Not really. THey use the same potentiometer to measure position as analog servos. What digital servos do better is hold their position better than analog servos, but the accuracy of that position is the same as an analog servo.
 
Nigel Goodwin said:
And how would that help?, it's not even as if Intel PC are very good at multi-tasking! :p

For that matter, what advantage would OOP give?.
Hey there's nothing wrong with the new Intel Core2 Duo's. ;)

Anyway, the way I saw it was that you could use OOP to encapsulate the leg controlling code. You would have a class for a leg (With 6 objects of that class, 1 for each leg) and you would have some object which would be a message que and controller. Each leg can talk to each other through the use of messages, and you can issue commands to the robot as a whole by issuing a broadcast message to all of the leg objects. Each object can the process the command, or reject the command if it doesn't apply to them. Sensor objects can also be hooked up which would be able to send their own messages. It's the same system used in modern computer game AI. This would simplify the system as you're only programming for one leg, instead of having to make 6 copies of everything. Also makes the code scalable.

If you create each object in it's own thread, you can then use multitasking. This doesn't have to be run on a dual core - It just needs an OS which supports multitasking. (I.e. Windows) This would simplify the code even more.

I hope that makes sense.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top