ROS package that acts as a server for the Immersive Semi-Autonomous Aerial Command System (ISAACS) platform.
mkdir catkin_ws
mkdir catkin_ws/src
cd catkin_ws/src
catkin_init_workspace
(this should create a "build" and "devel" directory in catkin_ws)git clone -b operator https://github.com/immersive-command-system/isaacs_server.git
(Or you can use the ssh uri). The "-b operator" argument ensures you clone the operator branch, which contains our most up-to-date (and probably buggy) code.cd ..
catkin_make
source devel/setup.bash
(this needs to be run every time)
~/.bashrc
: source ~/catkin_ws/devel/setup.bash
source ~/.bashrc
You are now all set and can run the server node.
roslaunch rosbridge_server rosbridge_websocket.launch
. To edit the parameters, run roslaunch rosbridge_server rosbridge_websocket.launch {arg}:={value}
(for example, roslaunch rosbridge_server rosbridge_websocket.launch unregister_timeout:= 600
). To test locally, you should python3 operator.py
from isaacs_server/src in a new terminal window.python3 service_test/[test_name].py
from isaacs_server/src in a new terminal window.Note that for roslibpy to work, the host IP should be the ROS master that is running rosbridge (multi-network) or roscore (local network). All ros connections are currently made to a static IP address (that probably isn't yours), so you will have to change all IP addresses to 'localhost' to run it locally, or to your static IP if you set up port forwarding. If you're confused about port forwarding, ask Kyle for more info.
Host IP can be set in either constants.py
or with the --ip [ip]
argument via command line.
Make sure you git pull
to ensure you have the latest code before you make any changes.
Don't forget to run catkin_make
and source devel/setup.bash
from catkin_ws/ to compile the package with the new service types. This must be done before you can use these new service types.
roslaunch rosbridge_server rosbridge_websocket.launch unregister_timeout:= 600
python3 operator.py
python3 dji_sim.py
this fakes the physical DJI drone / the DJI SDK.Run make working
to test currently available features. Note that this set tends to lag behind the actual codebase.
You'll need to pip install roslibpy
before you can use it. Make sure you're using python3, as python2 will run into errors. You might have to pip3 install roslibpy if python2 is your default python version, and python3 file_name.py to run it with python3.
import roslibpy
at the top of the python file.
Create a connection to ROS master:
client = roslibpy.Ros(host='ip', port=9090)
#where ip is either 'localhost' or the static IP of the ROS master you are trying to connect to.
client.run()
.
Creating a service:
service = roslibpy.Service(client, '/add_drone', 'isaacs_server/add_drone')
#where /add_drone is the name of the service, and isaacs_server/add_drone is the service type defined by add_drone.srv in the isaacs_server package.
service.advertise(handler)
#where handler is a function that is run upon the service being called.
Calling a service:
service = roslibpy.Service(client, '/add_drone', 'isaacs_server/add_drone')
#where /add_drone is the name of the service, and isaacs_server/add_drone is the service type defined by add_drone.srv in the isaacs_server package.
request = roslibpy.ServiceRequest({'ip': "some ip", "port": 9090, "drone_type":"DjiMatrice"})
#a dictionary of field names (defined in the service type) to inputs.
result = service.call(request)
#calls the service, with inputs defined by request, and sets result to the callback.