Skip to content
/ Spidy Public

A simple try out in ARM world that want to move a spider robot

License

Notifications You must be signed in to change notification settings

stilgar/Spidy

Repository files navigation

QUICK EXECUTION
===========================================================================
1- To avoid using "sudo", your user must be in "dialout" group
2- If you don't connect Spidy to "/dev/ttyUSB0", you have to set env. var.
   "SPIDER_USB" with correct device
3- Plug-in USB-UART to PC:
   *  VCC to the board is drawn from Spidy
   *  GND  must be connected simultaneously to PC and Spider 
   *  So UART has 3 pins connected to PC: RX, TX and GND
3- Press "reset" on the board.
4- Start "runme" script in a shell. 
   All params will be forwarded to "sender" program.
   Everytime you launch "runme" you've to reset the board first.
===========================================================================


Motors will be connected at 1_8-1_11 pins, 2_0-2_11 pins and 3_0-3_1 pins.
Program Counter count at 12 Mhz, so we will count 15000 each 1,25 ms.
Periods of down will be spaced by 0.05 ms of delay (to avoid sync errors).

This process has a period of 26,20 ms.

Timing Events (ms):
  0.0	up_1
  0.9 	down_1 at 0%
  1.25	up_2
  2.10	down_1 at 100%
  2.15	down_2 at 0%
 ... loop again till 12.10 end of motor 9 ...
 12.10	Acquiring Buffer
 13.10	End Acquisition Buffer
 13.10	up_10
 ... loop again till 25.20 end of motor 18 ...
 25.20	Acquiring Buffer
 26.20	End Acquisition Buffer
 26.20	up_1 iteration 2

Errors will be at 1.25 ms (pull down of an engine and pull up of the next) 
exactly at (0.35/1.2)% equivalent to 52.5 degree. This will be resolved 
using integer degrees.

Sender is a program that sends burst of 7 couples engine-degree:
  * the first is in [CHAR_ENGINE_FIRST, CHAR_ENGINE_LAST] = [1, 18]
  * the second is in [DEG_NEG90, DEG_POS90] = [-90, 90]

There are some sync character around the couples:
  * CHAR_SFRAME 	(0x39)	--> starts burst of couples 
  * CHAR_SFRAME_END 	(0x3A) 	--> ends burst of couples
  * CHAR_ENDLINE	(0x0A)	--> line feed

So every line will be of 14 characters + 2 control chr + 1 endline.
Cortex accepts a maximum of 17 characters + 1 endline.

Sender accepts some commands from micro:
CHAR_MSTART	0x31		start session
CHAR_MREADY	0x30		ready state
CHAR_MEND	0x32		end program	(TODO)

Typical communication session:
	|     SPIDY	||    SENDER	|
*handshake
	CHAR_MSTART -->
	CHAR_MSTART -->
	CHAR_MSTART -->
	...
			<-- CHAR_SSTART CHAR_ENDLINE
* first 18 degrees (no motor will be moved)
	CHAR_MREADY -->
			<-- CHAR_SFRAME [couples] CHAR_SFRAME_END CHAR_ENDLINE
	> repeat until 18 commands has been received

* non blocking session
	CHAR_MREADY -->
	> moves motors using last 18 commands
			<-- CHAR_SFRAME [couples] CHAR_SFRAME_END CHAR_ENDLINE
	> saves buffer
	CHAR_MREADY -->
	> continues moving motors

* ending session (TODO)
			<-- CHAR_SEND CHAR_ENDLINE
	CHAR_MEND -->
	> returns to handshake session
	CHAR_MSTART -->
	CHAR_MSTART -->
	CHAR_MSTART -->
	...

Spidy sends also some control characters that helps to control the status.
* CHAR_CBUF 	Spidy saves buffer (DEBUG_LEVEL >= 1)
* CHAR_CREAD 	Spidy reads succesfully a buffer (DEBUG_LEVEL >= 2)
* CHAR_CLOOP 	Spidy can't read a buffer (DEBUG_LEVEL >= 3)

(TODO): Sender may build some statistics of how Spidy works.
(TODO): Sender-thread using openpm to divide workload between two threds:
		- first one that reads from stdin and uses the numbers received
		  to build next commands to be sent
		- second one that sends a buffer when Spidy ask it
(TODO): Spidy may change its DEBUG_LEVEL online
(TODO): Reset HW when micro receives CHAR_MEND

About

A simple try out in ARM world that want to move a spider robot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published