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

Integrate ToF Sensor, Implement emergency Brake, and repellent field #4

Open
wants to merge 90 commits into
base: wifi-with-cytron
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
a507572
adding potential field node and modifying twist_to_pwm to sub to pote…
ronggurmahendra Jan 31, 2023
358cc26
adding potential field as consideration
ronggurmahendra Feb 3, 2023
4bade8e
disable the dynamic speed and implement only the emergency brake
ronggurmahendra Feb 3, 2023
a61cc99
cahnge the emergencyStopThreshold
ronggurmahendra Feb 3, 2023
fe9a3e8
refactor and remove unnecesarry code
ronggurmahendra Feb 3, 2023
d2a9d44
update README.md
ronggurmahendra Feb 3, 2023
1d44b5a
update README.md
ronggurmahendra Feb 6, 2023
d8f340b
changes so that it consider current speed
ronggurmahendra Feb 6, 2023
5c86e50
deleting a unused file
ronggurmahendra Feb 6, 2023
3a75ac3
implement manual mode
ronggurmahendra Feb 6, 2023
a182f4e
fix bug viewer
ronggurmahendra Feb 6, 2023
5bf5994
fix bug at viewer
ronggurmahendra Feb 6, 2023
adbe730
refactor
ronggurmahendra Feb 6, 2023
942cc71
adding repelent field
ronggurmahendra Feb 6, 2023
e5efc7a
implement repelent field
ronggurmahendra Feb 6, 2023
e876461
editting tof_tes
ronggurmahendra Feb 6, 2023
9bdb4ad
adding unit test
ronggurmahendra Feb 6, 2023
197b61d
adding test file
ronggurmahendra Feb 7, 2023
5c10155
add test file cases
ronggurmahendra Feb 8, 2023
748cf03
refactor : move file to different directories
ronggurmahendra Feb 16, 2023
ada812e
refactor : update readme.md, delete cache
ronggurmahendra Feb 16, 2023
31155ec
refactor : add comment to bash file
ronggurmahendra Feb 16, 2023
7e9d54b
refactor : change file name
ronggurmahendra Feb 16, 2023
73ff751
dev : change to numpy min
ronggurmahendra Feb 16, 2023
9558472
refactor : use function at point cloud callback
ronggurmahendra Feb 16, 2023
7d9e460
dev : change tof.py from publishing Twist to publishing pwm
ronggurmahendra Feb 16, 2023
3960ee3
dev : change tof.py from publishing Twist to publishing pwm
ronggurmahendra Feb 16, 2023
238624a
fix minor bug with viewer
ronggurmahendra Feb 16, 2023
755654c
Debug : ignore NaN in min
ronggurmahendra Feb 16, 2023
a4fb1c3
Refactor : adding comment to the code
ronggurmahendra Feb 17, 2023
fe9119f
adding emergency brake from rosparam
ronggurmahendra Feb 17, 2023
aedd093
restore previous version of twist_to_pwm.py
ronggurmahendra Feb 17, 2023
28c50d2
refactor : remove global variable
ronggurmahendra Feb 17, 2023
61e36d8
refactor : move test file
ronggurmahendra Feb 17, 2023
af7ae5b
DEBUG : change the repelentField usage in testfile and change the sys…
ronggurmahendra Feb 17, 2023
84af085
refactor : adding comment to tof_test.py
ronggurmahendra Feb 17, 2023
40b25f2
edit bash file to not run twist_to_pwm.py
ronggurmahendra Feb 23, 2023
bd32c30
Resolving conflict
ronggurmahendra Feb 23, 2023
051e7a5
Delete src/__pycache__ directory
ronggurmahendra Feb 23, 2023
6406555
Delete software/__pycache__ directory
ronggurmahendra Feb 23, 2023
3da675c
Update README.md
ronggurmahendra Mar 1, 2023
5be0e12
Update README.md
ronggurmahendra Mar 1, 2023
0110972
Update README.md
ronggurmahendra Mar 1, 2023
2adaacc
refactor : requested PRchanges
ronggurmahendra Mar 5, 2023
5e99a2d
rename file to be more appropriate and refactor callback function
ronggurmahendra Mar 10, 2023
88a9f7f
fix the logic
ronggurmahendra Mar 10, 2023
f15a962
fix logic and refactor
ronggurmahendra Mar 13, 2023
3519c60
bug fix and add some additinal funciton to reppelent field
ronggurmahendra Mar 13, 2023
e41d699
delete unused code and uncomment import library
ronggurmahendra Mar 13, 2023
d62ac43
make another twist_to_pwm for the branch(skip a few parameter check) …
ronggurmahendra Mar 14, 2023
ff45f46
adding rotation to point cloud based of the installation
ronggurmahendra Mar 14, 2023
d3d6ab1
debug rotation matrix function bbut disable it since it use too many …
ronggurmahendra Mar 14, 2023
5b666d9
refactor and adding functions to repelent field
ronggurmahendra Mar 17, 2023
efa9bc2
resolving conflict
ronggurmahendra Mar 17, 2023
f7e9df5
debug
ronggurmahendra Mar 17, 2023
06e6c31
adding rear camera
ronggurmahendra Mar 17, 2023
d0386da
adding parameter
ronggurmahendra Mar 17, 2023
679b873
changing the quadratic parameter
ronggurmahendra Mar 17, 2023
b6935e6
delete unnessesarry code
ronggurmahendra Mar 19, 2023
d4f7255
adding another quadratic function
ronggurmahendra Mar 19, 2023
0fad87f
resolve conflict
ronggurmahendra Mar 19, 2023
eabad4e
split assisted navigation to 2 node
ronggurmahendra Mar 19, 2023
8ada88f
adding drive mode as a class, refactor assisted navigation iao and dr…
ronggurmahendra Mar 21, 2023
638f887
change parameter to use somulation and add simulation to bash file
ronggurmahendra Mar 22, 2023
1b0ef7d
change namefile of ToF implementation and add a IR sensor version
ronggurmahendra Apr 5, 2023
398ef70
fix a mistake with output linear
ronggurmahendra Apr 5, 2023
a5ee64f
ir publisher overhaul
ronggurmahendra Apr 5, 2023
1f7ddbf
refactor IRversion of assisted navigation
ronggurmahendra Apr 6, 2023
d9af7dd
change file name ro be more consistent
ronggurmahendra Apr 6, 2023
7e23a16
delete previous impelmentation using ToF and change the IR publisher…
ronggurmahendra Apr 6, 2023
6f17f5a
add a stand alone python script all in one for drive controller
ronggurmahendra Apr 6, 2023
904dfd2
remove unnesesarry code and modify according to IRsensor publisher
ronggurmahendra Apr 7, 2023
b6aa824
fix minor bug
ronggurmahendra Apr 7, 2023
6876bcd
resolving conflict
ronggurmahendra Apr 7, 2023
4d6cadd
change the index
ronggurmahendra Apr 7, 2023
2efcda0
add PMWmin to the final published output of the motor and make a simp…
ronggurmahendra Apr 12, 2023
d0f5537
Merge branch 'an_ToF' of https://github.com/Roboy/esp-wheelchair into…
ronggurmahendra Apr 12, 2023
9d725d8
adding USE_EMERGENCYBRAKE TO A ROSPARAM
ronggurmahendra Apr 12, 2023
fdd0ca6
debug minor typo bug
ronggurmahendra Apr 12, 2023
56af55b
change the USE_EMERGENCY BRAKE to rosparam, minor typo bug fix
ronggurmahendra Apr 12, 2023
b62220a
Change the Assisted drive code to a ROS package
ronggurmahendra Apr 13, 2023
6ed6c3a
adding ir_drive_controller to the executable
ronggurmahendra Apr 13, 2023
ce256c3
do recent changes to ir_drive_controller.py
ronggurmahendra Apr 13, 2023
711cf49
adding simulation model and launch file
ronggurmahendra Apr 14, 2023
ff433c3
add setup.py
ronggurmahendra Apr 14, 2023
5875bcf
Merge branch 'an_ToF' of https://github.com/Roboy/esp-wheelchair into…
ronggurmahendra Apr 14, 2023
5dd50b4
adding assisted_Navigation package
ronggurmahendra Apr 14, 2023
697b6c7
update readme.md
ronggurmahendra Apr 14, 2023
61ad4b7
update reamdme.md
ronggurmahendra Apr 14, 2023
37db21b
update readme.md
ronggurmahendra Apr 14, 2023
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
software/build

