Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Integration old old #11

Open
wants to merge 5 commits into
base: integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20,271 changes: 0 additions & 20,271 deletions package-lock 2.json

This file was deleted.

18,885 changes: 12,942 additions & 5,943 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"dev-web": "cd packages/web && npm run dev",
"dev-web-emu": "npm run build-schema && concurrently \"npm run dev-fake_bridge\" \"npm run dev-web\"",
"ros": "ts-node scripts/launch_ros.ts",
"bridge-test":"node --experimental-vm-modules node_modules/jest/bin/jest.js"
"bridge-test":"node --experimental-vm-modules node_modules/jest/bin/jest.js",
"dev-bot": "cd packages/bot && npm run dev"
},
"repository": {
"type": "git",
Expand Down
58 changes: 58 additions & 0 deletions packages/bot/interface.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

// import rosnodejs from 'rosnodejs';
// const stagehands_ros_msgs = rosnodejs.require('stagehands_ros').msg;
import { TopicClient } from "webtopics";
import io from "socket.io-client";
import { fleetTopic } from "schema";

const client = new TopicClient(io("http://localhost:3000"));
console.log("Connecting to server...")
client.getServerID().then((id) => {
console.log("Server ID: ", id);
});

// function pose_listener() {
// rosnodejs.initNode('interface').then((nodeHandle) => {
// let client = new TopicClient(io("http://localhost:3000"));
// console.log("Connecting to server...")
// client.getServerID().then((id) => {
// console.log("Server ID: ", id);
// });
// // let sub = nodeHandle.subscribe('robot_current_pose', stagehands_ros_msgs.robotCurrentPose, (data) => {
// // let x = {
// // name: "bemp",
// // pose: {
// // position: [0, 0, 0],
// // quaternion: [0, 0, 0, 1]
// // },
// // targetPose: {
// // position: [0, 0, 0],
// // quaternion: [0, 0, 0, 1]
// // },
// // ledState: {
// // base: {
// // rgbValue: [0, 0, 0],
// // ledAnimation: {
// // animationMode: "constant",
// // flashingFrequency: 0
// // }
// // }
// // },
// // status: "idle",
// // module: {
// // type: "nullModule",
// // state: null,
// // moduleModels:{}

// // },
// // stopped: false
// // }
// // client.pub(fleetTopic, x)
// // console.log(bridgeServer.getController().getContext().getCurrentBotState())
// // console.log("im publishing", data)
// // });
// });
// }

// pose_listener()
21 changes: 21 additions & 0 deletions packages/bot/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "bot",
"version": "1.0.0",
"description": "mijh",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"run": "node --experimental-specifier-resolution=node --loader ts-node/esm interface.js",
"dev": "nodemon --exec node --experimental-specifier-resolution=node --loader ts-node/esm interface.js"
},
"author": "",
"license": "ISC",
"type": "module",
"dependencies": {
"nodemon": "^2.0.21",
"rosnodejs": "^3.1.0",
"socket.io-client": "^4.6.1",
"ts-node": "^10.9.1",
"webtopics": "^1.9.10"
}
}
6 changes: 5 additions & 1 deletion packages/bridge/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ export class bridgeServer{
this.controller.runService(overWriteLEDService,overWriteLEDServiceHandler);
//clear all bot's led overwrite service
this.controller.runService(clearLEDOverwriteService,clearLEDOverwriteServiceHandler);
this.controller.server.sub(serverMetaChannel,(data)=>{
console.log(data);

})
}

public getController(){
return this.controller;
}
}

const server =new bridgeServer();
3 changes: 3 additions & 0 deletions packages/bridge/src/topicHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import { botIDRegistrationService,FleetState } from "schema";

