Has anyone added code to the crazyflie to allow access to the LED ring via ROS?
We're intending to use Wolfgang's method (thank you!) for six crazyflie, and would like to also set the rings.
If we need to add this ourselves, any clue as to where please?
Fairly comfortable with C/C++ and compiling and linking, can use python and just getting to know ROS.
Thanks,
Bruce
ROS Access to LED ring?
Re: ROS Access to LED ring?
If you just want to turn the headlight on/off, change the LED color or pattern, you can use the parameter subsystem, see https://github.com/whoenig/crazyflie_ro ... py#L48-L53 for an example.
If you need to address the LEDs individually (using the memory subsystem) you would need to add code to crazyflie_ros.
Best,
Wolfgang
If you need to address the LEDs individually (using the memory subsystem) you would need to add code to crazyflie_ros.
Best,
Wolfgang
Re: ROS Access to LED ring?
Thanks! And thank you for the project.
Where are those parameters listed out?
When I search for 'ring' or 'headlight in the repo I can't find anything...
Also - sorry to hijack a bit - why are the axes in the joystick something like 4,5,2,1 instead of all 1-4? My Xbox controller is showing up the way I'd expect - the first four parameters are the four axes, but the mapping ROS (hector and from your package) seems to expect don't match. Is that just an error in the hector package I have?
Bruce
Where are those parameters listed out?
When I search for 'ring' or 'headlight in the repo I can't find anything...
Also - sorry to hijack a bit - why are the axes in the joystick something like 4,5,2,1 instead of all 1-4? My Xbox controller is showing up the way I'd expect - the first four parameters are the four axes, but the mapping ROS (hector and from your package) seems to expect don't match. Is that just an error in the hector package I have?
Bruce
Re: ROS Access to LED ring?
You could execute to get a list of parameters. They are part of the Crazyflie firmware and as such queried dynamically. I don't think there is a central list describing all of them, so you would need to look in the firmware to find the exact definition.
The joystick should match the original Microsoft XBox360 controller - you might just have a different controller. You can change the mapping in https://github.com/whoenig/crazyflie_ro ... 360.launch.
Code: Select all
rosrun crazyflie_tools listParams
The joystick should match the original Microsoft XBox360 controller - you might just have a different controller. You can change the mapping in https://github.com/whoenig/crazyflie_ro ... 360.launch.
Re: ROS Access to LED ring?
Thank you. Edited the hector and crazyflie ROS xbox launch files and I'd least I can fly now!
I see that your one parameter - the LED headlights in the demo is working. Pretty sure that once I have the param IDs I can go from there.
No luck with listParams yet - it says something about connecting to dongle, and I worked out that I need to specify the radio URI (with settings like the crazyflie), but don't get a response yet.
I guess it's somewhere in the firmware, but I thought that was in the package - maybe I'll go and dig through that. Maybe I need to update my MAVs too.
Will keep digging, thanks.
Bruce
I see that your one parameter - the LED headlights in the demo is working. Pretty sure that once I have the param IDs I can go from there.
No luck with listParams yet - it says something about connecting to dongle, and I worked out that I need to specify the radio URI (with settings like the crazyflie), but don't get a response yet.
I guess it's somewhere in the firmware, but I thought that was in the package - maybe I'll go and dig through that. Maybe I need to update my MAVs too.
Will keep digging, thanks.
Bruce
Re: ROS Access to LED ring?
Found this in the firmware...
From which I'd expect to be able to copy your example:
I'll try, thanks. Not sure why the listParams isn't working though. If I add debug printfs (and rebuild the catkin space) they should pop up?
Bruce
Code: Select all
PARAM_GROUP_START(ring)
PARAM_ADD(PARAM_UINT8, effect, &effect)
PARAM_ADD(PARAM_UINT32 | PARAM_RONLY, neffect, &neffect)
PARAM_ADD(PARAM_UINT8, solidRed, &solidRed)
PARAM_ADD(PARAM_UINT8, solidGreen, &solidGreen)
PARAM_ADD(PARAM_UINT8, solidBlue, &solidBlue)
PARAM_ADD(PARAM_UINT8, headlightEnable, &headlightEnable)
PARAM_ADD(PARAM_FLOAT, glowstep, &glowstep)
PARAM_ADD(PARAM_FLOAT, emptyCharge, &emptyCharge)
PARAM_ADD(PARAM_FLOAT, fullCharge, &fullCharge)
PARAM_GROUP_STOP(ring)
Code: Select all
value = int(rospy.get_param("ring/neffect"))
rospy.set_param("ring/effect", 0)")
to
rospy.set_param("ring/effect", value)")
Bruce
Re: ROS Access to LED ring?
Hi,
I see these parameters with "rosparam list":
so you should be able to set them from your code.
I see these parameters with "rosparam list":
Code: Select all
$ rosparam list
(...)
/crazyflie1/ring/effect
/crazyflie1/ring/emptyCharge
/crazyflie1/ring/fullCharge
/crazyflie1/ring/glowstep
/crazyflie1/ring/headlightEnable
/crazyflie1/ring/neffect
/crazyflie1/ring/solidBlue
/crazyflie1/ring/solidGreen
/crazyflie1/ring/solidRed
(...)