/*cache*

**/__pycache__
**/*.swp
**/*.swo
21 changes: 21 additions & 0 deletions scripts/assistedNavigation.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# this script run all the necessary setup to run the assisted navigation program using the teleop keyboard

export ROS_HOSTNAME=192.168.0.114
# if you use other ip for ros master then do “export ROS_MASTER_URI=http://{ROS_MASTER_IP}:11311”
export ROS_MASTER_URI=http://192.168.1.105:11311
python3 ../src/drive_controller.py
python3 ../src/tof_handler.py
python3 ../src/twist_to_pwm.py

#run gazebo world of your choice
roslaunch gazebo_ros shapes_world.launch

# on a new terminal to spawn the robody entity
roslaunch robody_sim spawn.launch
roslaunch robody_sim spawndefault.launch

rosrun gazebo spawn_model -file /home/ronggurmwp/robody_nav_ws/src/robody_sim/urdf/human.urdf -urdf -z 1 -model my_object

rosrun gazebo spawn_model -file "/home/ronggurmwp/robody_nav_ws/src/robody_sim/urdf/human.urdf" -urdf -z 1 -model my_object

rosrun teleop_twist_keyboard teleop_twist_keyboard.py
10 changes: 10 additions & 0 deletions scripts/assistedNavigation_aio.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# this script run all the necessary setup to run the assisted navigation program using the teleop keyboard

