Skip to content

Commit 2a40817

Browse files
committed
0.1.0 release
1 parent 64e0554 commit 2a40817

27 files changed

+757
-1429
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "differential-drive"]
2+
path = differential-drive
3+
url = git@github.com:GonzaCerv/differential-drive.git

differential-drive

Submodule differential-drive added at 36cd696
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#information about the robot
2+
3+
# PCB communication
4+
PCB_UART_PORT: "/dev/ttyACM0"
5+
PCB_UART_UPDATE_RATE_HZ: 20
6+
7+
# Physical characteristics of the robot
8+
# export TICK_METERS=3653
9+
ticks_meter: 3653
10+
BASE_WIDTH: 0.2
11+
12+
# Motor Drive configuration
13+
MAX_SPEED_METER_SEC: 0.5
14+
MIN_SPEED_METER_SEC: 0.1
15+
PID_MIN: 10.0
16+
PID_MAX: 700.0
17+
PID_P: 50.0
18+
PID_I: 200.0
19+
PID_D: 2.0
20+
ENCODER_MIN: -32768
21+
ENCODER_MAX: 32767

noah_behaviour/launch/main.launch

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
<?xml version="1.0"?>
12
<launch>
2-
<arg name="port_name" default="/dev/ttyS0" />
3+
<rosparam file="$(find noah_behaviour)/config/environment.yaml" command="load" />
34

4-
<!-- Spawn the service that communicates with the robot-->
5-
<param name="/uart_comms_node/port_name" value="$(arg port_name)" />
6-
<node name="uart_comms_node" pkg="noah_drivers" type="noah_drivers_uart_comms_node" output="screen" required="true" />
5+
<!-- Launch the node for communication with PCB -->
6+
<include file="$(find noah_drivers)/launch/drivers_node.launch"/>
7+
8+
<node pkg="differential_drive" type="twist_to_motors.py" name="twist_to_motors" output="screen">
9+
<remap from="lwheel_vtarget" to="/motor_left_pwm"/>
10+
<remap from="rwheel_vtarget" to="/motor_right_pwm"/>
11+
<rosparam param="base_width">0.16</rosparam>
12+
<rosparam param="rate">25</rosparam>
13+
</node>
14+
15+
<node pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" name="teleop_keyboard" output="screen">
16+
<remap from="cmd_vel" to="/twist"/>
17+
<rosparam param="speed">0.3</rosparam>
18+
<rosparam param="turn">0.8</rosparam>
19+
</node>
720

821
</launch>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
# Author: Gonzalo Cervetti (cervetti.g@gmail.com)
4+
#
5+
# Description: Starts 2 serial ports communicated between
6+
# each other (bridge) the service keep running in background
7+
# in a tmux session.
8+
# The ports started run
9+
10+
tmux new-session -d -s socat_virtual_ports 'socat -d -d pty,raw,echo=0,crnl pty,raw,echo=0,crnl'

noah_drivers/CMakeLists.txt

Lines changed: 77 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,44 @@ find_package(catkin REQUIRED COMPONENTS
1515
std_msgs
1616
)
1717

18+
find_library (serial_LIB
19+
NAMES serial
20+
HINTS "/usr/local/lib/")
21+
22+
if(serial_LIB)
23+
message(STATUS "Looking for libserial - found")
24+
else()
25+
message(STATUS "Looking for libserial - not found")
26+
endif()
27+
1828
## Specify additional locations of header files
1929
## Your package locations should be listed before other locations
2030
include_directories(
2131
include
2232
${catkin_INCLUDE_DIRS}
2333
)
2434

35+
36+
################################################
37+
## Declare ROS dynamic reconfigure parameters ##
38+
################################################
39+
40+
## To declare and build dynamic reconfigure parameters within this
41+
## package, follow these steps:
42+
## * In the file package.xml:
43+
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
44+
## * In this file (CMakeLists.txt):
45+
## * add "dynamic_reconfigure" to
46+
## find_package(catkin REQUIRED COMPONENTS ...)
47+
## * uncomment the "generate_dynamic_reconfigure_options" section below
48+
## and list every .cfg file to be processed
49+
50+
## Generate dynamic reconfigure parameters in the 'cfg' folder
51+
# generate_dynamic_reconfigure_options(
52+
# cfg/DynReconf1.cfg
53+
# cfg/DynReconf2.cfg
54+
# )
55+
2556
###################################
2657
## catkin specific configuration ##
2758
###################################
@@ -35,118 +66,72 @@ catkin_package(
3566
INCLUDE_DIRS
3667
include
3768
CATKIN_DEPENDS
38-
geometry_msgs
39-
roscpp
40-
rospy
41-
std_msgs
42-
noah_msgs
43-
LIBRARIES
44-
${PROJECT_NAME}_uart_comms_node
45-
${PROJECT_NAME}_uart
69+
geometry_msgs
70+
roscpp
71+
rospy
72+
std_msgs
73+
geometry_msgs
74+
LIBRARIES
4675
DEPENDS
4776
)
4877

49-
5078
###########
5179
## Build ##
5280
###########
5381