export function fleetTopicHandler(fleetState:FleetState,context:Context){
context.setCurrentBotState(fleetState);
console.log(fleetState);
console.log("receving")

//console.log("current state");

//console.log(fleetState);
Expand Down
22 changes: 18 additions & 4 deletions ros/basebot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ RUN apt-get install -y ros-noetic-rqt
RUN apt-get install -y libgazebo11-dev
RUN apt-get install -y python3-roslaunch

# Nodejs
RUN apt-get install -y nodejs npm

# Development
RUN apt-get install -y python3-catkin-tools
RUN apt-get install -y nano
Expand All @@ -39,6 +36,15 @@ RUN apt-get install -y wget
RUN apt-get install -y dos2unix
RUN apt-get install -y curl

# Install latest version of NodeJS
RUN echo "Installing latest version of NodeJS"
RUN /bin/bash -c "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash"

# Add the "~/.nvm" directory to the PATH
ENV NVM_DIR=/root/.nvm
# Install the latest version of NodeJS
RUN /bin/bash -c "source $NVM_DIR/nvm.sh; nvm install node"

# More ROS
RUN apt-get install -y ros-noetic-nav2d
RUN apt-get install -y ros-noetic-stage-ros
Expand All @@ -50,14 +56,22 @@ WORKDIR /catkin_ws/src
# Copy .src files into the catkin_ws/src folder:
COPY ./ros/basebot/src/ .

# Copy stagehands javascript codebase into the catkin_ws/src folder:
COPY ../packages ./stagehands-js/packages
COPY ../package.json ./stagehands-js
COPY ../package-lock.json ./stagehands-js

# Build the npm workspace
RUN /bin/bash -c "source ${NVM_DIR}/nvm.sh; cd stagehands-js; npm install; npm run build-schema"

# Set the working directory to catkin_ws
WORKDIR /catkin_ws

# Build the catkin workspace
RUN /bin/bash -c "source /opt/ros/noetic/setup.bash; catkin build"

# Set the environment variables
ARG ROS_MASTER_HOSTNAME=localhost
ARG ROS_MASTER_HOSTNAME=docker-desktop
ARG ROS_MASTER_PORT=11311
ARG TURTLEBOT3_MODEL=waffle_pi
ENV ROS_MASTER_URI=http://${ROS_MASTER_HOSTNAME}:11311
Expand Down
85 changes: 0 additions & 85 deletions ros/basebot/Dockerfile 2

This file was deleted.

7 changes: 0 additions & 7 deletions ros/basebot/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ fi

export PS1='\[\e[1;32m\]\u@\h:\[\e[1;34m\]\w\[\e[0m\]\$ '

export TURTLEBOT_NAME=AGGRON
export TURTLEBOT3_MODEL=waffle_pi
# export ROS_MASTER_URI=http://192.168.105.158:11311

export ROS_MASTER_URI=http://localhost:11311
export ROS_HOSTNAME=$HOSTNAME

# Convenience function to build the workspace
function build {
catkin build
Expand Down
Empty file.
58 changes: 58 additions & 0 deletions ros/basebot/src/stagehands_ros/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"configurations": [
{
"browse": {
"databaseFilename": "${default}",
"limitSymbolsToIncludedHeaders": false
},
"includePath": [
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/devel/include/**",
"/opt/ros/noetic/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/amcl/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/base_local_planner/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/carrot_planner/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/clear_costmap_recovery/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/costmap_2d/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/dwa_local_planner/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/DynamixelSDK/ros/dynamixel_sdk/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/global_planner/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/hector_slam/hector_geotiff/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/hector_slam/hector_map_tools/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/hector_slam/hector_mapping/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/hector_slam/hector_marker_drawing/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/map_server/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/move_base/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/move_slow_and_clear/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation_2d/nav2d_exploration/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation_2d/nav2d_karto/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation_2d/nav2d_localizer/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation_2d/nav2d_navigator/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation_2d/nav2d_operator/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/nav_core/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/navfn/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/openslam_gmapping/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/rotate_recovery/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/send_goal_position/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2_bullet/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2_eigen/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2_geometry_msgs/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2_kdl/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2_msgs/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2_ros/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/geometry2/tf2_sensor_msgs/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/turtlebot3_simulations/turtlebot3_fake/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/turtlebot3_simulations/turtlebot3_gazebo/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/turtlebot3/turtlebot3_slam/include/**",
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/src/navigation/voxel_grid/include/**",
"/usr/include/**"
],
"name": "ROS",
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu11",
"cppStandard": "c++14"
}
],
"version": 4
}
11 changes: 11 additions & 0 deletions ros/basebot/src/stagehands_ros/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ros.distro": "noetic",
"python.autoComplete.extraPaths": [
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages"
],
"python.analysis.extraPaths": [
"/afs/inf.ed.ac.uk/user/s20/s2030247/Documents/stagehands/basebot/catkin_ws/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages"
]
}
Loading