Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autonomous state machine #94

Open
wants to merge 138 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
a624cfa
Refactored gps_testing.py. Moved moving average to a class,
ajcarney Oct 31, 2023
10e98c8
Kinda working lidar
Balabalu-VE Nov 9, 2023
156d74f
Updated simulation rviz,shows rovot and works with coordinates
Balabalu-VE Nov 21, 2023
25f08a6
Added circle to rVIZ
MousyYaya Nov 21, 2023
a09d5f3
Angled lines worked in rviz. Still need to implement rotational trans…
Balabalu-VE Nov 28, 2023
910af95
Finished kinda
Balabalu-VE Dec 7, 2023
a1effba
Made the flag move, need to make flag
MousyYaya Dec 7, 2023
c83974e
Added the flag :D
MousyYaya Dec 8, 2023
1e2480f
changed launch pointers so that the rplidar will start working, uses …
Dec 8, 2023
49cccf9
Merge branch 'testing-lidar' of github.com:WisconsinRobotics/WRover_S…
Dec 8, 2023
6d63349
build: Add ublox ROS driver to project.json dependencies
co-li Jan 30, 2024
b867a9a
toss some rtk configs together
LetianLi Jan 30, 2024
0e51a1c
Launch files will start with long range and target coords are fixed t…
Feb 8, 2024
50003f2
Add node for publishing ROS topic from RTK GNSS
LetianLi Feb 13, 2024
b26874e
feat: BNO085 IMU bring up
co-li Feb 18, 2024
838370f
feat: Get magnetometer readings from IMU
co-li Feb 18, 2024
d7ebb16
Updated gps_testing node to include new node that interfaces with ROS…
ajcarney Feb 20, 2024
2fce069
Add launch documentation
LetianLi Feb 20, 2024
b0a785d
Add mapviz
LetianLi Feb 20, 2024
df807a8
Merge branch 'feature/dgnss_updates' of github.com:WisconsinRobotics/…
LetianLi Feb 20, 2024
d23bc45
feat: Add heading data publisher
co-li Feb 22, 2024
05ef6b4
feat: publish accuracy values
co-li Feb 22, 2024
5381f74
changed how we grab env parameters and launch files
Feb 23, 2024
87fbc7e
feat: Publish game rotation vector
co-li Feb 23, 2024
d955ab0
add changes
jkira1 Feb 23, 2024
579f54f
Merge branch 'testing-lidar' into testing_imu_autonomous
co-li Feb 23, 2024
8e51be6
estimating distance using measured focal length - may need tuning
smishra248 Feb 24, 2024
d64d303
cleaning up testing stuff for distance estimate
smishra248 Feb 24, 2024
e062772
adding the function to edit the live image
smishra248 Feb 24, 2024
5a7005e
finished the function to isolate the aruco tag on live feed
smishra248 Feb 24, 2024
a2b99ea
Update vision launch files
co-li Feb 24, 2024
d97791f
Use parameters from wr_logic_ai/config/vision_params.yaml
co-li Feb 24, 2024
5ee6242
Testing lidar on hardware
co-li Feb 27, 2024
bf4e6bc
Handle IMU resets
co-li Feb 27, 2024
9bc527f
simplify drive logic
co-li Feb 27, 2024
cb06215
Fixes for launching shortrange logic
co-li Feb 29, 2024
3099b47
Add video output for debugging
co-li Feb 29, 2024
795afc6
Rename rtk files
LetianLi Feb 23, 2024
374e573
updated README
ajcarney Feb 27, 2024
766ba4e
Update comments/document code
ksha23 Mar 8, 2024
9a16b81
Update wr_hsi_sensing readme
ksha23 Mar 8, 2024
a52fabb
Clarify README
ksha23 Mar 8, 2024
8e28108
Update README
ksha23 Mar 8, 2024
9d6e5e7
rename nodes
ksha23 Mar 13, 2024
26f4e70
update launch files to launch dependent nodes
ksha23 Mar 13, 2024
59b13b7
delete old launch file
ksha23 Mar 13, 2024
e8ff00b
remove extra debug logging
ksha23 Mar 13, 2024
3e4fac1
revise dependency declarations
ksha23 Mar 13, 2024
861187c
remove build instructions in readme
ksha23 Mar 13, 2024
76dd7b9
Merge branch into autonomous_state_machine
Tzanccc Mar 14, 2024
6547c83
Cleaning up unused code
Tzanccc Mar 18, 2024
6173755
Restructued obstacle_avoidance to seperate receiving lidar data with …
Tzanccc Mar 19, 2024
31ff25b
Refactored code to remove mux
Tzanccc Mar 20, 2024
0356c81
Merge branch 'master' into current branch
Tzanccc Apr 1, 2024
ecfe9af
Added new autonomous packages
Tzanccc Apr 2, 2024
391aa19
Restructured action messages to use new packages
Tzanccc Apr 3, 2024
88c57cb
Restructured services
Tzanccc Apr 3, 2024
59c4b4a
Moved
Tzanccc Apr 3, 2024
60c6d15
Refactored messages
Tzanccc Apr 3, 2024
80a9a31
Restructured wr_logic_longrange
Tzanccc Apr 4, 2024
699b771
Restructued wr_logic_search
Tzanccc Apr 4, 2024
f682766
Added __init__.py
Tzanccc Apr 4, 2024
c67c319
Fixed doxygen documentation
Tzanccc Apr 5, 2024
aab4699
Wrote the README file for Search Pattern.
rusmilov Apr 5, 2024
c17df46
Remove an unused variable from a previous implementation.
rusmilov Apr 5, 2024
98c1d8a
Move shortrange code
co-li Apr 7, 2024
fb550e2
Merge branch 'pose_detect' into autonomous_state_machine
co-li Apr 7, 2024
2d75bf8
Fixed incorrect function names in the comments.
rusmilov Apr 8, 2024
1c1119b
Removed goal variable for distance because not needed in StateMachine…
rusmilov Apr 9, 2024
059261a
Removed repeated Search Pattern functions. Moved iteration from State…
rusmilov Apr 9, 2024
8a9a687
Renamed Goal variables from target_* to start_* since they will only …
rusmilov Apr 9, 2024
6f0db18
Created the launch file for testing Search Pattern.
rusmilov Apr 11, 2024
b526e10
Created a basic subscriber node for a placeholder topic that is publi…
rusmilov Apr 12, 2024
b5d5a83
Added lines that call the camera subscriber, but it is commented out …
rusmilov Apr 12, 2024
f9e496e
Initial incomplete implementation of smach state machine
Tzanccc Apr 16, 2024
689e77b
Actually commiting files
Tzanccc Apr 16, 2024
b814c88
Added comments to camera_sub.py, the Subscriber node to the placehold…
rusmilov Apr 17, 2024
38f9139
Added comment about not needing search_pattern_client.py and search_p…
rusmilov Apr 17, 2024
efaa426
Pretty sure I fixed the flow of the while loops, but I need to figure…
rusmilov Apr 18, 2024
d0619ca
Simplify shortrange action server
co-li Apr 18, 2024
322c431
Simplified the flow of iterating through the target coordinates so th…
rusmilov Apr 19, 2024
22eeb27
Merge branch 'master' into autonomous_state_machine
Tzanccc Apr 21, 2024
668f79d
Added states for search and short range
Tzanccc Apr 21, 2024
5ee7588
Removed unnecessary outputting to terminal line.
rusmilov Apr 23, 2024
d4feb19
Started working on the Subscriber to the gps_coord_data topic. Commen…
rusmilov Apr 23, 2024
bbd1bc0
Replacing old state machine code
Tzanccc Apr 25, 2024
2dcfc30
Made comments. Put the correct message type. Removed class. Calling i…
rusmilov Apr 26, 2024
4f12585
Fixed iteration flow. Only having one while loop didn't work with the…
rusmilov Apr 26, 2024
b977278
Adding setup.py to wr_logic_search
Tzanccc Apr 26, 2024
29a1b6b
Updated cmakelists
Tzanccc Apr 26, 2024
1e649c1
State machine inital tesing and debugging
Tzanccc Apr 26, 2024
674119e
Updating launch file for testing state machine
Tzanccc Apr 26, 2024
25d8749
Visualize in mapviz, not tested
Balabalu-VE Jun 1, 2024
44582fd
Merging autonomous navigation code into newer code (Spring 2024) (#92)
Balabalu-VE May 15, 2024
0781291
Implemented state machine with long range and init compass
Balabalu-VE May 15, 2024
f4088ba
added logic to init_compass in state machine
Balabalu-VE May 15, 2024
ad0e44e
testing changes
co-li May 15, 2024
aed8ff8
Mispelled a word
Balabalu-VE May 15, 2024
7ee3a5c
still typo
Balabalu-VE May 15, 2024
3b9c74c
Anothe type
Balabalu-VE May 15, 2024
f6ea6cf
Refactor wait_for_user_input.py into an ActionServer
co-li May 16, 2024
d910bce
Add action definitions for wr_logic_ai
co-li May 16, 2024
6f41fd7
Arm testing
co-li May 19, 2024
2916e0c
Disable solenoid GPIO, needs to be rewritten for Jetson
co-li May 19, 2024
ea86f26
Map roboclaw port
co-li May 20, 2024
498441f
Add video streaming for debugging
co-li May 20, 2024
f81508e
Add ffmpeg streaming to debug vision
co-li May 20, 2024
f37626f
fix ffmpeg parameters
co-li May 20, 2024
7cc4f90
Update Jetson IP address
co-li May 21, 2024
e4960db
Add shortrange action client for testing
co-li May 21, 2024
689abb5
Tune shortrange navigation turn factor
co-li May 21, 2024
97eff07
Fix up search pattern code
co-li May 22, 2024
e8c638e
Add action clients to test the search pattern
co-li May 23, 2024
5002c32
Tested SpinActionServer
co-li May 23, 2024
0afe82e
Test search pattern
co-li May 23, 2024
8d806a7
Fixes from testing search pattern
co-li May 24, 2024
d473caf
Add object detection node
co-li May 24, 2024
8f40078
Use TensorRT model
co-li May 24, 2024
e3f5635
Tune arm speeds
co-li May 25, 2024
59f601d
Fix wrist roll direction
co-li May 25, 2024
b2f7d02
Update state machine launch file
co-li May 25, 2024
d2c2a9d
Lower autonomous navigation speeds
co-li May 25, 2024
c7def24
Added wait for /scan
Balabalu-VE May 27, 2024
a2afd81
Update state machine logic for abort/preempt states
co-li May 29, 2024
1c2ab1c
Downgrade numpy for TensorRT
co-li May 30, 2024
0a78d3b
Add mapproxy config
co-li May 30, 2024
5b37784
Use roboclaw to drive solenoid
co-li May 31, 2024
505d653
Add yolo node
co-li May 31, 2024
f25709b
Cam mast controls moved
co-li May 31, 2024
78b02a2
Add cam mast control
co-li May 31, 2024
d8d22cb
Latest changes before comp
co-li May 31, 2024
f54efb8
Changed coordinate generation for search pattern
Balabalu-VE May 31, 2024
b899296
Added JSON for testing
co-li May 31, 2024
6450693
Add logging
co-li May 31, 2024
7204261
Fix shortrange action server
co-li Jun 1, 2024
3c5d3cb
Add arm speed adjustment
co-li Jun 1, 2024
6e82352
Testing for Mapviz
Balabalu-VE Jun 1, 2024
458c634
Added visualizing points in mapviz
co-li Jun 1, 2024
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
1 change: 1 addition & 0 deletions .catkin_workspace
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# This file currently only serves to mark the location of a catkin workspace for tool integration

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "src/wrevolution"]
path = src/wrevolution
url = https://github.com/WisconsinRobotics/wrevolution
[submodule "src/wr_hsi_sensing/src/sh2"]
path = src/wr_hsi_sensing/sh2
url = https://github.com/ceva-dsp/sh2
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
],
"python.analysis.extraPaths": [
"./src/wr_hsi_sensing/src",
"./src/wr_logic_ai/src"
"./src/wr_logic_ai/src",
"./src/wr_logic_shortrange/src"
],
"C_Cpp.intelliSenseEngine": "disabled",
"cmake.sourceDirectory": "${workspaceFolder}/src",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
}
9 changes: 8 additions & 1 deletion project.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@
"package": "ros-noetic-mapviz",
"provider": "apt"
}
},
{
"name": "smach",
"build": {
"package": "ros-noetic-smach-ros",
"provider": "apt"
}
}
]
}
}
2 changes: 1 addition & 1 deletion src/wr_control_drive_ds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
wr_drive_msgs
wroboclaw
#wroboclaw
)

