Aria hello world
This commit is contained in:
parent
f6f89fc994
commit
15536ba2d8
@ -1,32 +1,38 @@
|
||||
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
|
||||
{
|
||||
"dockerFile": "Dockerfile",
|
||||
"build": {
|
||||
"args": {
|
||||
"WORKSPACE": "${containerWorkspaceFolder}"
|
||||
}
|
||||
},
|
||||
// "dockerFile": "../Dockerfile.devcontainer",
|
||||
// "build": {
|
||||
// "args": {
|
||||
// "WORKSPACE": "${containerWorkspaceFolder}"
|
||||
// }
|
||||
// },
|
||||
"image": "irth7/ros2aria-dev",
|
||||
"remoteUser": "ros",
|
||||
"runArgs": [
|
||||
"--network=host",
|
||||
"--cap-add=SYS_PTRACE",
|
||||
"--security-opt=seccomp:unconfined",
|
||||
"--security-opt=apparmor:unconfined",
|
||||
"--volume=/tmp/.X11-unix:/tmp/.X11-unix"
|
||||
"--volume=/tmp/.X11-unix:/tmp/.X11-unix",
|
||||
"--device=/dev/ttyS0"
|
||||
],
|
||||
"containerEnv": {
|
||||
"DISPLAY": "${localEnv:DISPLAY}"
|
||||
},
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"workspaceFolder": "/ws",
|
||||
"workspaceMount": "source=/home/lab1_5/ros2aria_ws,target=/ws,type=bind,consistency=delegated",
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash"
|
||||
},
|
||||
"mounts": [
|
||||
"source=ros2aria-dev-bashhistory,target=/commandhistory,type=volume",
|
||||
],
|
||||
"extensions": [
|
||||
"dotjoshjohnson.xml",
|
||||
"laurenttreguier.uncrustify",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"ms-iot.vscode-ros",
|
||||
"ms-python.python",
|
||||
"ms-iot.vscode-ros",
|
||||
"ms-vscode.cpptools",
|
||||
"redhat.vscode-yaml",
|
||||
"smilerobotics.urdf",
|
||||
@ -34,4 +40,4 @@
|
||||
"twxs.cmake",
|
||||
"yzhang.markdown-all-in-one"
|
||||
]
|
||||
}
|
||||
}
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "src/AriaCoda"]
|
||||
path = src/AriaCoda
|
||||
url = https://github.com/reedhedges/AriaCoda
|
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@ -8,7 +8,8 @@
|
||||
"includePath": [
|
||||
"/opt/ros/foxy/include/**",
|
||||
"/workspaces/ros2aria/src/ros2aria/include/**",
|
||||
"/usr/include/**"
|
||||
"/usr/include/**",
|
||||
"/usr/local/Aria/include"
|
||||
],
|
||||
"name": "ROS"
|
||||
}
|
||||
|
@ -13,5 +13,17 @@ FROM athackst/ros2:foxy-dev
|
||||
# ENV DEBIAN_FRONTEND=dialog
|
||||
|
||||
# Set up auto-source of workspace for ros user
|
||||
|
||||
COPY ./src/AriaCoda /usr/local/Aria
|
||||
RUN cd /usr/local/Aria && make -j$(nproc)
|
||||
|
||||
ARG WORKSPACE
|
||||
RUN echo "if [ -f ${WORKSPACE}/install/setup.bash ]; then source ${WORKSPACE}/install/setup.bash; fi" >> /home/ros/.bashrc
|
||||
|
||||
ARG USERNAME=ros
|
||||
|
||||
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
||||
&& mkdir /commandhistory \
|
||||
&& touch /commandhistory/.bash_history \
|
||||
&& chown -R $USERNAME /commandhistory \
|
||||
&& echo $SNIPPET >> "/home/$USERNAME/.bashrc"
|
3
build_devcontainer.sh
Normal file
3
build_devcontainer.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
docker build --build-arg WORKSPACE=/ws -f Dockerfile.devcontainer -t irth7/ros2aria-dev .
|
||||
|
1
src/AriaCoda
Submodule
1
src/AriaCoda
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 4f60425ef757bdd9c4e077c65d1c80665a2b33d6
|
@ -21,10 +21,14 @@ find_package(ament_cmake REQUIRED)
|
||||
# further dependencies manually.
|
||||
# find_package(<dependency> REQUIRED)
|
||||
|
||||
|
||||
add_executable(ros2aria src/ros2aria.cpp)
|
||||
target_include_directories(ros2aria PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
$<INSTALL_INTERFACE:include>
|
||||
/usr/local/Aria/include)
|
||||
|
||||
target_link_libraries(ros2aria /usr/local/Aria/lib/libAria.so)
|
||||
|
||||
install(TARGETS ros2aria
|
||||
DESTINATION lib/${PROJECT_NAME})
|
||||
|
@ -1,10 +1,46 @@
|
||||
#include <cstdio>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
#include "Aria/Aria.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
printf("hello world ros2aria package\n");
|
||||
ArRobot *robot = new ArRobot();
|
||||
|
||||
ArArgumentBuilder *args = new ArArgumentBuilder(); // never freed
|
||||
ArArgumentParser *argparser = new ArArgumentParser(args); // Warning never freed
|
||||
argparser->loadDefaultArguments(); // adds any arguments given in /etc/Aria.args. Useful on robots with unusual serial port or baud rate (e.g. pioneer lx)
|
||||
args->add("-robotPort /dev/ttyS0"); // pass robot's serial port to Aria
|
||||
// args->add("-robotLogPacketsReceived"); // log received packets
|
||||
// args->add("-robotLogPacketsSent"); // log sent packets
|
||||
args->add("-robotLogVelocitiesReceived"); // log received velocities
|
||||
args->add("-robotLogMovementSent");
|
||||
args->add("-robotLogMovementReceived");
|
||||
ArRobotConnector *conn = new ArRobotConnector(argparser, robot); // warning never freed
|
||||
if (!conn->connectRobot())
|
||||
{
|
||||
printf("RosAria: ARIA could not connect to robot! (Check ~port parameter is correct, and permissions on port device, or any errors reported above)\n");
|
||||
return 1;
|
||||
}
|
||||
robot->runAsync(true);
|
||||
sleep(3);
|
||||
printf("Enabling motors\n");
|
||||
robot->enableMotors();
|
||||
|
||||
printf("Enabled motors\n");
|
||||
robot->setVel(2);
|
||||
robot->move(500);
|
||||
|
||||
sleep(10);
|
||||
|
||||
robot->move(-500);
|
||||
sleep(2);
|
||||
conn->disconnectAll();
|
||||
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user