Page 1 of 1
ROS Access to LED ring?
Posted: Mon Mar 06, 2017 4:08 am
by bwheaton
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
Re: ROS Access to LED ring?
Posted: Mon Mar 06, 2017 4:51 am
by whoenig
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
Re: ROS Access to LED ring?
Posted: Mon Mar 06, 2017 7:36 pm
by bwheaton
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
Re: ROS Access to LED ring?
Posted: Tue Mar 07, 2017 6:58 pm
by whoenig
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.
Re: ROS Access to LED ring?
Posted: Tue Mar 07, 2017 7:55 pm
by bwheaton
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
Re: ROS Access to LED ring?
Posted: Wed Mar 08, 2017 1:19 am
by bwheaton
Found this in the firmware...
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)
From which I'd expect to be able to copy your example:
Code: Select all
value = int(rospy.get_param("ring/neffect"))
rospy.set_param("ring/effect", 0)")
to
rospy.set_param("ring/effect", value)")
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
Re: ROS Access to LED ring?
Posted: Thu Mar 09, 2017 9:28 am
by arnaud
Hi,
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
(...)
so you should be able to set them from your code.