Web Interface: Difference between revisions

From Rsewiki
Line 2: Line 2:
=PUT IMAGE HERE=
=PUT IMAGE HERE=
This is the how the basic structure is for the web interface.
This is the how the basic structure is for the web interface.
==realsens camera==
To start of with we run the following command to reconfigure it to ros melodic:
sudo apt install ros-melodic-ddynamic-reconfigure
After that we can follow the guide given here, but i'll write my approach below
https://github.com/IntelRealSense/realsense-ros#step-3-install-intel-realsense-ros-from-sources
Here the commands used to download and install the ros package can be seen:
cd ~/flexbot_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
cd ~/flexbot_ws
At last we build and source it using
catkin_make
source ~/flexbot_ws/devel/setup.sh
To launch it use, remember to source or be in the right directory before launch
roslaunch realsense2_camera rs_camera.launch





Revision as of 10:36, 30 January 2020

// TODO mention browser console

PUT IMAGE HERE

This is the how the basic structure is for the web interface.


realsens camera

To start of with we run the following command to reconfigure it to ros melodic:

sudo apt install ros-melodic-ddynamic-reconfigure

After that we can follow the guide given here, but i'll write my approach below https://github.com/IntelRealSense/realsense-ros#step-3-install-intel-realsense-ros-from-sources

Here the commands used to download and install the ros package can be seen:

cd ~/flexbot_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
cd ~/flexbot_ws

At last we build and source it using

catkin_make
source ~/flexbot_ws/devel/setup.sh

To launch it use, remember to source or be in the right directory before launch

roslaunch realsense2_camera rs_camera.launch


roslibjs

Installing rosbridge

This library makes it possible to use ros commands with javascript over a chosen port. The first two lines goes to the source in the catkin workspace and creates a package for ros:

cd ~/flexbot_ws/src
catkin_create_pkg robot_gui_bridge rosbridge_server

Next we install the rosbridge package

apt-get install ros-melodic-rosbridge-server 

Now we create the launch file directory and the file used for launch

mkdir ~/flexbot_ws/src/robot_gui_bridge/launch
touch ~/flexbot_ws/src/robot_gui_bridge/launch/websocket.launch

Now at last we write the the necessary launch commands into the file and source it so we can use it from any directory om this terminal:

echo '<launch> <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"/></launch>' >> ~/flexbot_ws/src/robot_gui_bridge/launch/websocket.launch
source ~/flexbot_ws/devel/setup.bash

To test if it works run and look for errors:

roslaunch robot_gui_bridge websocket.launch

Setting up the connection

First check if the following command gives multiple ip's if so find a way to extract the correct one:

hostname -I 

Now to setup the client, which is the computer not on the robot, write the following 3 lines in your "~/.bashrc" script:

# write these inside ~/.bashrc
export ROS_HOSTNAME='hostname -I'
export ROS_IP="hostname -I"
export ROS_MASTER_URI='http://flexbot.local:11311/'

Now to setup the server, which is the computer on the robot, write the following 2 lines in the "~/.bashrc" script:

# write these inside ~/.bashrc
export ROS_IP=flexbot.local
export ROS_MASTER_URI='http://flexbot.local:11311/'


Web Interface - Interface for ROS and browser

test