#robotics Logs

Oct 12 2015

#robotics Calendar


06:16 SpeedEvil Resistance is futile.
06:17 SpeedEvil Can you perhaps configure any GPIO to a low-drive mode?
09:13 veverak deshipu: ehmm... got an email? :D
09:13 veverak I would like to help with coding things eventually for tote, but suppose keeping it IRC only sucks
09:15 deshipu veverak: sure, how about tote@sheep.art.pl?
09:16 veverak good
10:10 deshipu veverak: by the way, I think the structure of my code needs to change completely
10:11 deshipu veverak: I have to get rid of inheritance completely
10:11 deshipu veverak: and use a component-based approach instead
10:12 deshipu veverak: so a robot would have a "servo controller" component, "leg" and "body" components, then "gait" component, etc.
10:12 deshipu veverak: then I can replace each of them without having to rewrite all the code
10:34 verak got it as base of his
10:34 veverak bud I am using lot of fancy stuff and some dark magic
10:35 veverak and especially that event-library in C could poses problem with compability with micropython
10:37 veverak deshipu: well, it's KISS at least :)
10:39 veverak ad. structure, I've got hiearchy of "Modules", where each module represents something (servo, leg, robot, networking, devices, arduino ...) and each module got access to root module/event loop/it's parent
10:39 veverak one big tree
10:39 veverak :)
10:43 deshipu hierarchies tend to be inflexible
10:49 veverak for what?
10:49 veverak :)
10:51 veverak I've got mechanism to "share" modules upwards in hiearchy
10:53 veverak basically, servo speaks to arduino via "self.root.arduino.pwm_pins[n].write(angle" (or something like that)
10:53 veverak *self.root.dev.arduino"
10:54 deshipu ugh
10:54 veverak damn it, that is ugly example :/
10:55 deshipu and then if you need to replace the arduino with, say, teensy, you need to rewrite your code to call self.root.teensy.pwm_pins
10:55 veverak yeah, bad example
10:56 veverak deshipu: actually no, if I would write it "self.root.servo_controller"
10:56 veverak and make shared API ...
10:56 veverak just replace actual servo_controller
10:56 deshipu well, that's what I wanted
10:56 deshipu you would call robot.servo_controller.set_servo_position(xxx)
10:56 veverak yeah
10:57 veverak but I am not sure about one detaily
10:57 veverak if I would force each controller to make servo api, it would be tricky, because I want to use controller to other things propably
10:58 deshipu why would you use a servo controller to other things?
10:58 deshipu for other things
10:58 deshipu it controls servos, that's all it does
10:58 veverak on the other hand, aking general servo object, and write "specific servo handler" that inherits it for each type of controller ...
10:58 deshipu you would have other controllers for other things
10:59 veverak yeah, but why add another arduino for tote, when I can measure battery voltage with actual?
10:59 deshipu why do you need to add another arduino?
10:59 deshipu just have a battery_controller object that talks to the same arduino
10:59 veverak yeah
10:59 veverak that's something that missed me
11:00 veverak :)
11:00 deshipu OOP is not about matching the objects to physical things
11:01 veverak yeah, but I suppose need to not to make unneeded objects backfired on me here
12:22 veverak hmm
12:22 veverak that ^^ is repaired now
12:23 rue_shop4 if your still here maybe I can blow your mind, with an idea like self.locomotion.setvector(30,40) (angle 30 degrees, 40% power)
12:23 veverak rue_shop4: that's something on top
12:23 veverak I mean, several layers above :)
12:23 rue_shop4 and self.gripper.goto(8,4,6) (3d co-ords)
12:23 rue_shop4 mmm
12:23 rue_shop4 good
12:23 verak just finished queue for m
12:24 veverak just not sure if I want to assert that one move at a time
12:24 veverak for make it that you can execute longtime move on somer servos
12:24 veverak and several smaller moves in between
12:24 veverak hmm
12:51 deshipu veverak: I'm not sure queue is a good approach
12:52 deshipu veverak: I'd rather have some way of either deciding what to do next when a move finishes, or waiting a particular set of moves to finish
12:52 deshipu veverak: and that calls for something like twisted reactor
12:54 verak got event
12:54 veverak library, so something that got "reactor"
12:55 veverak I've got timer so far for the robot, that executes function with logic "if self.last_move < time.time(): do_next_move()"
12:58 veverak so it can do something else if it's not executing moves :)
13:09 veverak http://pyuv.readthedocs.org/en/v1.x/ using this for a while
13:40 deshipu veverak: I wonder if it would make sense to go for asyncio
13:48 verak uses asy
13:48 veverak wat
13:48 veverak you mean conceret library
13:48 veverak will look :)
13:48 veverak *concerete
13:51 deshipu https://pypi.python.org/pypi/asyncio
13:51 deshipu there is a version for python 2 called trollius
13:52 deshipu https://pypi.python.org/pypi/trollius/
14:25 veverak hmm
14:25 veverak I will dive into it propably
14:25 veverak python native asyncio sounds better than external library
14:25 veverak :)
14:27 sherlock the problem is the lack of stuff like requests for asyncio
14:27 sherlock but there are some new libraries up and coming for that
14:27 sherlock and I think twisted is porting over
14:28 veverak requests?
14:31 rue_shop4 something by the arrogant worms would be nice
14:32 sherlock requests is the good python http https request library
14:33 veverak I see
14:33 veverak deshipu: looks fine by me
14:33 veverak got SSL support, nah I don't have that :/
14:37 veverak but nah, looks like heavy usage of "yield"
14:39 sherlock asyncio? yeah they replaced it with a real keyword in latest pythob
14:39 sherlock like await async
14:39 sherlock https://www.python.org/dev/peps/pep-0492/
14:45 veverak that
14:45 veverak looks interesting
14:45 veverak but, I feel lost in it
14:45 veverak :D
14:51 veverak deshipu: I am still afraid making complex things wtih "yield" stuff is suicide
14:52 veverak but I might be just afraid :)
15:16 deshipu veverak: there is another thing about the walking algorithms
15:17 deshipu veverak: I want the ability to adjust them dynamically based on sensor input
15:17 deshipu veverak: for instance, one of the totes I have has switches at the ends of the legs
15:18 veverak well, and where is problem? :D
15:19 deshipu if you have queued movements, you can't really do that easily
15:20 veverak why not?
15:21 veverak at any point I can purge the queue and make brand new moves
15:22 veverak I mean, movement algoritmin won't "hold" the thread entire time
15:22 deshipu and lost what other parts might have queued
15:24 veverak or just make the queue in a way that you can access them, modify, and leav them be?
15:24 veverak *leave
15:25 veverak or put new movement at the start of the queue..
15:25 veverak by queue I don't mean using only python standart queue, but make something that would meet best the needs fo the script
15:27 veverak "queue" is ment only datastructure to store what to do next, not limit you about ways you can change it :)
15:29 veverak not to mention abillity to force one "step" to be launched ASAP and than continue with queue
15:40 veverak yeah, making it from descriptor might do the same
15:47 deshipu a deferred :)
15:48 veverak that sounds better
15:48 veverak with descriptors I am afraid, that you can just remove the "descriptor" because it might open some resoursrce that should be closed
15:48 veverak so you have to return control to it, with a way to tell it it should close, so you should think about it in every descriptor
15:52 deshipu alternativelly, have callbacks on events
15:52 deshipu and have the sensors generate events
15:52 veverak aaaa, I don't get the context :D
15:53 veverak wait wait
15:53 veverak so far, I have queue (using the standart one for now)
15:54 deshipu that queue should hold events
15:54 veverak and in the queue are references to functions, which should expect only argument -> object with hardware to be controlled
15:54 deshipu and it should be a priority queue
15:54 deshipu with time as priority
15:54 veverak each time queue.get() is called, I get function and call it
15:55 veverak so, if sensors pick up soemthing, they can eitehr put new func() at the start of the queue and let it execute ASAP
15:55 veverak or just don't do anything, and let the next-called function deal with the stuff?
15:56 deshipu then you are coupling the sensor code with whatever uses the sensors :(
15:56 deshipu the idea is that the sensor doesn't care how its readings are used
15:56 veverak semantics
15:56 veverak so I make sensors with callbacks and object that works with actual state based on sensors
15:56 deshipu the servos would also generate events when they finish moving
15:56 veverak :)
15:57 veverak yeah
15:58 veverak so far only way I am able to make servo generate callback is to setup timer based on time-estimate
15:59 deshipu sure, for the hobby servos
15:59 veverak yeah, but if everything would generate some way of event, and if it would have proper callback system
15:59 deshipu smart servos can do it normally
15:59 veverak I suppose making algos in a way "lunch servos and wait for all callbacks" could work
15:59 deshipu veverak: say, have you considered using ROS? :)
15:59 veverak yeah
15:59 deshipu veverak: it has that event system already
16:05 veverak deshipu: hmm, chmm
16:10 veverak deshipu: about ROS I like te idea of multiple intependent nodes
16:19 deshipu veverak: also take a look at https://hackaday.io/project/6423-bowlerstudio-a-robotics-development-platform
16:23 veverak hmm
16:23 veverak noooo
16:23 veverak I've got tons fo code done omfg
16:23 veverak :)
16:51 rue_shop4 is it usefull for anything tho?
16:54 Tom_itx rue_shop4, how much code have you not used?
16:54 rue_shop4 hmm
16:55 rue_shop4 all the code I did wrong before I learned to modularize properly
17:00 Snert_ as in couch your code inside of individual functions?
17:00 Snert_ and call them as needed?
17:01 Snert_ trying to figger out what you mean by modularize.
17:01 rue_shop4 I dont write programs as one peice anymore, I write libraries and use small amounts of code to call the functions in them
17:02 deshipu revolutionary
17:02 rue_shop4 sure
17:02 rue_shop4 it makes progress exponential
17:02 Snert_ ok...sounds like I do the same thing.
17:02 rue_shop4 almost all I have to do anymore it just stich togethor a few of my libraries
17:03 rue_shop4 ocassionally retuning a library with a little extra functionality
17:18 rue_house "Stop, thats deodarant, dont eat that..."
17:22 rue_shop4 void TimerInit() { //8 bit timer, set up 10Khz (15.625Khz)
17:22 rue_shop4 / tho it dosn't have to be a 8 bit timer, it dosn't matter really
17:22 rue_shop4 / as long as all the diodes down my left side hurt, nothing really matters.
17:22 rue_shop4 / robot with a brain the size of a planet, and they have me writing c code, pathetic.
17:22 rue_shop4 TCCR1B = (1<<CS12); // 6Mhz / 256 !!!PROCESSOR!!!!
17:22 rue_shop4 TimerReset();
17:22 rue_shop4 }
17:22 rue_shop4 I find the most interesting comments in my code