54-
## C++ executables ##
55-
add_executable(${PROJECT_NAME}_uart_comms_node
56-
src/PackageManager.cpp
57-
src/PCBCommsNode.cpp
58-
src/PCBCommsNodeRunner.cpp)
59-
60-
target_link_libraries(${PROJECT_NAME}_uart_comms_node
61-
${catkin_LIBRARIES}
62-
${PROJECT_NAME}_uart
82+
add_executable(${PROJECT_NAME}_node
83+
src/DriversNodeRunner.cpp
84+
src/DriversNode.cpp
85+
src/PCBBridgeManager.cpp
6386
)
64-
add_dependencies(${PROJECT_NAME}_uart_comms_node
65-
${${PROJECT_NAME}_EXPORTED_TARGETS}
66-
${catkin_EXPORTED_TARGETS}
67-
)
68-
69-
## C++ libraries ##
70-
71-
add_library(${PROJECT_NAME}_uart
72-
src/Uart.cpp
73-
)
74-
target_link_libraries(${PROJECT_NAME}_uart
87+
target_link_libraries(${PROJECT_NAME}_node
7588
${catkin_LIBRARIES}
89+
${serial_LIB}
7690
)
77-
add_dependencies(${PROJECT_NAME}_uart
91+
add_dependencies(${PROJECT_NAME}_node
7892
${${PROJECT_NAME}_EXPORTED_TARGETS}
7993
${catkin_EXPORTED_TARGETS}
8094
)
8195

8296
#############
83-
## Testing ##
97+
## Install ##
8498
#############
8599

86-
if(CATKIN_ENABLE_TESTING)
87-
find_package(rostest REQUIRED)
88-
89-
###### Enable Gmock ##########
90-
set(gmock_SOURCE_DIR /usr/src/gmock)
91-
set(gtest_SOURCE_DIR /usr/src/gtest)
92-
set(gtest_INCLUDE_DIR /usr/include/gtest)
93-
include_directories(
94-
${gmock_SOURCE_DIR}/include
95-
${gmock_SOURCE_DIR}
96-
${gmock_SOURCE_DIR}/gtest/include
97-
${gmock_SOURCE_DIR}/gtest
98-
${gtest_INCLUDE_DIR}
99-
${gtest_SOURCE_DIR}
100-
${gtest_SOURCE_DIR}/src
101-
)
102-
103-
# GMock + Catkin need help: https://answers.ros.org/question/199680/catkin-doesnt-play-nice-with-google-mock/
104-
# TODO(build_time): Only build gmock if not already built
105-
add_library(${PROJECT_NAME}_gmock
106-
${gmock_SOURCE_DIR}/src/gmock-all.cc
107-
${gtest_SOURCE_DIR}/src/gtest-all.cc
108-
)
109-
target_link_libraries(${PROJECT_NAME}_gmock pthread)
110-
install(
111-
TARGETS
112-
${PROJECT_NAME}_gmock
113-
LIBRARY DESTINATION
114-
${CATKIN_PACKAGE_LIB_DESTINATION}
115-
RUNTIME DESTINATION
116-
${CATKIN_PACKAGE_BIN_DESTINATION}
117-
)
118-
# Replace catkin variable
119-
set(GTEST_LIBRARIES ${PROJECT_NAME}_gmock)
120-
###### END Enable Gmock ##########
121-
122-
123-
add_rostest_gtest(uart_tests test/uart_tests.test test/uart_tests.cpp)
124-
target_link_libraries(uart_tests
125-
${catkin_LIBRARIES}
126-
${PROJECT_NAME}_uart
127-
${GTEST_LIBRARIES})
128-
129-
add_rostest_gtest(package_manager_tests test/package_manager_tests.test
130-
test/package_manager_tests.cpp
131-
src/PackageManager.cpp)
132-
target_link_libraries(package_manager_tests
133-
${catkin_LIBRARIES}
134-
${GTEST_LIBRARIES}
135-
${PROJECT_NAME}_uart )
100+
# all install targets should use catkin DESTINATION variables
101+
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
136102

137-
endif()
103+
## Mark executable scripts (Python etc.) for installation
104+
## in contrast to setup.py, you can choose the destination
105+
# catkin_install_python(PROGRAMS
106+
# scripts/my_python_script
107+
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
108+
# )
138109

139-
#############
140-
## Install ##
141-
#############
110+
## Mark executables for installation
111+
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
112+
# install(TARGETS ${PROJECT_NAME}_node
113+
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
114+
# )
142115

143116
## Mark libraries for installation
144117
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
145118
install(TARGETS
146-
${PROJECT_NAME}_uart
147-
${PROJECT_NAME}_uart_comms_node
148-
149-
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
150-
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
151-
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
152-
)
119+
${PROJECT_NAME}_node
120+
121+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
122+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
123+
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
124+
)
125+
126+
#############
127+
## Testing ##
128+
#############
129+
130+
## Add gtest based cpp test target and link libraries
131+
# catkin_add_gtest(${PROJECT_NAME}-test test/test_noah_drivers.cpp)
132+
# if(TARGET ${PROJECT_NAME}-test)
133+
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
134+
# endif()
135+
136+
## Add folders to be run by python nosetests
137+
# catkin_add_nosetests(test)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* @file DriversNode.hpp
3+
* @author Gonzalo Cervetti (cervetti.g@gmail.com)
4+
* @brief Provides communication between the hardware PCB and the raspberry.
5+
* @version 0.1
6+
* @date 2020-01-03
7+
*
8+
* @copyright Copyright (c) 2020
9+
*
10+
*/
11+
12+
#pragma once
13+
14+
// Standard libraries
15+
#include <memory>
16+
17+
// ROS libraries
18+
#include "ros/ros.h"
19+
#include "std_msgs/String.h"
20+
21+
// Noah libraries
22+
#include "noah_drivers/PCBBridgeManager.hpp"
23+
24+
namespace noah_drivers {
25+
class DriversNode {
26+
public:
27+
DriversNode();
28+
void chatterCallback(const std_msgs::String::ConstPtr& msg);
29+
int run();
30+
31+
private:
32+
ros::NodeHandle nh_;
33+
ros::Subscriber sub;
34+
ros::Publisher chatter_pub;
35+
std::unique_ptr<PCBBridgeManager> pcb_bridge_manager_;
36+
};
37+
} // namespace noah_drivers

0 commit comments

Comments
 (0)