ROS Serial C client library
|
How it works:
Things you should know before starting:
1. For now only SLAVE-Interfaces are tested! So you can only set up a uC to Host-PC connection. But this should be enough for having some fun with it! MASTER- and BRIDGE-Interfaces will follow as soon as possible. Concepts are shown at the image above.
2. Communication is done via Interfaces (rosInterface), each Interface corresponds to a unique nodehandle (rosNodeHandle). Nodehandles can be accessed as pointers by their human readable name. An example node is provided.
3. Interfaces should be interrupt driven and FIFO bufferd. Predefined structs (rosFifoBuffer) will make it easy to create them (copy, paste, rename). A template file is provided.
4. If you want to use an OS, you need a fitting abstraction layer implementation. A template file is provided. (Currently a FreeRTOS layer is also provided. ChibiOS comes next.)
Proceeding:
1. Set up uC and IDE of your choice.
2. Add ROS Serial C client library source files to your project.
3. Choose between usage with or without OS (Thats just a question of single- or multi-node usage...).
4. Setup hardware abstraction or take an existing HAL for your board.
5. Create Interfaces(Nodehandles) depending on your hardware. Maybe some interfaces are already provided. Check this before doing things twice.
6. Start writing your node(s).
7. Optionally: Embed nodes in OS layer.
A typical project should look like this:
│ ├─ libraries │ ├─ ROS Serial C client library │ │ ├─ hal │ │ │ └─ your hardware abstraction implementation │ │ ├─ osal │ │ │ └─ your OS abstraction implementation (only needed in use with OS) │ │ ├─ ros.c │ │ ├─ ros_nodehandle.c │ │ ├─ ros_packet.c │ │ ├─ ros_spinner.c │ │ └─ ros_time.c │ ├─ a 3rd party library dir │ │ └─ a 3rd party library source file │ └─ another 3rd party library dir │ └─ another 3rd party library source file │ ├─ sources │ ├─ OS sources │ │ ├─ e.g. kernel dir │ │ │ └─ kernel source files │ │ ├─ e.g. hal dir │ │ │ └─ HAL source files │ │ └─ e.g. portable dir │ │ └─ portable source files │ ├─ ROS nodes │ │ ├─ your 1. node │ │ └─ your x. node (only possible in use with OS) │ ├─ ROS interfaces │ │ ├─ your 1. interface │ │ └─ your x. interface (only possible in use with OS) │ ├─ your hardware configuration implementation │ ├─ your interrupt configuration implementation │ ├─ nodes.c (in OS use, you can define all nodes at compile time) │ └─ main.c (in OS use, just call rosInit() else write your single node here) │ └─ system (commonly provided by IDE or 3rd party) ├─ startup code ├─ system code └─ linker script