-
Notifications
You must be signed in to change notification settings - Fork 2
New science board over CAN #187
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
80f3b5e
New science board over CAN
codeflight1 31c17e9
Testing
CPRTSoftwareLead b2938fb
first-pass polarimeter support
codeflight1 6bbcb78
New joystick
codeflight1 0537167
Cleanup
codeflight1 50e9179
cleanup pt.2
codeflight1 e25b23b
move python nodes to separate package
codeflight1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0"?> | ||
| <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
| <package format="3"> | ||
| <name>science_python</name> | ||
| <version>0.0.0</version> | ||
| <description>Nodes for science sensors</description> | ||
| <maintainer email="aj01cars@outlook.com">aydan</maintainer> | ||
| <license>TODO: License declaration</license> | ||
|
|
||
| <depend>rclpy</depend> | ||
| <depend>interfaces</depend> | ||
| <depend>std_msgs</depend> | ||
|
|
||
| <test_depend>ament_copyright</test_depend> | ||
| <test_depend>ament_flake8</test_depend> | ||
| <test_depend>ament_pep257</test_depend> | ||
| <test_depend>python3-pytest</test_depend> | ||
|
|
||
| <export> | ||
| <build_type>ament_python</build_type> | ||
| </export> | ||
| </package> |
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [develop] | ||
| script_dir=$base/lib/science_python | ||
| [install] | ||
| install_scripts=$base/lib/science_python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| from setuptools import find_packages, setup | ||
| import os | ||
| from glob import glob | ||
|
|
||
| package_name = "science_python" | ||
|
|
||
| setup( | ||
| name=package_name, | ||
| version="0.0.0", | ||
| packages=find_packages( | ||
| include=["science_python", "science_python.*"], exclude=["test"] | ||
| ), | ||
| include_package_data=True, | ||
| data_files=[ | ||
| ("share/ament_index/resource_index/packages", ["resource/" + package_name]), | ||
| ("share/" + package_name, ["package.xml"]), | ||
| ( | ||
| os.path.join("share", package_name, "launch"), | ||
| glob(os.path.join("launch", "*launch.[pxy][yma]*")), | ||
| ), | ||
| ], | ||
| install_requires=["setuptools"], | ||
| zip_safe=True, | ||
| maintainer="aydan", | ||
| maintainer_email="aj01cars@outlook.com", | ||
| description="Nodes for science sensors", | ||
| license="TODO: License declaration", | ||
| entry_points={ | ||
| "console_scripts": [ | ||
| "panoramic = science_python.panoramic:main", | ||
| ], | ||
| }, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| cmake_minimum_required(VERSION 3.5) | ||
| project(science_sensors LANGUAGES CXX) | ||
|
|
||
| if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| add_compile_options(-Wall -Wextra -Wpedantic) | ||
| endif() | ||
|
|
||
| # find dependencies | ||
| find_package(ament_cmake REQUIRED) | ||
| find_package(rclcpp REQUIRED) | ||
| find_package(interfaces REQUIRED) | ||
|
|
||
| include_directories( | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/../ros_odrive/odrive_base/include | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
| ) | ||
|
|
||
| add_executable(${PROJECT_NAME} | ||
| "../ros_odrive/odrive_base/src/epoll_event_loop.cpp" | ||
| "../ros_odrive/odrive_base/src/socket_can.cpp" | ||
| "src/science_node.cpp" | ||
| "src/main.cpp" | ||
| ) | ||
| ament_target_dependencies(${PROJECT_NAME} | ||
| "rclcpp" | ||
| "interfaces" | ||
| ) | ||
|
|
||
| # Install Components | ||
| install(TARGETS ${PROJECT_NAME} | ||
| ARCHIVE DESTINATION lib | ||
| LIBRARY DESTINATION lib | ||
| RUNTIME DESTINATION lib/${PROJECT_NAME}) | ||
|
|
||
| # Install headers | ||
| install( | ||
| DIRECTORY include/ | ||
| DESTINATION include | ||
| ) | ||
|
|
||
| ament_export_include_directories( | ||
| include/ | ||
| ) | ||
| ament_export_libraries( | ||
| ${PROJECT_NAME} | ||
| ) | ||
|
|
||
| ament_package() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #ifndef SCIENCE_SENSORS_HPP | ||
| #define SCIENCE_SENSORS_HPP | ||
|
|
||
| #include <condition_variable> | ||
| #include <mutex> | ||
| #include <rclcpp/rclcpp.hpp> | ||
| #include <std_msgs/msg/u_int16.hpp> | ||
|
|
||
| #include "epoll_event_loop.hpp" | ||
| #include "interfaces/msg/dht22.hpp" | ||
| #include "interfaces/msg/polarimeter_sweep.hpp" | ||
| #include "interfaces/msg/science_adc.hpp" | ||
| #include "interfaces/msg/science_motor.hpp" | ||
| #include "interfaces/msg/science_servo.hpp" | ||
| #include "interfaces/srv/run_polarimeter.hpp" | ||
| #include "socket_can.hpp" | ||
|
|
||
| #define SCAN_STEPS 48 | ||
|
|
||
| class ScienceNode : public rclcpp::Node { | ||
| public: | ||
| ScienceNode(const std::string name, | ||
| const rclcpp::NodeOptions &options = rclcpp::NodeOptions()); | ||
| bool init(EpollEventLoop *event_loop); | ||
| void deinit(); | ||
|
|
||
| private: | ||
| void recv_callback(const can_frame &frame); | ||
| void motor_callback(); | ||
| void servo_callback(); | ||
| void polar_callback( | ||
| const std::shared_ptr<interfaces::srv::RunPolarimeter::Request> request, | ||
| std::shared_ptr<interfaces::srv::RunPolarimeter::Response> response); | ||
| void request_polar(); | ||
|
|
||
| inline bool verify_length(const std::string &name, uint8_t expected, | ||
| uint8_t length); | ||
|
|
||
| uint16_t node_id_; | ||
| SocketCanIntf can_intf_ = SocketCanIntf(); | ||
|
|
||
| rclcpp::Publisher<interfaces::msg::ScienceADC>::SharedPtr adc_pub_; | ||
| rclcpp::Publisher<interfaces::msg::DHT22>::SharedPtr temp_pub_; | ||
| rclcpp::Publisher<std_msgs::msg::UInt16>::SharedPtr co2_pub_; | ||
| rclcpp::Publisher<interfaces::msg::PolarimeterSweep>::SharedPtr polar_pub_; | ||
|
|
||
| EpollEvent motor_evt_; | ||
| std::mutex motor_mutex_; | ||
| interfaces::msg::ScienceMotor motor_msg_ = interfaces::msg::ScienceMotor(); | ||
| rclcpp::Subscription<interfaces::msg::ScienceMotor>::SharedPtr motor_sub_; | ||
|
|
||
| EpollEvent servo_evt_; | ||
| std::mutex servo_mutex_; | ||
| interfaces::msg::ScienceServo servo_msg_ = interfaces::msg::ScienceServo(); | ||
| rclcpp::Subscription<interfaces::msg::ScienceServo>::SharedPtr servo_sub_; | ||
|
|
||
| EpollEvent req_polar_evt_; | ||
| std::condition_variable polar_cond_; | ||
| std::mutex polar_mutex_; | ||
| rclcpp::Service<interfaces::srv::RunPolarimeter>::SharedPtr polar_srv_; | ||
| uint16_t polar_points_[SCAN_STEPS]; | ||
| uint8_t polar_index_; | ||
| }; | ||
|
|
||
| #endif // SCIENCE_SENORS_HPP |
14 changes: 0 additions & 14 deletions
14
src/HW-Devices/science_sensors/launch/can_module_reader.launch.py
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/HW-Devices/science_sensors/launch/gas_sensor.launch.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.