diff --git a/ros_ws/src/arudino/razor-9dof-ahrs b/ros_ws/src/arudino/razor-9dof-ahrs new file mode 160000 index 0000000..f20eea9 --- /dev/null +++ b/ros_ws/src/arudino/razor-9dof-ahrs @@ -0,0 +1 @@ +Subproject commit f20eea9d70f92035607a6953e8a6d61cf4d6b790 diff --git a/ros_ws/src/common/config.cpp b/ros_ws/src/common/config.cpp index 1da3e3d..9813d97 100644 --- a/ros_ws/src/common/config.cpp +++ b/ros_ws/src/common/config.cpp @@ -55,14 +55,19 @@ ConfigValues initConfigs() { ROS_ERROR("max_ang_vel is not defined on the parameter server"); } + //controller mapping get_int_param("/lin_vel_axis", config.lin_vel_axis); get_int_param("/ang_vel_axis", config.ang_vel_axis); + get_int_param("conveyor_speed_forward", config.conveyor_speed_forward); + get_int_param("conveyor_speed_back", config.conveyor_speed_back); get_int_param("/teleop_btn", config.teleop_btn); get_int_param("/standby_btn", config.standby_btn); get_int_param("/autonomous_btn", config.autonomous_btn); get_int_param("/speed_inc_btn", config.speed_inc_btn); get_int_param("/speed_dec_btn", config.speed_dec_btn); + get_int_param("/actuator_up", config.actuator_up); + get_int_param("/actuator_down", config.actuator_down); return config; } diff --git a/ros_ws/src/common/config.h b/ros_ws/src/common/config.h index 9630c93..5d3d1a8 100644 --- a/ros_ws/src/common/config.h +++ b/ros_ws/src/common/config.h @@ -29,14 +29,16 @@ double max_ang_vel; std::string controller_type; int lin_vel_axis; int ang_vel_axis; +int conveyor_speed_forward; +int conveyor_speed_back; int teleop_btn; int standby_btn; int autonomous_btn; int speed_inc_btn; int speed_dec_btn; int turbo_btn; - - +int actuator_up; +int actuator_down; }; ConfigValues initConfigs(); void get_int_param(std::string key_name, int & config_var); diff --git a/ros_ws/src/control/include/control/remote_control.h b/ros_ws/src/control/include/control/remote_control.h index c5a8de9..3efb325 100644 --- a/ros_ws/src/control/include/control/remote_control.h +++ b/ros_ws/src/control/include/control/remote_control.h @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include "constants.h" class RemoteControl @@ -27,6 +29,15 @@ class RemoteControl */ geometry_msgs::Twist cmd_vel; + /** + * @brief The speed at which the actuators will run + * + * The actuators will curently work using 1 as up -1 as down and 0 as hold + */ + std_msgs::Int8 actuator_speed; + + std_msgs::Float64 conveyor_speed; + /** * @brief The twist publisher * @@ -34,6 +45,17 @@ class RemoteControl * robot's motor controllers. */ ros::Publisher twist_pub; + + /** + * @brief The actuator publisher + * + * This ros publisher will be responsible for publishing the actuator message which will tell the actuators to go up + * or down. + */ + ros::Publisher actuator_pub; + + ros::Publisher conveyor_pub; + /** * @brief The joy message subscriber * @@ -41,6 +63,7 @@ class RemoteControl * is being used. */ ros::Subscriber joy_sub; + /** * @brief The ros node handle */ diff --git a/ros_ws/src/control/param/controllers/360.yaml b/ros_ws/src/control/param/controllers/360.yaml index 2f59614..f90cc77 100644 --- a/ros_ws/src/control/param/controllers/360.yaml +++ b/ros_ws/src/control/param/controllers/360.yaml @@ -11,17 +11,26 @@ #BACK_BUTTON: 6 #START_BUTTON: 7 #POWER_BUTTON: 8 +#UP_DPAD: 13 +#DOWN_DPAD: 14 +#RIGHT_DPAD: 12 +#LEFT_DPAD: 11 -controller_type: xbox360 +controller_type: xbox360 -lin_vel_axis: 1 -ang_vel_axis: 3 -teleop_btn: 0 -standby_btn: 1 +lin_vel_axis: 1 +ang_vel_axis: 3 +conveyor_speed_forward: 5 +conveyor_speed_back: 2 +teleop_btn: 0 +standby_btn: 1 -autonomous_btn: 3 -speed_inc_btn: 5 -speed_dec_btn: 4 -turbo_btn: 2 +autonomous_btn: 3 +speed_inc_btn: 5 +speed_dec_btn: 4 +turbo_btn: 2 + +actuator_up: 13 +actuator_down: 14 diff --git a/ros_ws/src/control/src/control/remote_control.cpp b/ros_ws/src/control/src/control/remote_control.cpp index 60fc62f..fb059d2 100644 --- a/ros_ws/src/control/src/control/remote_control.cpp +++ b/ros_ws/src/control/src/control/remote_control.cpp @@ -23,6 +23,8 @@ RemoteControl::RemoteControl() joy_sub = nh.subscribe(JOY_TOPIC, 1, &RemoteControl::joyCallback, this); twist_pub = nh.advertise(TELEOP_TOPIC, 1); + actuator_pub = nh.advertise("dump_activate", 1); + conveyor_pub = nh.advertise("conveyor_vel", 1); } RemoteControl::RemoteControl(std::string twist_topic, std::string joy_topic) @@ -45,7 +47,6 @@ RemoteControl::RemoteControl(std::string twist_topic, std::string joy_topic) void RemoteControl::joyCallback(const sensor_msgs::Joy::ConstPtr& msg) { - if ((msg->buttons[config.speed_inc_btn] == 1) && (speed_modifier < 1)) { speed_modifier += 0.01; @@ -56,9 +57,31 @@ void RemoteControl::joyCallback(const sensor_msgs::Joy::ConstPtr& msg) } cmd_vel.linear.x = msg->axes[config.lin_vel_axis] * speed_modifier; cmd_vel.angular.z = msg->axes[config.ang_vel_axis]; + + if((-msg->axes[config.conveyor_speed_forward] + 1) / 2 > 0) + conveyor_speed.data = (-msg->axes[config.conveyor_speed_forward] + 1) / 2; + else if((-msg->axes[config.conveyor_speed_back] + 1) / 2 > 0) + conveyor_speed.data = -(-msg->axes[config.conveyor_speed_back] + 1) / 2; + else + conveyor_speed.data = 0; + + if(msg->buttons[config.actuator_up]) + { + actuator_speed.data = 1; + } + else if(msg->buttons[config.actuator_down]) + { + actuator_speed.data = -1; + } + else + { + actuator_speed.data = 0; + } } void RemoteControl::update() { twist_pub.publish(cmd_vel); + actuator_pub.publish(actuator_speed); + conveyor_pub.publish(conveyor_speed); } diff --git a/ros_ws/src/navigation/include/navigation/navigation.h b/ros_ws/src/navigation/include/navigation/navigation.h new file mode 100644 index 0000000..321a12f --- /dev/null +++ b/ros_ws/src/navigation/include/navigation/navigation.h @@ -0,0 +1,14 @@ +// +// Created by matt on 1/5/16. +// + +#ifndef PROJECT_NAVIGATION_H +#define PROJECT_NAVIGATION_H + + +class Navigation { + +}; + + +#endif //PROJECT_NAVIGATION_H diff --git a/ros_ws/src/navigation/src/navigation/navigation.cpp b/ros_ws/src/navigation/src/navigation/navigation.cpp new file mode 100644 index 0000000..724fa22 --- /dev/null +++ b/ros_ws/src/navigation/src/navigation/navigation.cpp @@ -0,0 +1,5 @@ +// +// Created by matt on 1/5/16. +// + +#include "navigation.h" diff --git a/ros_ws/src/navigation/src/navigation/navigation_node.cpp b/ros_ws/src/navigation/src/navigation/navigation_node.cpp new file mode 100644 index 0000000..e69de29