-
Notifications
You must be signed in to change notification settings - Fork 61
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
Joystick #273
Joystick #273
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job overall - thanks! Minor changes requested before we can merge.
.vscode/c_cpp_properties.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't include any .vscode file
crazyflie/config/teleop.yaml
Outdated
duration: 1.0 | ||
height: 0.25 | ||
button: 6 # 7 start | ||
land_paras: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
land:
crazyflie/config/teleop.yaml
Outdated
button: 6 # 7 start | ||
land_paras: | ||
button: 7 # 6 back | ||
emergency_paras: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emergency
crazyflie/launch/launch.py
Outdated
('notify_setpoints_stop', 'cf6/notify_setpoints_stop'), | ||
('takeoff', 'all/takeoff'), | ||
('land', 'all/land'), | ||
('cmd_vel_legacy', 'all/cmd_vel_legacy'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those two should not be changed to all.
crazyflie/src/teleop.cpp
Outdated
request->height = 0.5; | ||
request->duration = rclcpp::Duration::from_seconds(2); | ||
request->height = takeoff_paras_.height; | ||
request->duration = rclcpp::Duration::from_seconds(takeoff_paras_.duration); | ||
client_takeoff_->async_send_request(request); | ||
|
||
timer_takeoff_ = this->create_wall_timer(2s, [this]() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 2s also needs to be changed
crazyflie/src/teleop.cpp
Outdated
client_takeoff_->async_send_request(request); | ||
|
||
timer_takeoff_ = this->create_wall_timer(2s, [this]() { | ||
state_.z = 0.5; | ||
state_.z = takeoff_paras_.height; // Is here right? should I change the 2s in line 293 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is correct, and yes, the 2s also need to be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great - thanks! I'll merge once the CI is happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing: please use as default values the ones we had before for the button mapping, otherwise users will be very surprised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a compiler error, see comments.
crazyflie/src/teleop.cpp
Outdated
client_takeoff_->async_send_request(request); | ||
|
||
timer_takeoff_ = this->create_wall_timer(2s, [this]() { | ||
state_.z = 0.5; | ||
timer_takeoff_ = this->create_wall_timer(takeoff_paras_.duration, [this]() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually work for your locally? The CI reports the following error:
[ 8%] Building CXX object deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeFiles/crazyflieLinkCpp.dir/src/Connection.cpp.o
/__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp: In member function ‘void TeleopNode::takeoff()’:
/__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp:297:10: error: no matching function for call to ‘TeleopNode::create_wall_timer(float&, TeleopNode::takeoff()::<lambda()>)’
297 | });
| ^
In file included from /opt/ros/galactic/include/rclcpp/node.hpp:1329,
from /opt/ros/galactic/include/rclcpp/executors/single_threaded_executor.hpp:28,
from /opt/ros/galactic/include/rclcpp/executors.hpp:22,
from /opt/ros/galactic/include/rclcpp/rclcpp.hpp:156,
from /__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp:5:
/opt/ros/galactic/include/rclcpp/node_impl.hpp:111:1: note: candidate: ‘template<class DurationRepT, class DurationT, class CallbackT> typename rclcpp::WallTimer<CallbackT>::SharedPtr rclcpp::Node::create_wall_timer(std::chrono::duration<_Rep1, _Period1>, CallbackT, rclcpp::CallbackGroup::SharedPtr)’
111 | Node::create_wall_timer(
| ^~~~
/opt/ros/galactic/include/rclcpp/node_impl.hpp:111:1: note: template argument deduction/substitution failed:
/__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp:297:10: note: mismatched types ‘std::chrono::duration<_Rep1, _Period1>’ and ‘float’
297 | });
| ^
[ 11%] Building CXX object deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeFiles/crazyflieLinkCpp.dir/src/USBDevice.cpp.o
[ 13%] Building CXX object deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeFiles/crazyflieLinkCpp.dir/src/Crazyradio.cpp.o
[ 16%] Building CXX object deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeFiles/crazyflieLinkCpp.dir/src/CrazyradioThread.cpp.o
[ 19%] Building CXX object deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeFiles/crazyflieLinkCpp.dir/src/CrazyflieUSB.cpp.o
[ 22%] Building CXX object deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeFiles/crazyflieLinkCpp.dir/src/CrazyflieUSBThread.cpp.o
make[2]: *** [CMakeFiles/teleop.dir/build.make:63: CMakeFiles/teleop.dir/src/teleop.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:184: CMakeFiles/teleop.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 25%] Building CXX object deps/crazyflie_tools/crazyflie_cpp/crazyflie-link-cpp/CMakeFiles/crazyflieLinkCpp.dir/src/Version.cpp.o
[ 27%] Linking CXX static library libcrazyflieLinkCpp.a
[ 27%] Built target crazyflieLinkCpp
make: *** [Makefile:141: all] Error 2
---
--- stderr: crazyflie
/__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp: In member function ‘void TeleopNode::takeoff()’:
/__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp:297:10: error: no matching function for call to ‘TeleopNode::create_wall_timer(float&, TeleopNode::takeoff()::<lambda()>)’
297 | });
| ^
In file included from /opt/ros/galactic/include/rclcpp/node.hpp:1329,
from /opt/ros/galactic/include/rclcpp/executors/single_threaded_executor.hpp:28,
from /opt/ros/galactic/include/rclcpp/executors.hpp:22,
from /opt/ros/galactic/include/rclcpp/rclcpp.hpp:156,
from /__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp:5:
/opt/ros/galactic/include/rclcpp/node_impl.hpp:111:1: note: candidate: ‘template<class DurationRepT, class DurationT, class CallbackT> typename rclcpp::WallTimer<CallbackT>::SharedPtr rclcpp::Node::create_wall_timer(std::chrono::duration<_Rep1, _Period1>, CallbackT, rclcpp::CallbackGroup::SharedPtr)’
111 | Node::create_wall_timer(
| ^~~~
/opt/ros/galactic/include/rclcpp/node_impl.hpp:111:1: note: template argument deduction/substitution failed:
/__w/crazyswarm2/crazyswarm2/ros_ws/src/ypobr1p6gmn/crazyswarm2/crazyflie/src/teleop.cpp:297:10: note: mismatched types ‘std::chrono::duration<_Rep1, _Period1>’ and ‘float’
297 | });
| ^
make[2]: *** [CMakeFiles/teleop.dir/build.make:63: CMakeFiles/teleop.dir/src/teleop.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:184: CMakeFiles/teleop.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:141: all] Error 2
---
Failed <<< crazyflie [11.7s, exited with code 2]
Sorry, I fixed the bug and it works for me now. Could you please try again? |
Thanks! |
The takeoff height, duration and the function of different buttons of the joystick can be changed in teleop.yaml.