4. Make the motors move (yay!)
Features:
- Pulse integrity
- Motion profiles
- Inverse kinematics
- Sensor integration
- Limits and exclusion domains
- Gcode library support
- Speed, speed, speed, speed
Single Motion Domain
START HERE
System Integration Level Features:
- Optimal job planning
- Collision avoidance (or not)
Acceleration management Const Jerk
Coordinated movement XYZ
Path planning Optimal path planning
Hardware device integration
Multiple motion domains
Cross-domain coordination
Exception handling and reaction
ABC UVW
5. Accessibility
â˘Arduino-level users
â˘Web programmers (e.g. JavaScript, node.JS, Python)
â˘Domain experts with little or no programming experience (or desire)
â˘Professionals: system builders, process engineers, etc.
Components
â˘Canned motion components and other pre-packaged functions
â˘Simple way to package arbitrary hardware components
Tools
â˘Motate hardware abstraction and simplification
â˘Kinen standards provide a powerful toolbox without soldering
â˘Hardware mashups / RESTful hardware
How do we get from motion domains to complete systems?
6. Easy enough for beginners.
Powerful enough for pros.
Making beginners into pros.
7. For Beginning Programmers:
Motate is an easy to learn embedded âlanguage.âOutputPin<13> ledPin;
ledPin = 1; // set to high
ledPin = 0; // set to low
âTurn pin 13 on and offâ
InputPin<12> buttonPin;
if (buttonPin) {
// do something
}
âRead the level of pin 12â
Timer<1> myTimer(kTimerUpToMatch, 50000);
// in a routine:
myTimer.setInterrupts(
kInterruptOnOverflow);
myTimer.start();
// define your interrupt:
namespace Motate {
MOTATE_TIMER_INTERRUPT(1) {
dda_timer.getInterruptCause();
// do something
}
}
âTell timer 1 to run my special routine at
50kHzâ
8. For Beginning Programmers:
// enable write to registers
REG_TC1_WPMR = 0x54494D00;
TC_Configure(TC1, 0, TC1->CMR0);
// set frequency
REG_TC1_RC0 = (VARIANT_MCK / 50000UL / 2)
// enable interrupts
REG_TC1_IER0 = TC_IER_CPCS;
NVIC_EnableIRQ(TC3_IRQn);
pmc_enable_periph_clk(ID_TC3);
TC_Start(TC1, 0);
// define the interupt
void TC3_Handler(void) {// read SR to clear interrupt condition
dummy = REG_SR_DDA; // do something
}
}
}
Native
(Atmel SAM3X8E ARM on the Arduino Due)
<< Code for Atmel ATMega line >><< Code for Atmel ATTiny line >><<
Code for Atmel ATXMega line >><< Code for Atmel ARM line >><<
Code TI MSP430 line >><< Code TI ARM line >><< Code for LPC
ARM line >><< Code for ST ARM line >>
Native
timer_number myTimerNum = 3;
Timer<myTimerNum> myTimer(kTimerUpToMatch, 50000);
// in a routine:
myTimer.setInterrupts(kInterruptOnOverflow);
myTimer.start();
// define your interrupt:
namespace Motate {
MOTATE_TIMER_INTERRUPT(myTimerNum) {
dda_timer.getInterruptCause();
// do something
}
}
Motate
âTell timer 3 to run my special routine at 50kHzâ
9. For Professional Programmers:
Motate is hardware abstraction layer, written in optimized C++.
All the good parts of C/C++, none of the bad ones:
Bad:
â˘RTTI, virtual functions, malloc, exceptions
â˘C++ Standard IO, C++ STL
Good:
â˘Good UI design techniques for designing APIs.
â˘An API is a UI.
â˘Donât compromise performance for usability.
â˘Play with the compiler, not against it.
â˘âIf itâs hardware, itâs compile time.â
â˘Use mirage interfaces, opaque interfaces that, upon
compiling, boil down to nothing.
â˘Judicious use of metaprogramming.
10. For Professional Programmers:
How fast is Motate?
With mirage interfaces, the HAL can boil away.
With this definition:
OutputPin<13> ledPin;
This code:
ledPin = 1; // set to high
Compiles down to one instruction on the AVR, and
executes in two cycles!
On the SAM3X8E ARM Cortex-M3, it compiles to two or
three instructions, which executes in two to five
cycles.
11. Hardware Mashups
â˘System with multiple coordinated domains and/or devices
â˘Controlled as single unit
â˘REST basics: resources, representation, state transfer
â˘Complex systems are composite resources
Why JSON?
â˘Flexible
â˘Relatively concise
â˘Already in most modern languages
On the device itself
â˘Running on ARM, ATXmega and ATMega328p
â˘Kinen project to define protocol and hardware compatibility
things line of JSON get it, set it
many different things
RESTful hardware
â˘REST does not require HTTP. We run over USB, SPI, RS-485
12. What you can do with JSON
What weâve learned about JSON
â˘Subset of the JSON spec
⢠7 bit ASCII only
⢠Single line, limited length (e.g. 128 to 256 chars)
⢠Limited number of name:value pairs (e.g. 24 per line)
⢠Decimal only, no hexadecimal
â˘Dispatch tables, tokens and indexes
â˘No mallocs
Commands: {"gc":"n20g0x20"}
Configuration: {"2":{"ma":1,"sa":1.800,"tr":36.540,"mi":8,"po":1,"pm":1}}
Status reports: {"sr":{"posx":1.230,"posy":4.375,"posz":-2.500,"posa":0.000,"vel":175.0,"stat":5}}
Filtering: {"sr":{"posx":2.670}}
Addressing & Routing: {"a_master":{"2":{"ma":1,"sa":1.800,"tr":36.540,"mi":8,"po":1,"pm":0}}}
{"a_slave":{"2":{"ma":1,"sa":1.800,"tr":360.0,"mi":4,"po":0,"pm":1}}}
13. What about efficiency?
â˘Itâs not as bad as you think
â˘Timings for set-X-axis-max-velocity to 16000 mm/min {"xvm":16000}
â˘NoJSON command is $1=16000
SAM3X8E Xmega192A3 atmega328P No JSON
Commands / sec ~1000 cps ~1000 cps ~1000 cps ~1600 cps
FP marshaling (strtof()) <7.5 uSec <25 uSec <70 uSec <70 uSec
FLASH footprint ~8 Kbytes ~8 Kbytes ~4-6 Kbytes
RAM footprint ~2 Kbytes ~2 Kbytes ~500 - 800 bytes
malloc() no no no no
Assumptions
â˘USB running at 115,200 baud
â˘FLASH / RAM footprints include JSON parser/serializer, dispatcher, floating point libs
14. For More Information: Synthetos.com
Alden Hart - alden.hart@synthetos.com
Rob Giseburt - rob.giseburt@synthetos.com