## System dependencies are found with CMake's conventions
Expand Down
19 changes: 16 additions & 3 deletions src/wr_hsi_sensing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project(wr_hsi_sensing)
find_package(catkin REQUIRED COMPONENTS
message_generation
std_msgs
roscpp
rospy
ublox_gps
)
Expand Down Expand Up @@ -123,14 +124,25 @@ catkin_package(
## Your package locations should be listed before other locations
include_directories(
# include
sh2
${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/wr_hsi_sensing.cpp
# add_library(sh2
# # src/${PROJECT_NAME}/wr_hsi_sensing.cpp
# )

add_library(${PROJECT_NAME}
sh2/euler.c
sh2/sh2_SensorValue.c
sh2/sh2_util.c
sh2/sh2.c
sh2/shtp.c
src/BNO085_hal.cpp
)
# target_link_libraries(${PROJECT_NAME} sh2)

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
Expand All @@ -139,7 +151,8 @@ ${catkin_INCLUDE_DIRS}
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/wr_hsi_sensing_node.cpp)
add_executable(BNO085_IMU src/BNO085_IMU.cpp)
target_link_libraries(BNO085_IMU ${catkin_LIBRARIES} ${PROJECT_NAME})

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
Expand Down
1 change: 1 addition & 0 deletions src/wr_hsi_sensing/sh2
Submodule sh2 added at b514b1
102 changes: 102 additions & 0 deletions src/wr_hsi_sensing/src/BNO085_IMU.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#include "BNO085_hal.hpp"

#include "ros/console.h"
#include "ros/init.h"
#include "ros/node_handle.h"
#include "ros/publisher.h"
#include "ros/rate.h"
#include "std_msgs/Float64.h"
#include "std_msgs/Int16.h"
#include <cstdlib>
#include <iostream>

static constexpr uint32_t QUEUE_SIZE = 1;

const bool debug = true;
BNO085 sensor(debug);

void sensor_setup() {
// if (sensor.set_sensor_config(SH2_MAGNETIC_FIELD_UNCALIBRATED) != SH2_OK) {
// ROS_FATAL("FAILED TO ENABLE MAGNETIC FIELD");
// }

// if (sensor.set_sensor_config(SH2_MAGNETIC_FIELD_CALIBRATED) != SH2_OK) {
// ROS_FATAL("FAILED TO ENABLE MAGNETIC FIELD CALIBRATED");
// }

if (sensor.set_sensor_config(SH2_GAME_ROTATION_VECTOR) != SH2_OK) {
ROS_FATAL("FAILED TO ENABLE IMU GAME ROTATION VECTOR");
}
}

auto main(int argc, char **argv) -> int {

// Initialize the node in ROS
ros::init(argc, argv, "BNO085");

// Create a node handle for the current node to subscribe to/advertise topics
ros::NodeHandle nHandle;

ros::Rate rate(10);

// Create publishers
auto pub_x{nHandle.advertise<std_msgs::Float64>("/mag_x", QUEUE_SIZE)};
auto pub_y{nHandle.advertise<std_msgs::Float64>("/mag_y", QUEUE_SIZE)};
auto pub_z{nHandle.advertise<std_msgs::Float64>("/mag_z", QUEUE_SIZE)};
auto pub_acc{nHandle.advertise<std_msgs::Int16>("/mag_acc", QUEUE_SIZE)};

auto pub_heading{nHandle.advertise<std_msgs::Float64>("/heading_data", QUEUE_SIZE)};

// Initalize IMU
// nHandle.getParam("imu/debug", debug);
if (!sensor.begin()) {
ROS_FATAL("FAILED TO INITIALIZE IMU");
}

sensor_setup();

if (!sensor.tare(true, SH2_TARE_BASIS_GAMING_ROTATION_VECTOR)) {
ROS_WARN("FAILED TO TARE IMU GAME ROTATION VECTOR");
} else {
if (!sensor.persist_tare()) {
ROS_WARN("IMU TARE WILL CHANGE ON NEXT RESET");
}
}
sensor.tare(false, SH2_TARE_BASIS_GAMING_ROTATION_VECTOR);


std_msgs::Float64 mag_x, mag_y, mag_z, heading;
std_msgs::Int16 mag_acc;
while (ros::ok()) {
if (sensor.get_sensor_event()) {

// if (sensor.sensor_value.sensorId == SH2_MAGNETIC_FIELD_CALIBRATED) {
// mag_x.data = sensor.get_mag_x();
// pub_x.publish(mag_x);

// mag_y.data = sensor.get_mag_y();
// pub_y.publish(mag_y);

// mag_z.data = sensor.get_mag_z();
// pub_z.publish(mag_z);

// mag_acc.data = static_cast<int16_t>(sensor.get_accuracy());
// pub_acc.publish(mag_acc);
// }

if (sensor.get_reset()) {
sensor_setup();
}

if (sensor.sensor_value.sensorId == SH2_GAME_ROTATION_VECTOR) {
// Convert Euler angle to 0 to 360
heading.data = (sensor.get_yaw() + M_PI) / M_PI * 180;
pub_heading.publish(heading);
}
}

rate.sleep();
}

return EXIT_SUCCESS;
}
Loading