DavidPL1 / assembly_example

Example code for interaction with our assembly simulation ICRA 2023 challenge
7 stars 1 forks source link

Where to import assembly_score_plugin from? #9

Closed abhishek47kashyap closed 1 year ago

abhishek47kashyap commented 1 year ago

For calling the service /get_assembly_status, the provided example has these lines:

from assembly_score_plugin.srv import AssemblyStatus, AssemblyStatusRequest

# Get assembly status
get_assembly_status = rospy.ServiceProxy('/get_assembly_status', AssemblyStatus)
assembly_status = get_assembly_status(AssemblyStatusRequest())

Where can I import the package assembly_score_plugin from? Currently getting a ModuleNotFoundError because no package by that name can be located.

DavidPL1 commented 1 year ago

assembly_score_plugin is a package built in the server image. Since the example dockerfiles extend the server image and extend the assembly_server installspace, there are no problems in building inside of the container. https://github.com/DavidPL1/assembly_example/blob/150559cb3922cdd94d324a098bbf8466cf095acf/docker/screw.Dockerfile#L8-L14

The easiest solution to build your code with dependencies outside of docker, is replicating the docker approach on your local machine by copying the install space out of docker and extending it in your workspace. These steps should do the trick:

# Create a docker container using the latest server image (presuming you imported the image as s4dx/assembly_server:latest otherwise insert the corresponding name)
docker create --name ws_extract s4dx/assembly_server:latest

# Copy the assembly_server install space to your local machine
docker cp ws_extract:/home/assembly_server ${HOME}/assembly_server

# Delete container
docker rm ws_extract

# change directory to wherever your user code workspace is
cd ${HOME}/user_ws

# Configure your workspace to extend the install space
catkin clean -y && catkin config --extend ${HOME}/assembly_server

# Optional: install all dependencies from apt
sudo apt-get update
rosdep update
rosdep install -y --from-paths ${HOME}/assembly_server ${HOME}/user_ws --ignore-src --rosdistro ${ROS_DISTRO}

# Build
catkin b
abhishek47kashyap commented 1 year ago

Awesome, thank you! Can now import assembly_score_plugin.