Jump to content

Python Robotics


Recommended Posts

Does anyone know of any additions to python, or modules that can be used for robotics? Also how to use these new additions? If not how hard is it to code my own module that can interface with a robot. My old python thread is still alive but I wanted to focus on the topic with this thread. 

Edited by Cheif Operations Director
Link to comment
Share on other sites

Second hit via duckduckgo: https://atsushisakai.github.io/PythonRobotics/

A quick look at the descriptions of the sample code indicates that robotics is hard, and even python has a hard time making it easy.  Of course, you probably don't want most of the hard issues of robotics (determining the local neighborhood visually and navigating around it, or where that car door is that you need to weld) and just have to deal with things that are mostly seen by mechjeb.

Accessing the I/O functions are going to be specific to the hardware and "robotics" probably won't be a good search term.  Just go through "python", [insert platforms of choice here], and maybe "gpio" (gpio your user controlled output pins).  Also look into whatever PID routines you need (developing the parameters is probably much more complicated than writing the code, so don't worry too much about python modules here).

As far as Python/C++/C/Java goes, don't be too surprised if you eventually need to drop all the way down to assembler (C *should* work, but you basically need to understand assembler and C to do it) to say this pin needs to be that voltage.  I suspect that is what you are asking for, and it will be specific to each hardware platform (arduino, raspberry pi, gumstick, etc.).  Good hunting.

Link to comment
Share on other sites

29 minutes ago, wumpus said:

Second hit via duckduckgo: https://atsushisakai.github.io/PythonRobotics/

A quick look at the descriptions of the sample code indicates that robotics is hard, and even python has a hard time making it easy.  Of course, you probably don't want most of the hard issues of robotics (determining the local neighborhood visually and navigating around it, or where that car door is that you need to weld) and just have to deal with things that are mostly seen by mechjeb.

Accessing the I/O functions are going to be specific to the hardware and "robotics" probably won't be a good search term.  Just go through "python", [insert platforms of choice here], and maybe "gpio" (gpio your user controlled output pins).  Also look into whatever PID routines you need (developing the parameters is probably much more complicated than writing the code, so don't worry too much about python modules here).

As far as Python/C++/C/Java goes, don't be too surprised if you eventually need to drop all the way down to assembler (C *should* work, but you basically need to understand assembler and C to do it) to say this pin needs to be that voltage.  I suspect that is what you are asking for, and it will be specific to each hardware platform (arduino, raspberry pi, gumstick, etc.).  Good hunting.

Ok, I am looking into it BUT this is my first time importing a library or something so how do I do that?

I was more interested in taking the robotics servo control code and applying it to the rocket parts

Edited by Cheif Operations Director
Link to comment
Share on other sites

Python itself can not make a servo move, since it's software. You need some hardware capable of doing it. Have you decided on that?

Once you decide on what hardware you'll run your stuff, you can start looking at what code and libraries to include.

Link to comment
Share on other sites

1 minute ago, Shpaget said:

Python itself can not make a servo move, since it's software. You need some hardware capable of doing it. Have you decided on that?

Once you decide on what hardware you'll run your stuff, you can start looking at what code and libraries to include.

Right now I am leaning toward Arduino if possible

Link to comment
Share on other sites

Arduino is certainly a way. It's designed to interface with and control physical objects. Also, there are some monstrously powerful Arduino compatible boards, capable of some heavy duty math.

Finally, there are libraries for pretty much anything you can imagine.

Link to comment
Share on other sites

13 minutes ago, Shpaget said:

Arduino is certainly a way. It's designed to interface with and control physical objects. Also, there are some monstrously powerful Arduino compatible boards, capable of some heavy duty math.

Finally, there are libraries for pretty much anything you can imagine.

right, It is just a pain to find them

Link to comment
Share on other sites

1 hour ago, Shpaget said:

PySerial is for comunication between two devices, so you can run some python on a pc and have arduino send some data to be processed by that python.

how about an on/off for a servo? This sounds like what I need

I mean what are the limitations of PySerial

Edited by Cheif Operations Director
Link to comment
Share on other sites

2 hours ago, Cheif Operations Director said:

how about an on/off for a servo? This sounds like what I need

Servo needs a bit more than an on/off switch to be of any use.

2 hours ago, Cheif Operations Director said:

I mean what are the limitations of PySerial

Why don't you read the documentation? It will tell you what it can do. What it can not do is directly connect with a motor. There has to be some sort of driver that will translate serial protocol to something that the motor can understand.

It all depends on what kind of motor you have in mind. Hobby servo motors for RC planes and cars usually use pulse phase modulation. There are some that can accept pulse width modulation (which may look and sound similar but is not).

Industrial servos could use a variety of protocols. For example, the ones I used in one of my projects could be controlled by a PC via USB, or with quite a few methods using several pins on the built in interface. Since I was replacing some steppers, the easiest way was to use one pin for direction, and pulse another one for each step. Of course that relies on the driver, in this case it was built in, so the hard work was already done, I just had to make sure that the software keeps track of numbers.

Of course, you can look for servos that have serial port. If you find some that are suitable for you, you're set.

But all this brings us back to several months ago when I told you that you should really figure out what hardware you're going to use before you write the software. It's much easier to fit software to hardware than the other way around.

Link to comment
Share on other sites

3 hours ago, Shpaget said:

But all this brings us back to several months ago when I told you that you should really figure out what hardware you're going to use before you write the software. It's much easier to fit software to hardware than the other way around.

I haven't written the script for this yet just have placeholders to make sure the main parts of the control code works.

 

3 hours ago, Shpaget said:

all depends on what kind of motor you have in mind. Hobby servo motors for RC planes and cars usually use pulse phase modulation. There are some that can accept pulse width modulation (which may look and sound similar but is not).

Industrial servos could use a variety of protocols. For example, the ones I used in one of my projects could be controlled by a PC via USB, or with quite a few methods using several pins on the built in interface. Since I was replacing some steppers, the easiest way was to use one pin for direction, and pulse another one for each step. Of course that relies on the driver, in this case it was built in, so the hard work was already done, I just had to make sure that the software keeps track of numbers.

Of course, you can look for servos that have serial port. If you find some that are suitable for you, you're set.

https://store.arduino.cc/usa/feetech-mini-servo-120-degrees-9g

https://store.arduino.cc/usa/feetech-6-kg-360-degrees-continuous-rotation-servo

I was thinking of something like that,  I need to do more research on the matter though

3 hours ago, Shpaget said:

Why don't you read the documentation?

Ok

Where do I find the documentation?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...