SEMA User Guide for GPIO with ADLNK Neuron AmITX-Motherboard
ADLINK demo gpio example ROS package:
This package is a demonstration of the integration of ROS2 and onboard GPIO control. It will provide ADLINK omni-NeuronBot peripheral sensor and visual indicators of robot state. The GPIO control is implemented with the ADLINK Smart Embedded Management Agent (SEMA) function, which comes with the Neuron AmITX-Motherboard. The SEMA features various board monitoring, failsafe, as well as GPIO and I2C functionality.
Getting Started
These instructions will get you a copy of this demo and running on your local machine.
Prerequisites
- Hardware and library
You'll need the ADLINK SEMA library and a compatible motherboard to run this example. You can conatct bill.wang@adlinktech.com for more information. - Download the source of this project to your ROS2 workspace
cd ros2_ws/src/ros2 git clone https://github.com/EwingKang/neuron_demo_gpio.git
- 4 LEDs, 2 switches(one tactile, one contact)
- Your motherboard and GPIO connected
Installing
-
Install ADLINK SEMA
-
Setup soft link (by executing
setlink.sh
under/lib
)
Run the following command in the terminal command. If you get something likeerror: no such file as...
, you'll need to make the setlink.sh executable bychmod +x setlink.sh
.cd ${project_root}/lib e.g.: cd ros2_ws/src/ros2/neuron_demo_gpio/lib ./setlink.sh
-
Compile the source code
We'll need root access for library linking, that is done by the second step below; ROS2 uses ament as its default build/installation tool.cd ros2_ws sudo -sE ament build
Running the demo
Each of the code block below is a individual terminal with ROS2 environment veriable configured.
ros2 run demo_nodes_cpp talker -t neuron_gpio_cmd
root@neuron: ros2 run neuron_demo_gpio neuron_demo_gpio
* root@neuron: ros2 run neuron_demo_gpio neuron_omni_io
NOTE1: terminal can gain root access by first doing sudo -sE
NOTE2: alternatively, you can publish the triggering topic manually by run ros2 topic pub /neuron_hwm_cmd std_msgs/String "data: 0"
Monitoring
You can checkout the topics by:
ros2 topic list
and
ros2 topic echo /TOPIC
What should happened?
Besides the information you see on each terminal, proper ROS2 topic is published.
neuron_demo_gpio node
Subscribes to topic neuron_gpio_cmd from talker
Publishes topic neuron_gpio_data of type std_msgs::String
neuron_omni_io node
Subscribes to topic neuron_gpio_cmd from talker
Controls the LEDs and read from switches
Code explained
ANY kind of std_msgs data from TOPIC_CMD will trigger the node to publish the next hardware monitor data to TOPOC_DATA topic. 1. The setting of TOPIC_CMD and TOPIC_DATA can be found in reuronHwmNode.hpp
Notice
- This application MUST be running under SUDO -E since the SEMA driver need both root privilege and the user-exported variables.
Version
0.1.0
Authors
- Alan Chen - Initial library - (alan.chen@adlinktech.com)
- Ewing Kang - Demo implementation - (https://github.com/EwingKang)
License
This project is licensed under the Apache License, Version 2.0