-
 

jason_ros repository

Repository Summary

Checkout URI https://github.com/jason-lang/jason_ros.git
VCS Type git
VCS Version melodic
Last Updated 2021-11-02
Dev Status MAINTAINED
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
jason_ros 1.6.0
jason_ros_comm 0.0.0
jason_ros_msgs 1.6.0

README

jason-ros

Description

This repository is being used to develop a possible integration between Jason and ROS.

This is being done by customizing the agent architecture, AgArch class, to include ROS functionalities, using rosjava. Also, an intermediary ros node, called HwBridge, is being used to serve as bridge between Jason and Hardware nodes.

Basically, the Jason agent publishes the action it wants to perform into the topic ‘/jason/actions’ and it subscribes to the topic ‘/jason/actions_status’ to receive the status of the action sent and to the topic ‘/jason/percepts’/ to receive new perceptions.

In other hand, HwBridge node subscribes to ‘/jason/actions’ and using the information contained in the action_manifest it translates the action received and sends it to the right topic/service, when the action is completed it publishes its status into ‘/jason/actions_status’ topic. Also, it publishes perceptions into ‘/jason/percepts’ topic according to what is defined in perception_manifest.

Docker images containing this repo and needed environment can be found at dockerhub.

armv7 version at branch armv7 (out of date)

Usage

mas2j

Use jasonros.RosArch

MAS rosbridge_agents {

    infrastructure: Centralised

    agents: sample_agent agentArchClass jasonros.RosArch;
}

Gradle

Include jason, jasonros and jasonros_msgs to gradle:

repositories {
   mavenCentral()
   jcenter()

   maven { url "https://raw.github.com/rosjava/rosjava_mvn_repo/master" }
   maven { url "https://raw.github.com/jason-lang/mvn-repo/master" }
   maven { url "http://jacamo.sourceforge.net/maven2" }
}

dependencies {
   compile group: 'org.jason-lang',     name: 'jason' ,   version: '2.4-SNAPSHOT'
   compile group: 'org.jason-lang',     name: 'jasonros' ,   version: '1.8'
   compile group: 'org.jason-lang',     name: 'jasonros_msgs' ,   version: '1.8'
}

Edit Manifests

In order to use this project, one must modify the action_manifest and perception_manifest to include the information about the actions being performed and the perceptions of interest.

action_manifest:

[teste]
method = topic
name = /hw/teste
msg_type = String
dependencies = std_msgs.msg
params_name = data
params_type = str
latch = True

method - topic or service

name - name of the topic or service

msg_type - type of the message e.g. String, Bool, Int32

dependencies - python module which contains the message type e.g. std_msgs.msg, mavros_msgs.msg

params_name - name of the parameter being sent

params_type - type of the parameter e.g. bool, str, int. If not inclued the default type is str

latch - if the action should be latched e.g. true, True, yes, 1, False, false. If not included the default is true

For more examples of actions you can take a look at this action_manifest

perception_manifest:

[state]
name = /hw/teste2
msg_type = String
dependencies = std_msgs.msg
args = data
buf = add

name - name of the topic or service

msg_type - type of the message e.g. String, Bool, Int32

dependencies - python module which contains the message type e.g. std_msgs.msg, mavros_msgs.msg

args - fields that you want to perceive

buf (belief update function) - if the perception should be added or updated in the belief base. If not inclued the default option is update

This perception would be added into the agent belief base as state(data)

For more examples of perceptions you can take a look at this perceptions_manifest

Running Bare Metal

Dependencies

ros - this project was tested with ros melodic but it should work with different versions

java

gradle

Running

Clone this repo:

$ git clone https://github.com/Rezenders/jason-ros.git

Initialize roscore:

$ roscore

Before running HwBridge node jason_ws must be built and sourced:

$ cd jason_ws
$ catkin_make
$ source devel/setup.bash

If you don’t want to source everytime you open a new bash, do something like:

echo "source ~/jason-ros/jason_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

Note: Change “~/jason-ros/jason_ws/devel/setup.bash” for the right path in your computer

HwBridge node:

$ cd jason_ws/src/hw_bridge/src
$ ./hw_bridge.py

In order to inspect what is being exchanged between the nodes you can use rostopic echo/info to inspect the topics /jason/actions, /jason/actions_status, /jason/percepts, /hw/teste or /hw/teste2:

$ rostopic echo /jason/actions      #or any other topic

Jason node:

$ cd rosjava_agents
$ gradle

Running with Docker

Build image

$ docker build --tag jason-ros .

Create network:

$ docker network create ros_net

Container 1:

$ docker run -it --rm --net ros_net  --name master --env ROS_HOSTNAME=master --env ROS_MASTER_URI=http://master:11311 ros:melodic-ros-core roscore

Container 2:

$ docker run -it --rm  --net ros_net  --name hwbridge --env ROS_HOSTNAME=hwbridge --env ROS_MASTER_URI=http://master:11311 jason-ros

Then, at /jason_ws/src/hw_bridge/src folder:

$ ./hw_bridge.py

Container 3:

In order to inspect what is being exchanged between the nodes you can use rostopic echo/info to inspect the topics /jason/actions, /jason/actions_status, /jason/percepts, /hw/teste or /hw/teste2:

$ docker run -it --rm  --net ros_net  --name echo --env ROS_HOSTNAME=echo --env ROS_MASTER_URI=http://master:11311 jason-ros

Then:

$ rostopic echo /jason/actions      #or any other topic

Container 4:

$ docker run -it --rm  --net ros_net  --name agent --env ROS_HOSTNAME=agent --env ROS_MASTER_URI=http://master:11311 jason-ros   

Inside container at the agent folder:

$ gradle

Developers Note

In order to generate jason_ros_msgs.jar run:

$ docker build -t jason-msg . -f MsgDockerfile

$ docker run -it --rm -v ${PWD}/jason_ros/src/rosjava_agents/lib/:/artifacts jason_ros_msgs cp /jason_ros_ws/build/jason_ros/jason_ros_msgs/java/jason_ros_msgs/build/libs/jason_ros_msgs-1.6.0.jar /artifacts/jason_ros_msgs.jar

Note: Use the correct version according to jason_ros_msgs/package.xml

Examples

A functional example using docker can be found at the repo MAS-UAV For more examples check the example folder

Reference

If you find this repository usefull and use it in your project, please consider citing it:

@article{silva2020embedded,
  title={Embedded Architecture Composed of Cognitive Agents and ROS for Programming Intelligent Robots},
  author={Silva, Gustavo R and Becker, Leandro B and H{\"u}bner, Jomi F},
  journal={IFAC-PapersOnLine},
  volume={53},
  number={2},
  pages={10000--10005},
  year={2020},
  publisher={Elsevier}
}

Paper link

CONTRIBUTING

No CONTRIBUTING.md found.