export ROS_HOSTNAME=192.168.0.114
# if you use other ip for ros master then do “export ROS_MASTER_URI=http://{ROS_MASTER_IP}:11311”
export ROS_MASTER_URI=http://192.168.1.105:11311
python3 ../src/assistedNavigation_aio.py
python3 ../src/twist_to_pwm.py
rosrun teleop_twist_keyboard teleop_twist_keyboard.py

rosrun teleop_twist_keyboard teleop_twist_keyboard.py
1 change: 0 additions & 1 deletion software/README.md
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

89 changes: 89 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Assisted Navigation

## Prerequisites
- ROS1 Melodic
## Building
1. To start building, first clone the repository using the following command, specifying the "an_ToF" branch:

```
git clone -b an_ToF https://github.com/Roboy/esp-wheelchair.git
```
2. Next, navigate to the "src" folder within the repository.

3. Copy the "assisted_navigation" package to your workspace.

4. Build the workspace using the "catkin_make" command.

5. Finally, source the setup bash file by running the following command:
```
source /devel/setup.sh
```

With these steps, you should be ready to proceed with the build process.

## Running
1. To execute the sensor, you can use either of the following commands:

```
rosrun roboy_state_estimator ir_sensor_publisher.py
```
or

```
rosrun assisted_navigation ir_sensor_publisher.py
```

2. These commands will run the "ir_sensor_publisher.py" script, which is responsible for publishing data from the IR sensor.

3. To launch the middleware, you can use the following command:

```
rosrun assisted_navigation ir_drive_controller.py
```
This will start the middleware module, allowing it to handle the communication and processing of data between different components of the system.

With these commands, you should be able to run the sensor and middleware components of the system as needed.

## Teleop_twist_keyboard
1. Make sure Teleop_twist_keyboard is installed

2. make sure node Ir_drive_controller is running


3. run twist_to_pwm node using the following command
```
rosrun assisted_navigation twist_to_pwm.py
```

4. In another terminal run the teleop node using the following command

```
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
```

Use the instruction in the terminal

## Simulation
1. Make sure Gazebo is installed

2. Make sure USE_SIMULATION is TRUE in the src/ir_drive_controller.py
*if its false then set to true then redo all the building steps

```
USE_SIMULATION = True
```

3. Run Gazebo using the following command
```
gazebo
```
4. Spawn the robot using the following command

```
roslaunch assisted_navigation spawn.launch
```

Use the teleop or joystick to control the robot



217 changes: 217 additions & 0 deletions src/assisted_navigation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
cmake_minimum_required(VERSION 3.0.2)
project(assisted_navigation)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
gazebo_ros
geometry_msgs
roscpp
rospy
std_msgs
urdf
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# geometry_msgs# std_msgs
# )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES assisted_navigation
# CATKIN_DEPENDS gazebo_ros geometry_msgs roscpp rospy std_msgs urdf
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${catkin_INCLUDE_DIRS}
)

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

## 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
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## 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/assisted_navigation_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# catkin_install_python(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
catkin_install_python(PROGRAMS
src/ir_drive_controller.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
catkin_install_python(PROGRAMS
src/twist_to_pwm.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_assisted_navigation.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
17 changes: 17 additions & 0 deletions src/assisted_navigation/launch/rviz.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<launch>

<param name="robot_description" command="cat '$(find robody_sim)/urdf/robody.xacro'"/>

<!-- send fake joint values -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<param name="use_gui" value="False"/>
</node>

<!-- Combine joint values -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>

<!-- Show in Rviz -->
<node name="rviz" pkg="rviz" type="rviz" />

</launch>
12 changes: 12 additions & 0 deletions src/assisted_navigation/launch/spawn.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<launch>

<param name="robot_description" command="cat '$(find robody_sim)/urdf/m2wr.xacro'"/>

<arg name="x" default="3"/>
<arg name="y" default="0"/>
<arg name="z" default="0.5"/>

<node name="robody_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
args="-urdf -param robot_description -model robody -x $(arg x) -y $(arg y) -z $(arg z)"/>
</launch>
12 changes: 12 additions & 0 deletions src/assisted_navigation/launch/spawndefault.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<launch>

<param name="robot_description" command="cat '$(find robody_sim)/urdf/m2wr.xacro'"/>

<arg name="x" default="3"/>
<arg name="y" default="0"/>
<arg name="z" default="0.5"/>

<node name="m2wr_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
args="-urdf -param robot_description -model m2wr -x $(arg x) -y $(arg y) -z $(arg z)"/>
</launch>
Loading